SAVEWARN not set until control loses focus (OpenInsight Specific)
At 10 AUG 1998 09:56:59PM Michael Moran wrote:
It appears as though the SAVEWARN property doesnt get set until the control that was changed loses focus. This means that if a user hits the save key before leaving the control that has been changed, then you cant test the SAVEWARN property in the WRITE event.
I want to be able to write a "last changed date" and "last changed time" to an audit file if the record has changed. If the user hits save, but the the record hasnt changed, I dont want to save the audit. Thus the reason for using SAVEWARN.
Thanks,
Michael
At 10 AUG 1998 10:35PM Don Bakke wrote:
Michael,
Yes, SAVEWARN is triggered by the LOSTFOCUS event. This is when OI determines if there is a change in the current field. System level events, like CLEAR, will automatically send a LOSTFOCUS event to the current control to make sure that any changes are registered and the SAVEWARN property is set appropriately.
In your case you are executing a WRITE event script which occurs before the system level WRITE event so no LOSTFOCUS has taken place. The solution: place a couple lines of code likeā¦
Focus=Get_Property(@Window, "FOCUS")
call Send_Event(Focus, "LOSTFOCUS")
Before you check the SAVEWARN property. Everything should work as intended.
At 12 AUG 1998 12:13AM Aaron Kaplan wrote:
In the menu designer, there's an option to generate the lostfocus event before the menu item is called. Set this on the save menu and you should have your lostfocus, and savewarn.
At 12 AUG 1998 02:12AM Don Bakke wrote:
In the menu designer, there's an option to generate the lostfocus event before the menu item is called.
I haven't checked this out myself, but I thought this didn't apply when using hotkeys (i.e. Ctrl-S, F9) to execute menu functions.
At 13 AUG 1998 12:33AM Aaron Kaplan wrote:
Just ran a few really quick tests and it appears to generate using the hotkeys. I just place quickevent message calls for these sort of tests though.