Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form keypress Conundrum
Message
From
11/01/2006 11:26:21
 
 
To
11/01/2006 10:53:53
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01085658
Message ID:
01085677
Views:
30
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform