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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Triggering an event from another window

Status
Not open for further replies.

marvin2010

Programmer
Mar 5, 2010
35
PH
Is it possible to trigger an event (say, ue_compute) which is on another window (say, w_assess) from the first opened window (say w_inquiry)?

I'm using PB 9

Thanks.
 
One way:
Code:
IF IsValid(w_assess) THEN
   w_assess.EVENT ue_compute()
END IF
Matt

"Nature forges everything on the anvil of time
 
Matt,

I was able to test if the script works. In my case, it didn't.

w_assess contains the ue_compute event that will be called from w_inquiry.

Any more ideas?

Thanks.
 
Matt,

Additional information:

A null object reference error occurs should I force it to be executed.


Thanks.
 
try this..

IF IsValid(w_assess) THEN
w_assess.TriggerEvent('ue_compute')
END IF


paul
 
Sir Paul...


Same results. It reports of "A null object reference error occurs should I force it to be executed."


Thanks.
 
your window w_asses ... Did you do an OPEN before trying to execute its event????

regards,
Miguel L.
 
I believe that the window w_assess should be open in order to access the event named 'ue_compute' then just hide it again then go back to the main window named w_inquiry..

this process will be helfpul in order to execute this script:

IF IsValid(w_assess) THEN
w_assess.TriggerEvent('ue_compute')
END IF
 
Okay, if the window is not open, then it won't be valid.
You should open the window before you can reference anything of it.

IF not IsValid(w_assess) THEN
open( w_assess)
post close( w_assess) // only if it wasn't open already
end if

w_assess.event ue_compute()

using 'post' you'd close the window w_assess if it wasn't open and you merely opened it for being able to execute its
event. (post will do the close after finishing the actual code, that executes the event).
if it was already, it won't close since it probably was opened for some other reason than your need to execute its event.


regards,
Miguel L.
 
Miguel,

Oh I see. Ok I'll give it a try later. I will let you know what happened.

Thanks so much. I appreciate it.


Paul,

Thanks too. :)
 
Hey Miguel,

It worked! And I am so happy about it.

I followed what you and Paul said. It did not worked at first because the window, aside from being closed, is a response window. I needed to change the type then open then hide it then it executed the event I wanted.

Thanks guys!

Appreciate it.
 
if the window is as response window, at the moment you execute the 'open()' your code will wait to execute untill it closes. If you have a reponse window and don't want to change its type, you can also do an OpenSheet(), with no need to change the type. That will make the window to behave as a sheet, even thought the type originally is response, it won't behave that way.
Glad to have helped you a little bit.

regards,
Miguel L.
 
That's great! I'll give it a try.

Indeed you helped me a lot.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top