Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form keypress Conundrum
Message
De
11/01/2006 11:26:21
 
 
À
11/01/2006 10:53:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01085658
Message ID:
01085677
Vues:
29
Tracy

How about simplifying it and saving on VFP having to do a lot of seaching through its object hierarchy with each case? Clutching at straws here but you never know, and your code will be a lot more readible. e.g.

>Keypress event:
LPARAMETERS nKeyCode, nShiftAltCtrl

With THISFORM.PageFrame
DO CASE
CASE nKeyCode = 18 .and. nShiftAltCtrl = 0  && Page Up
	IF .ActivePage > 1
		.ActivePage = .ActivePage - 1
	ELSE
		.ActivePage = .PageCount
	ENDIF
	DO CASE
		CASE .ActivePage = 1
			.Page1.txtMap_csr.setfocus()
		CASE .ActivePage = 2
			.Page2.txtYn_split.setfocus()
		CASE .ActivePage = 3
			.Page3.txtAdr_name1.setfocus()
		CASE .ActivePage = 4
			.Page4.txtLp_chg.setfocus()
		CASE .ActivePage = 5
			.Page5.txtMendo_q1.setfocus()
		CASE .ActivePage = 6
			.Page6.txtMendo_q81.setfocus()
	ENDCASE
CASE nKeyCode = 3  .and. nShiftAltCtrl = 0   && Page Down
	IF .ActivePage < .PageCount
		.ActivePage = .ActivePage + 1
	ELSE
		.ActivePage = 1
	ENDIF
	DO CASE
		CASE .ActivePage = 1
			.Page1.txtMap_csr.setfocus()
		CASE .ActivePage = 2
			.Page2.txtYn_split.setfocus()
		CASE .ActivePage = 3
			.Page3.txtAdr_name1.setfocus()
		CASE .ActivePage = 4
			.Page4.txtLp_chg.setfocus()
		CASE .ActivePage = 5
			.Page5.txtMendo_q1.setfocus()
		CASE .ActivePage = 6
			.Page6.txtMendo_q81.setfocus()
	ENDCASE
OTHERWISE
	DODEFAULT()
ENDCASE
EndWith
Who knows?

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform