PxPlus User Forum

Twitter Twitter Twitter

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

Jeff Wilder

  • Silver Member
  • ***
  • Posts: 42
    • 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

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
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.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Jeff Wilder

  • Silver Member
  • ***
  • Posts: 42
    • 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: 296
    • 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
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Jeff Wilder

  • Silver Member
  • ***
  • Posts: 42
    • 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.