Main Board > Programming

WAIT FOR EVENT example - Error 49

(1/1)

Jeff Wilder:
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: ---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
--- End code ---


--- Code: ---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

--- End code ---

Thanks,
Jeff

Mike King:
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.

Jeff Wilder:
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

James Zukowski:
Based on the examples, both above and in the documentation, there seems to be an ENABLE EVENT directive missing.

Jeff Wilder:
Hi James. The ENABLE EVENT is inside the *systems.pvc SetTimer() function.

Navigation

[0] Message Index

Go to full version