Triggerevent function explanation

Source: Internet
Author: User

Function: triggers the specified event of the specified object and immediately executes the script in the event. Note the difference between this function and postevent. Postevent is not executed immediately, and triggerevent is the script that triggers the event immediately.
Function Syntax: objectname. triggerevent (event {, word, long })
Lobjectname: any object or control in Pb, As long as there is an event that can be triggered.
Levent: the event to be triggered. It can be an enumeration type or a string type. Events provided by Pb can be represented by enumeration or string type, such as clicked! Or 'clicked' can represent clicked events. Custom User events can only be represented by string. Note that the event here should provide a script.
Lword: this parameter is not required. Use the word and long parameters when you need to pass data to the triggered event. Both parameters can pass data of the long type, but long can also pass data of the string type, and this parameter can only pass data of the long type. If this parameter is used, message. wordparm is used in the triggered event to receive transmitted data. If you do not use this parameter to pass data but use the long parameter to pass data, set this parameter to 0.
Llong: this parameter is not required to pass data of the long or string type. Use message. longparm to receive transmitted data. The message object when data of the string type is passed. longparm stores the stored address of the transmitted data. You must use string (XX, 'address') to read the string type data in this address.
Return Value: Integer type. If 1 is returned, the function is successfully executed. If no script or function execution error exists in the specified event,-1 is returned. If any parameter is null, the function returns NULL.
Code Instance:
Example 1: trigger the default event:
Cb_1.triggerevent (clicked !)
It is equivalent:
Cb_1.triggerevent ("clicked ")
Example 2: trigger a user-defined event:
W_main.triggerevent ("ue_open ")
Example 3: Transfer and receive information:
W_main.triggerevent ("ue_open", 0, 'test ')
Receive data in user-defined event ue_open:
String ls_msg

Ls_msg = string (message. longparm, 'address ')
Example 4: transmit long data:
W_main.triggerevent ('UE _ open', 100,0)
Receive data in user-defined event ue_open:
Long ll_msg

Ll_msg = message. wordparm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.