Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving changes from a textbox without exiting
Message
 
To
24/01/2001 12:12:59
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00467981
Message ID:
00467991
Views:
14
>I have a form with a toolbar. On the toolbar I have a save button. Normally a user will add or edit the data on the form and click save on the toolbar, and everything works...
>
>However, I have on particular user that wants to change the data in one textbox, and then click save. This does not work, the user needs to change the data and then hit TAB or ENTER then click save.
>
>Putting the SAVE button on the form allows this behavior, but I want to keep the SAVE button on the toolbar...
>
>Is there a way to get this to work with the SAVE button on the toolbar?
>
>Thanx,
>
>Mike


I have a writebuffer method for that:
LOCAL llRetval
llRetVal = .T.

*-- Code to save field value to buffer when
*-- clicking on toolbar without leaving the field
*-- Don't do this for a grid since a grid may change
*-- work areas unexpectedly
IF TYPE("thisform.ActiveControl") == "O" AND ;
    UPPER(thisform.ActiveControl.BaseClass) <> "GRID"
  IF TYPE("thisform.ActiveControl.ControlSource") <> "U" AND ;
      !EMPTY(thisform.ActiveControl.ControlSource)
    IF EVAL(thisform.ActiveControl.ControlSource) <> thisform.ActiveControl.Value
      REPLACE (thisform.ActiveControl.ControlSource) WITH thisform.ActiveControl.Value
      *-- We rely on the fact that we revert the field's value
      *-- in the error event method for the form. 
      llRetVal = (EVAL(thisform.ActiveControl.ControlSource) = thisform.ActiveControl.Value)
    ENDIF
  ENDIF
ENDIF

RETURN llRetVal
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform