PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Jeff Wilder on July 17, 2018, 01:36:46 PM

Title: WAIT FOR EVENT example - Error 49
Post by: Jeff Wilder on July 17, 2018, 01:36:46 PM
Hello,
Does anyone have an example of how to properly use the WAIT FOR EVENT directive? I can't find anything by searching the manual or the forum.
I have a program that sets up several events and should then sit and wait for one of them to occur. When I hit the WAIT FOR EVENT directive, I receive an error 49. (PxPlus v14.00).

Here are some very simplified examples which both fail on line 60:
Code: [Select]
0010 BEGIN
0020 DEF OBJECT s,"*system"
0030 s'SetTimer(5)
0050 ON EVENT "TimeOut" FROM s PREINPUT 101
0060 WAIT FOR EVENT
0070 PRINT CTL
0080 DELETE OBJECT s
0090 END

Code: [Select]
0010 BEGIN
0020 DEF OBJECT s,@(0,0,70,20),"Shell.Explorer.2"
0030 LET x=NEW("TestEvent")
0040 ON EVENT FROM s PROCESS x
0050 s'Navigate2("http://www.msn.com")
0060 WAIT FOR EVENT
0070 DELETE OBJECT s
0080 END

Thanks,
Jeff
Title: Re: WAIT FOR EVENT example - Error 49
Post by: Mike King on July 17, 2018, 02:40:02 PM
Have you checked out the example in ENABLE EVENT?
https://manual.pvxplus.com/page/directives/enable_event.htm

Also, many events only work on Windows.
Title: Re: WAIT FOR EVENT example - Error 49
Post by: Jeff Wilder on July 17, 2018, 04:20:05 PM
Hello Mike,
Yes. I have reviewed that page. The events fire as expected. The problem is the "WAIT FOR EVENT" directive. When the program reaches that line, it produces an error 49, Internal program format error. Have I misunderstood the purpose of this directive? If so, how is it intended to be used?

Thank you,
Jeff
Title: Re: WAIT FOR EVENT example - Error 49
Post by: James Zukowski on July 18, 2018, 10:03:42 AM
Based on the examples, both above and in the documentation, there seems to be an ENABLE EVENT directive missing.
Title: Re: WAIT FOR EVENT example - Error 49
Post by: Jeff Wilder on July 18, 2018, 10:11:42 AM
Hi James. The ENABLE EVENT is inside the *systems.pvc SetTimer() function.