Article ID: 156035
Article Last Modified on 12/1/2003
137963 PRB: Disabled Grid Controls Can Be Selected with Mouse
* Start of sample program
PUBLIC oForm
oForm=CREATEOBJECT('form1')
oForm.SHOW
oForm.grid1.column1.ADDOBJECT('text2','txtTextbox')
oForm.grid1.column1.CURRENTCONTROL='text2'
oForm.grid1.column1.text2.VISIBLE=.T.
DEFINE CLASS form1 AS FORM
ADD OBJECT grid1 AS GRID WITH ;
COLUMNCOUNT = 2, ;
NAME = "Grid1"
ADD OBJECT command1 AS COMMANDBUTTON WITH ;
CAPTION = "\<Test", ;
HEIGHT=25, ;
TOP=205, ;
NAME = "Command1"
PROCEDURE LOAD
CREATE CURSOR test ( ctest c(10), ctest2 c(10) )
INSERT INTO test ( ctest) VALUES ( " ")
INSERT INTO test ( ctest) VALUES ( " ")
GO TOP
ENDPROC
PROCEDURE command1.VALID
WAIT WINDOW "Command button valid called" TIMEOUT 1
ENDPROC
ENDDEFINE
DEFINE CLASS txttextbox AS TEXTBOX
PROCEDURE WHEN()
RETURN RECNO()=1 && Returns .F. if not on first record
ENDPROC
ENDDEFINE
* End of sample program
DEFINE CLASS txtTextbox AS TEXTBOX
PROCEDURE GOTFOCUS()
IF RECNO()!=1 && Check for condition that was checked
&& in When()
KEYBOARD '{tab}'
ENDIF
ENDPROC
ENDDEFINE
PROCEDURE KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
* Check to see if the ActiveControl is a Grid and that the
* ALT key was not pressed. If both of these are true, NODEFAULT
* will discard the keystroke. If the ALT key was pressed, you do
* want to use the keystroke to actuate any applicable hot-keyed
* control on the form.
IF this.ActiveControl.BaseClass = 'Grid' and nShiftAltCtrl != 4
NODEFAULT
ENDIF
ENDPROC
Additional query words: kbdse VFoxWin
Keywords: KB156035