I'm playing around with a grid on a form, with the idea that the grid and maybe the form may be incorporated in my first attempt at creating a class. At least some of what I learn will help me when creating my grid class. Here's some code I stuck in the grid's BeforeRowColChange event:
LPARAMETERS nColIndex
IF THIS.Columns(nColIndex).CurrentControl.Value ;
!= OLDVAL( THIS.Columns(nColIndex).ControlSource )
WITH THISFORM
.cmdSave.Enabled = .T.
.cmdClose.Cancel = .F.
.cmdCancel.Enabled = .T.
.cmdCancel.Cancel = .T.
ENDWITH
ENDIF
I'm trying to enable Save/Cancel buttons on my form, and switch the "Cancel" action from the form's Close button to the form's Cancel button, if the user makes a change in any value in the grid.
Outside of telling me I should really be doing this in the valid events of the textboxes contained in the columns or something, can someone tell me how you reference the control in a column from an event in the grid? THIS.Columns(nColIndex).CurrentControl.Value is not it, I've discovered. (I've also tried a few other things.)
TIA,
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing