inter-event communication (OpenInsight Specific)
At 23 JUL 1998 09:12:44PM Terry Evans wrote:
OK I'm brain-dead, but maybe someone can get me kick-started again.
OI's event driven. I'm running a stored procedure from a form with two controls (EDIT1 & BUTTON2). EDIT1 has a LOSTFOCUS event & BUTTON2 has a CLICK event. When I click on BUTTON2, the LOSTFOCUS code tests for a value in EDIT1 and if none, displays a Msg() box. This causes the LOSTFOCUS code to wait for the user to press the OK button before continuing. But the CLICK event is now triggered and runs that code segment. How do I get the CLICK event code to recognize the status of the LOSTFOCUS code?
I've tryed named common and a user-defined @variable. Neither seem to be updated in time.
Any help?
TIA
Terry
At 23 JUL 1998 09:30PM Dave Pociu wrote:
If I understand your question correctly, you would like the LostFocus event to store a value (Ex: 1 if OK, 0 if error) and you would like the Click event to detect that.
I also assume that your CLICK event looks like this:
* some code send_event( @window:".EDIT1" , "LOSTFOCUS" , param1 , param2) do something if no error
return 0
There are a number of ways of doing what you ask, but here's one that involves @properties:
Change your CLICK event code to the following :
* some code x=set_property( @window , "@EDIT1_OK" , 0 ) ; initialize flag
send_event( @window:".EDIT1" , "LOSTFOCUS" , param1 , param2)
ok=get_property( @window , "@EDIT1_OK" ) ; get the status of the flag if ok then do something if no error
end else
* whateverend
return 0
Your LOSTFOCUS event should look like this:
some code forward_event( Flag, FocusID) error=get_EventStatus() if not(error) then x=set_property( @window , "@EDIT1_OK" , 1 ) end more code
return 0
Hope this does the trick.
Dave
At 24 JUL 1998 05:29PM Jeff Blinn wrote:
If you're validating the data 'before' the click event triggers - you can RETURN 0 from the LostFocus event if the field does not contain what you want (and probably put focus back on the edit line). If the edit line contains valid data (as determined by the LostFocus event), use a RETURN 1 to allow event processing to continue.
Jeff