faqts : Computers : Programming : Languages : Tse : Event

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

TSE: Event: Function: Connect: How to connect a function to an event? [hook]

Apr 22nd, 2005 11:28
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 21 April 2005 ---------------------------------

TSE: Event: Function: Connect: How to connect a function to an event? 
[hook]

---

Steps: Overview:

 1. -Choose your event

     1. -For example you want a function
         executed each time after you pressed
         any key

          e.g.

           _AFTER_GETKEY_

 2. -Create the corresponding function
     you want to have executed when that
     event happens

      e.g.

--- cut here: begin --------------------------------------------------

PROC PROCAfterGetKey()
 Message( CurrChar() )
END

--- cut here: end ----------------------------------------------------

 3. -Connect this event to your function

     1. Use the function

         Hook( <event name>, <your function name> )

          e.g.

           Hook( _AFTER_GETKEY_, PROCAfterGetKey )

 4. -So alltogether you might get the following source code

--- cut here: begin --------------------------------------------------

PROC PROCAfterGetKey()
 Message( CurrChar() )
END

PROC Main()
 Hook( _AFTER_GETKEY_, PROCAfterGetKey )
END

--- cut here: end ----------------------------------------------------

 5. -If you run this macro, you will see on the
     status bar the ASCII value of the last character
     the cursor visited.

      e.g. if the cursor is moved away from the character 'a'
           you will see the ASCII value '97' on the taskbar.

---
---

Internet: see also:

---

TSE: Event: Link: Overview: Can you give an overview of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/35749/fid/1796

----------------------------------------------------------------------