SetEvents Method (HTMLCONTROL)


10.9, PLBCMP GUI Only

 

The SetEvents method changes the data-plbevent attribute in a HTML element contained in a HTMLCONTROL object. The method sets the data-plbevent attribute in the HTML element that has an id attribute that matches the id parameter. This method uses the following format:

 

[label]

{object}.SetEvents

[GIVING {return}] USING [*Id=]{id}:

 

 

[*Event=]{value}[,[*Flags=]{flags}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A HTMLCONTROL that is accessed.

return

Optional. A Numeric Variable that always returns zero.

Id

Required. A Character String Variable or literal that contains the HTML element id attribute.

value

Required. A Character String Variable or literal that has zero or more JavaScript event names.

flags

Optional. A Numeric Variable or decimal value that specifies a bit mask value that controls the behavior of this method.

Flags Affected: OVER, ZERO

Note the following:

  1. This method changes the data-plbevent attribute value in a HTML element contained in a HTMLCONTROL object.

  2. The ZERO flag is always set TRUE.

  3. The OVER flag is always set FALSE.

  4. The {id} is a value that determines the HTML element used for data changes. The {id} string is matched against the id attribute of the HTML element.

  5. The {value} string contains zero or more JavaScript event names which must be separated by a whitespace character delimiter. See this URL Link for more information on events:

  6.  

    https://developer.mozilla.org/en-US/docs/Web/Events

     

  7. To receive JavaScript events in the PL/B program the EVENTREGISTER statement must be used to register the $JQueryEvent (event number 200) event for a HTMLCONTROL object.

  8. The {flags} parameter is a bitmask value that forces specialized behaviors for the execution of this method.

  9. The {return} value will always be zero.

Example of SetEvent Method:

 

For a HTMLCONTROL that contains a HTML element as follows:

 

<input type='text' class='myClass' data-plbenable='on' data-plbevent='change keypress click focus' maxlength=10 id='MyEdit'>

 

This PL/B SetEvent method changes the data-plbevent value using the following instruction:

 

     HtmlControl.SetEvent Using "MyEdit","click change"

 

In this example, the new HTML element is updated as follows:

 

<input type='text' class='myClass' data-plbenable='on' data-plbevent='click change' maxlength=10 id='MyEdit'>

 

 

See Also: HTMLCONTROL Method Syntax



PL/B Language Reference