Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Error in OLE event
Not sure what is going on here but I thought I would ask here first as the error is on an OLE event on your button control.
Event copied from OI 9.4 looks like this
Call ToolBar_OLE_Event(CtrlEntId, EventName)
Return 1
When I run the form and click on the button, the code that I call above seems to execute but then I get an error.
The error occurs in the event, but the fatal runtime error makes no sense. It says
ENG0015: $$$$W_TACTIC*OLE*MAIN_TACTIC,BUTTTON2, line 23 illegal op code 73.
The event only has 2 lines how can it fail on line 23? BTW the line number it fails on seems to vary.
Any ideas? Or do I need to ask this question on the Revelation forum?
Event copied from OI 9.4 looks like this
Call ToolBar_OLE_Event(CtrlEntId, EventName)
Return 1
When I run the form and click on the button, the code that I call above seems to execute but then I get an error.
The error occurs in the event, but the fatal runtime error makes no sense. It says
ENG0015: $$$$W_TACTIC*OLE*MAIN_TACTIC,BUTTTON2, line 23 illegal op code 73.
The event only has 2 lines how can it fail on line 23? BTW the line number it fails on seems to vary.
Any ideas? Or do I need to ask this question on the Revelation forum?
Comments
If I comment out the call to the subroutine, the error goes away (but the code I need to run obviously does not execute). If I add the call back in I get the same error or similar, the exact message seems to vary, this time I got
ENG0015: $$$$W_TACTIC*OLE*MAIN_TACTIC,BUTTTON2, line 1023 illegal op code 57.
ENG0015: $$$$W_TACTIC*OLE*MAIN_TACTIC,BUTTTON2, line 76 illegal op code 73.
So you are saying the error is in the subroutine being called, but the debugger is reporting the error in the event.
If I place a debug at the front of the subroutine being called then step through the subroutine, It all seems to work but at the end of the code as the subroutine returns to the event I see the error.
So it seems my code is doing something that breaks OI10.
Problem is this code is doing a lot, detaching and attaching tables, reading data etc.
This might take some time to track down, ugh...
Call Send_Event("MAIN_TACTIC.MENU.FILE.OPEN","MENU")
If I take the code from that menu event and replace the above line of code, the error still occurs.
However, if I just use the menu to execute the code and ignore the button bar, I don't see an error. The exact same code is running but I only see the error when called via the OLE event on your control.
I'll keep you updated.
Ugh, I hate this...
Code called from menu event works.
Same exact call from OLE event fails on return
Call ToolBar_OLE_Event(CtrlEntId, EventName)
With
Call Send_Event("MAIN_TACTIC.MENU.FILE.OPEN","MENU")
You still see the error?
USing SRPs OLE Button control.
If I call a piece of code from a menu event on a form, it works.
If call exact same code from OLE button control on the same form, OI gives an error as it returns from the code into the event. That is the error is reported in the event.
The error looks like this:
ENG0015: $$$$W_TACTIC*OLE*MAIN_TACTIC,BUTTTON2, line 23 illegal opcode 73.
The line number and opcode seem to vary (I just saw an opcode of 57). Note OLE event only has 2 lines a call to the same code called in the menu event and a Return 1, so line number makes no sense.
The event is qualified like this:
Ret_Val = Send_Message(OleCtrlEntId, "QUALIFY_EVENT", "OnClick", 1)
Any ideas anyone?
I placed at the very front of ToolBar_OLE_Event the same code as in the menu event followed by a return. So the only code executing in ToolBar_OLE_Event is the same code as in the menu event.
I just tried this:
Removed call to ToolBar_OLE_Event in OLE event and replaced it with the same exact code as the menu event has.
Now when I run the OLE event, OI crashes hard, no error just closes.
The code opens a dialog, lets the user makes a few choices, the user presses OK button, it then detaches tables, deletes files, copies files, attaches tables, reads all kind of data from DOS files. Enables and disables menus on an OI form, and probably a heck of a lot more.
Up until the crash, as best I can tell the called code works.
I don't think it's something my code is doing. If my code has a problem why would the same code work perfectly from a menu event?
Don't misunderstand me, I'm not faulting your code but something that your code is doing is giving OI 10 some fits. I understand this only occurs during an OLE event. But as you pointed out, it works in OI 9 so this still suggests that something in OI 10 is different enough to cause this problem. So I encourage you to continue simplifying your code until you get to the root of the issue. From there we can better advise you of a solution or work around.
Is this crash new under OI10, I have not seen it on 9.4.
The crash is due to calling Repository('COMPILE' in the code.
If the code called from the OLE event has a call to Repository('COMPILE' it will crash, the same code called from a menu event does not crash.
Thanks for the suggestion.
I guess we wait to see what Carl comes up with.
I think I can code around this by saving both the source code and the compiled code, that would remove the need to compile the code when I load it.