Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to setfocus back to previous text box
Message
De
18/10/2004 16:48:08
 
 
À
18/10/2004 02:57:53
Hee Lim Wang
Fantasy Software Enterprise
Malaisie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00952191
Message ID:
00952445
Vues:
9
Here is an example. To test, create a form called 'testform.' Put a commandbutton on it and put something in the when of it.
MODIFY FORM testform NOWAIT

ASELOBJ(laForm, 1)
loForm = laForm(1)
IF TYPE('loform.pageframe')<>"U"
	FOR EACH loPage IN loForm.PAGEFRAME.PAGES
		lcnewname = ''
		lctest    = ''
		FOR EACH oControl IN loPage.CONTROLS
			IF UPPER(LEFT(oControl.NAME,3))="CMD" .OR. ALLTRIM(UPPER(oControl.BASECLASS)) = "COMMANDBUTTON"
				oControl.HEIGHT = 25
				oControl.WIDTH = 64
				lc_value = oControl.REadMethod('When')
				oControl.WriteMethod('When',lc_value+CHR(13)+"if not isnull(thisform.oLastActiveControl)"+CHR(13);
				   +"     thisform.oLastActiveControl.SetFocus()"+CHR(13);
				   +"endif"+CHR(13))
			ENDIF
		ENDFOR
	ENDFOR
ELSE	&& no pageframe all controls are on the single page
	FOR EACH oControl IN loForm.CONTROLS
		IF UPPER(LEFT(oControl.NAME,3))="CMD" .OR. ALLTRIM(UPPER(oControl.BASECLASS)) = "COMMANDBUTTON"
			oControl.HEIGHT = 25
			oControl.WIDTH = 64
			lc_value = oControl.REadMethod('When')
			oControl.WriteMethod('When',lc_value+CHR(13)+"if not isnull(thisform.oLastActiveControl)"+CHR(13);
				   +"     thisform.oLastActiveControl.SetFocus()"+CHR(13);
				   +"endif"+CHR(13))
		ENDIF
	ENDFOR
ENDIF

RETURN
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform