* frmGridTest.grdInqPost.BeforeRowColChange >>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.
LPARAMETERS nColIndex llChangingRow = .f. with this if lastkey() = 145 && Adding new rec .nLastValidRec = .nCurrec endif thisform.LockScreen = .lInGrid if mdown() lnBottom = .top+.headerheight+.relativerow * .rowheight lnTop = lnBottom - this.rowheight lnMouseRowPos = mrow(wontop(),3) lnMouseColPos = mcol(wontop(),3) llChangingRow = !(between(lnMouseRowPos,lnTop, lnBottom) ; and between(lnMouseColPos,.left,.left+.width)) else llChangingRow = inlist(lastkey(),24,5,18,3,145,148) endif if llChangingRow if !empty(.columns(nColIndex).dynamiccurrentcontrol) cCurrentControl = eval(.columns(nColIndex).dynamiccurrentcontrol) else cCurrentControl = .columns(nColIndex).currentcontrol endif with evaluate(".columns(nColIndex)."+cCurrentcontrol) .value = .value && So we can evaluate table ruleexpression endwith if !empty(dbgetprop(.recordsource,"Table","RuleExpression")) ; and !evaluate(dbgetprop(.recordsource,"Table","RuleExpression")) thisform.LockScreen = .F. wait window nowait .cWarning nodefault endif endif endwithCetin