Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Trigger a User Event that has arguments??

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
0
0
US
I have a window that I've placed a user object on. This user object has a button on it. The script behind the button looks like:

iw_parent.Trigger Event ue_filter_dw(is_parm1, is_parm2)

iw_parent is an instance variable that is populated in the contructor event of this user object: iw_parent = GetParent()

When I try to close the script for the above named button, I get the following error:

unknown function name: ue_filter_dw

I'm using PB6.5. How can I trigger a parent windows user event that requires arguments from a user object that sits on that window?
 
Kaul,

Well! You have a couple of alternatives. The graceful way to do it is by declaring the iw_Parent var with the datatype of the actual window. For instance, if the name of the window is w_Sheet_Trans, you would declare it as:

w_Sheet_Trans iw_Parent

Using the above technique, the code gets compiled and validated because that is where the event was declared.

Another way of doing it is by using the DYNAMIC keyword:

iw_Parent.Event DYNAMIC ue_Filter_DW( ... )

but this does not validate the code until runtime. If it cannot find the function at runtime, you get an error.

Yet another way of doing it is by using the Message object. Look at TriggerEvent() PowerScript function in the Help file.

---
PowerObject!
-----------------------------------------
PowerBuilder / PFC Developers' Group
 
Thanks for your help!!!

Using - iw_Parent.Event DYNAMIC ue_Filter_DW( ... ) - corrected the problem.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top