Navigation: Language Reference > 13 - Built-in Functions >====== POST (post user-defined event) ====== | ![]() ![]() ![]() |
POST( event [,control] [,thread] [,position] )
POST | Posts an event. |
event | An integer constant, variable, expression, or EQUATE containing an event number. A value in the range 400h to 0FFFh is a User-defined event. |
control | An integer constant, EQUATE, variable, or expression containing the field number of the control affected by the event. If omitted, the event is field-independent. |
thread | An integer constant, EQUATE, variable, or expression containing the execution thread number whose ACCEPT loop is to process the event. If omitted, the event is posted to the current thread. |
position | An integer constant, EQUATE, variable, or expression containing either zero (0) or one (1). If one (1), the event message is placed at the front of the event message queue. If omitted or zero (0), the event message is placed at the end of the event message queue. |
POST posts an event to the currently active ACCEPT loop of the specified thread. This may be a User-defined event, or any other event. User-defined event numbers can be defined as any integer between 400h and 0FFFh. Any event posted with a control specified is a field-specific event, while those without are field-independent events.
POSTing an event causes the ACCEPT loop to fire but does not cause the event to “happen.” For example, POST(EVENT:Selected,?MyControl) executes any code in EVENT:Selected for ?MyControl but does not cause ?MyControl to gain focus.
Example:
Win1 WINDOW('Tools'),AT(156,46,32,28),TOOLBOX
BUTTON('Date'),AT(0,0,,),USE(?Button1)
BUTTON('Time'),AT(0,14,,),USE(?Button2)
END
CODE
OPEN(Win1)
ACCEPT
IF EVENT() = EVENT:User !Detect user-defined event
BREAK
END
CASE ACCEPTED()
OF ?Button1
POST(EVENT:User,,UseToolsThread) !Post field-independent event to other thread
OF ?Button2
POST(EVENT:User) !Post field-independent event to this thread
END
END
CLOSE(Win1)
See Also: