【PB】TriggerEvent()/Event()/PostEvent()有什么不同「建议收藏」

【PB】TriggerEvent()/Event()/PostEvent()有什么不同「建议收藏」TriggerEvent()/Event()/PostEvent()有什么不同在PB中经常要从一个事件中调用另外一个事件,常用的就是这几个函数event把被调用事件放在最后面处理,可以带参数,也可以返回值,dynamicevent()是其经典用法注:Dynamic表示编译时指定事件可以不存在,系统把返回值类型检查推迟,到应用程序运行时进行。triggerEvent触发指定对象

大家好,欢迎来到IT知识分享网。 

TriggerEvent()/Event()/PostEvent()有什么不同

在PB中经常要从一个事件中调用另外一个事件,常用的就是这几个函数

event把被调用事件放在最后面处理,可以带参数,也可以返回值,dynamic event()是其经典用法

注:Dynamic表示编译时指定事件可以不存在,系统把返回值类型检查推迟,到应用程序运行时进行。

triggerEvent触发指定对象的指定事件,是在事件队列的当前位置插入指定的事件,并且立即执行该事件中的脚本,它只能返回1,-1 或者空,带了long,word也比较麻烦

PostEvent在事件队列最后追加指定的事件,不是立即执行

—–

In PowerBuilder, there are several types of events.
System events with an ID:
User actions or other system messages or a call in your scripts

System events without an ID:

User-defined events with an ID:User actions or other system messages or a call in your scripts

User-defined events without an ID:A call in your scripts

—–
objectname.TriggerEvent ( event {, word, long } )

Triggers an event associated with the specified object, which executes the script for that event immediately.

Return value
Integer.
Returns 1 if it is successful and the event script runs and -1 if the event is not a valid event for objectname, or no script
exists for the event in  objectname. If any argument’s value is null, TriggerEvent returns null.

Usage
If you specify the name of an event instead of a value of the TrigEvent enumerated datatype, enclose the name in double
quotation marks.

—–
objectname.PostEvent ( event, { word, long } )

Adds an event to the end of the event queue of an object.

Return value
Boolean.
Returns true if it is successful and false if the event is not a valid event for objectnameobjectname. Also returns true if
no script exists for the event in objectname. If any argument’s value is null, PostEvent returns null.

Usage
You cannot post events to the event queue for an application object. Use TriggerEvent instead.

PowerBuilder messages or a call in your scripts

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/25194.html

(0)

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信