Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
why does it not recognize the baseclass for [commandbutton]? It does not seem to want to pick up on a button and when I try to add it as a baseclass I get errors when I run it.
I was wondering if there is anything internal in VFP that keeps track of the last object that had focus (kind of like the way lastkey works for the last key pressed on the keyboard), or would I have to store it in memory or a table each time I leave an object? What is the most efficient way to get this value?
Add a method called SetupSontrols() to your form and call it from the form's init(). This code in SetupCpntrols():
LPARAMETERS toObject
LOCAL loObject
*** If we have a container, drill down
IF INLIST( LOWER( ALLTRIM( toObject.BaseClass ) ), ;
[form], [pageframe], [page], [container], [grid], [column] )
FOR EACH loObject IN toObject.Objects
Thisform.SetupControls( loObject )
ENDFOR
ELSE
*** Use BindEvent to setup the Form's SetActiveControl()
*** method as the delegate for the Control's GotFocus()
IF PEMSTATUS( toObject, [ControlSource], 5 ) AND ;
PEMSTATUS( toObject, [GotFocus], 5 )
BINDEVENT( toObject, [GotFocus], Thisform, [SetActiveControl], 1 )
ENDIF
ENDIF
Add a method to the form called SetActiveControl() to your form and add this code to the method:
LOCAL laControls[ 1 ]
*** Get a Reference to the control
*** that delegated its GotFocus to this method
AEVENTS( laControls, 0 )
WITH Thisform
.oActiveControl = laControls[ 1 ]
*** Do whatever you need to do with the active control
ENDWITH
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement