Focusbehavior Parameter
Every frame has its own input focus. When the user leaves a window, the frame does not lose its input focus. The input focus stays on the same field, even though the user has selected another field in another window.
For example, if the user is in the process of entering data into a field on Window 1 and then selects Window 2, the input focus for Window 1 stays on the field where the user was entering the data. Because the field on the first frame still has the input focus, the data validation code for the field is not triggered, even though the user has left the window. (Typically, the data validation code for a field is contained in the SetValue or Exit event blocks for the field, so data validation takes place when the user changes or leaves the field.) The SendUserEvent method provides a focusbehavior parameter to enable you to deal with this situation.
The focusbehavior parameter of the SendUserEvent method lets you trigger the SetValue event or both SetValue and Exit events for the field with the input focus before the user event is triggered. The values for the focusbehavior parameter are:
FT_SETVALUE
Triggers the SetValue event for current field
FT_TAKEFOCUS
Triggers the SetValue and Exit events for current field
FT_NOSETVALUE
Specifies no forced processing
Default: FT_NOSETVALUE
Note: Setting the focusbehavior parameter to FT_SETVALUE or FT_TAKEFOCUS can cause the receiving frame to discard the user event that you sent. This happens when the SetValue or Exit event block for the current field in the receiving frame executes a resume statement. (For more information about the resume statement, see the Language Reference Guide). The user event is also discarded if a data type conversion error occurs when OpenROAD attempts to execute the SetValue event.
The following example uses the focusbehavior parameter to trigger the SetValue event in its child frames before they close:
vlist[i].details_frame.SendUserEvent(eventname=
'Cleanup',focusbehavior = FT_SETVALUE);