Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Problem
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Miscellaneous
Thread ID:
00697256
Message ID:
00697423
Views:
15
Hi Mike.

I have a grid with 2 editable columns. If the user is in the last column (editing) and clicks on save, the user will not save the value he entered. If the user tabs; presses enter, etc. it will save.

Any ideas on how to make sure the value is recorded?


I take it that the save button is in a toolbar. The issue here is that toolbars do not get focus. Hence, the valid of the active control on a form does not fire when you click on a toolbar button. The field in the controlSource is updated from the control's value when the valid fires.

So, in order to make sure this happens for your active control (this is not just a problem for grids < s > ), you need some code like this being called by the save button:
LOCAL loColumn, loActiveControl, loControl

IF TYPE( '_Screen.ActiveForm.ActiveControl.Name' ) = 'C'
  loActiveControl = _Screen.Activeform.ActiveControl
  IF UPPER( loActiveControl.BaseClass ) # 'GRID'
    loActiveControl.SetFocus()
  ELSE
    FOR EACH loColumn IN loActiveControl.Columns
      IF loActiveControl.ActiveColumn = loColumn.ColumnOrder
        loControl = EVAL( 'loColumn.'+ loColumn.CurrentControl )
        loControl.SetFocus()
        EXIT
      ENDIF
    ENDFOR
  ENDIF			
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform