EVENTSEND


PLBCMP GUI Only

square.png Objects

 

The EVENTSEND instruction allows sending an event to a specified object. Optional keyword parameter data can be sent when the event is posted or queued. The instruction uses the following format:

 

[label]

EVENTSEND

{object},{event}[,{keyword=dest},...]]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A previously defined and created object, pointer to an object, COLLECTION, or the keyword *CLIENT.

event

Required. A previously defined Numeric Variable, Literal, decimal number, or Expression that specifies the event type registered.

keyword

Optional. One of the EVENTINFO keywords from the table below.

dest

Optional. A previously defined Character String Variable, Numeric Variable, or VARIANT that receives the result of the operation.

Flags Affected: OVER (Automation Server Only)

Note the following:

  1. The {object} must have been previously CREATEd.

  2. {event} is a decimal number, a Numeric Variable, an Expression, or a keyword as defined in PLBEQU.INC. The supported values and keywords are:

  3.  

    Value

    Keyword

    Event

    0

    $LOAD

    Load

    1

    $ACTIVATE

    Activate

    2

    $DEACTIVATE

    Deactivate

    3

    $CHANGE

    Change

    4

    $CLICK

    Click

    5

    $CLOSE

    Close

    6

    $DBLCLICK

    DoubleClick

    7

    $DRAGDROP

    DragDrop

    8

    $DRAGOVER

    DragOver

    9

    $GOTFOCUS

    GotFocus

    10

    $KEYPRESS

    KeyPress

    11

    $LOSTFOCUS

    LostFocus

    12

    $MOVE

    Move

    13

    $MOUSEDOWN

    MouseDown

    14

    $MOUSEUP

    MouseUp

    15

    $MOUSEMOVE

    MouseMove

    16

    $PAINT

    Paint

    17

    $RESIZE

    Resize

    18

    $TIMER

    Timer

    19

    $OLDEVENT

    OldEvent

    20

    $FORMINIT

    FormInit

    21

    $OBJMOVE

    ObjMove

    22

    $UPDATED

    Updated

    23

    $COLCLICK

    ColClick

    24

    $VALIDATE

    Validate

    25

    $ITEMACTIVATE

    ItemActivate

    26

    $BUTTONCLICK

    ButtonClick

    26

    $ITEMCLICK

    ItemClick

    27

    $MOUSEWHEEL

    MouseWheel

    28

    $HSCROLL

    HScroll

    29

    $VSCROLL

    VScroll

    31

    $LINKCLICK

    LinkClick

    32

    $SUSPEND

    Suspend

     

  4. Any event number used other than a predefined {event} numbers is considered a user-defined event. When using user-defined events, the user is responsible for insuring that an {object} has registered the event or can make use of the event being sent.

  5. When the {object} is specified as *CLIENT, the {event} value must be a value of one to ten. The event is sent to the client program that is receiving the events for the PL/B Automation Server program object. The {event} value in this case must match the UserEvent1 to UserEvent10 defined for the PL/B Automation Server program object. Each event can have five optional parameters (ARG1 to ARG5) to pass data with the event. ARG1 to ARG5 are the only keywords that send data to a connected client program. It should be noted that the number of arguments (ARGn) are limited to five when {object} is specified as *CLIENT. However, it possible that other types of objects may allow a maximum of ten arguments (ARGn). The OVER flag is affected when the *CLIENT internal object is specified. The OVER flag is set when there are no client programs connected to the Automation Server that can receive the event.
     

  6. Event Value

    Client Event

    Optional Parameters

    1

    UserEvent1

    ARG1, ARG2, ARG3, ARG4, and ARG5

    2

    UserEvent2

    ARG1, ARG2, ARG3, ARG4, and ARG5

    ...

     

     

    10

    UserEvent10

    ARG1, ARG2, ARG3, ARG4, and ARG5

    Example:

     

    EVENTSEND

    *CLIENT,1,ARG1=NAME,ARG2=PHONE

     

    Where:

    *CLIENT

    Identifies the client program connected to the Automation Server program object.

    1

    Indicates that event number 1 is sent

    ARG1=NAME

    Identifies that the data found in NAME variable is sent as ARG1 parameter data for the event.

    ARG2=PHONE

    Identifies that the data found in PHONE variable is sent as ARG2 parameter data for the event.

     

  7. The optional {keyword} operand defines the type of information that is sent. It must be from the following table:

  8.  

    Keyword

    Use

    ARGx=<var>

    Sends the specified argument for the event. ARGx may be a value of ARG1 to ARG10 indicating the respective argument.

    CHAR=<svar>

    Sends the character that caused the event.

    MODIFIER=<nvar>

    Sends the Event Modifier.

    RESULT=<nvar>

    Sends the expected result value.

    ARG1=<var>

    Argument 1 data that is sent. The {var} variable can be a Numeric Variable, String Variable, or a VARIANT.

    ARG2=<var>

    Argument 2 data that is sent. The {var} variable can be a Numeric Variable, String Variable, or a VARIANT.

    ARG10=<var>

    Argument 10 data that is sent. The {var} variable can be a Numeric Variable, String Variable, or a VARIANT.

     

  9. The Event Modifier is a value accumulated from any combination of the following values:

  10.  

    Value

    Modifier

    0

    No modifier provided

    1

    Alt Key

    2

    Ctl Key

    4

    Shift Key

    8

    Left mouse button down

    16

    Right mouse button down

    32

    Double click

     

  11. Multiple {keyword=dest} pairs may be specified, separated by commas.

  12.  

     

    EVENTSEND

    {object},{event}}:

     

     

     

    CHAR=#EventChar:

     

     

    MODIFIER=#EventMod:

     

     

    RESULT=#EventResult

     

  13. When the {object} is specified as *CLASS, the EVENTSEND must be executed from the CLASSMODULE load module which has been created using a CREATE PLBOBJECT instruction. In this case, the EVENTSEND immediately dispatches execution to the PLBOBJECT object event handler routine which has been registered using an EVENTREG instruction for the PLBOBJECT object. When the event handler routine is finished and returns, the program execution continues at the PL/B statement following the EVENTSEND instruction. The 'EVENTSEND *CLASS, ..." instruction is only supported by a Windows Runtime.

  14. Example of 'MyClass.plc':

.

              CLASSMODULE

.

              INCLUDE plbequ.inc

.

  nProp1Count FORM 5 //Property One Count

 .

              ...

.

Set_Prop1 FUNCTION //Prop1 property!!

ResetValue FORM 5

              ENTRY

.

              MOVE ResetValue, nProp1Count

.

              EVENTSEND *CLASS,$CHANGE,RESULT=nProp1Count

. FUNCTIONEND

 

 

See Also: CREATE, Object Instructions



PL/B Language Reference EVENTREGISTER FORMLOAD