CommitFocused

Description: This function causes any edit field, while being edited, to output the value currently found in that field.
Usage: Script Only.
Related to: NextFocusID
Format: CommitFocused(contextToCommit);
Parameters:  
contextToCommit
Required. The object that contains the edit control to commit, or it's caller within the same window.
Comments:

This function causes any edit field that the user is currently editing to output what the user has written prior to the function call. Here, "edit fields", includes those created by \Sytem.Edit, WinEditCtrl, or an editable System.DropList or WinComboCtrl.

This call will cause that control's trigger value to transition to 2 as if the control has lost the focus, but does not actually cause the control to lose the focus.

An edit field will automatically output its changes when the user changes focus away from the edit field, therefore this function is not necessary most of the time. It becomes useful if you want to commit what the user has typed without the field necessarily losing focus, for example if when the user clicks something that does not take the focus, as is the case with many controls within the context of the VTScada Internet Client (VIC). If your UI has a focusable button that the user must click after making changes, then there is no need to call CommitFocused.

CommitFocused will only have an effect on a focused graphic if it is within the call tree under the object identified by the sole required parameter. That object must be the one that contains the WinEditCtrl function, or it must be that object's caller, or its caller's caller, etc....

Example:

Illustrates that you must wait for triggers to resolve after calling CommitFocused:

 { Automatically close dialog after 5 minutes, committing what the user has done so far. }
  If TimeOut(1, 60 * 5);
  [
    CommitFocused(Self());
    ForceCloseWindow = TRUE;
  ]

  If (WindowClose(Self()) || ForceCloseWindow) && PickValid(Trigger, 1);
  [
    ForceCloseWindow = FALSE;
    ShowWindow = FALSE;
  ]