PxPlus User Forum

Twitter Twitter Twitter

Author Topic: WAIT FOR EVENT example - Error 49  (Read 703 times)

Jeff Wilder

  • Silver Member
  • ***
  • Posts: 27
    • View Profile
WAIT FOR EVENT example - Error 49
« 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

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3368
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: WAIT FOR EVENT example - Error 49
« Reply #1 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.

Jeff Wilder

  • Silver Member
  • ***
  • Posts: 27
    • View Profile
Re: WAIT FOR EVENT example - Error 49
« Reply #2 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

James Zukowski

  • Diamond Member
  • *****
  • Posts: 157
    • View Profile
Re: WAIT FOR EVENT example - Error 49
« Reply #3 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.
James Zukowski
Programmer / ERP Analyst
Beauty Enterprises, Inc.
150 Meadow St.
Hartford, CT 06114
860.296.9303  Ext 231

Jeff Wilder

  • Silver Member
  • ***
  • Posts: 27
    • View Profile
Re: WAIT FOR EVENT example - Error 49
« Reply #4 on: July 18, 2018, 10:11:42 AM »
Hi James. The ENABLE EVENT is inside the *systems.pvc SetTimer() function.