Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataEntry form - it's a nightmare
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
DataEntry form - it's a nightmare
Miscellaneous
Thread ID:
00666126
Message ID:
00666126
Views:
46
Hi everybody,

I have a DataEntry form, which has a pageframe with 4 pages. Depending on the Source (txtSource on the form) I activate the correct page.

Now, suppose I choose C as a Source and BP (Building permits) as a Credit Type. Credit page is activated and I type all info. Here is BuildCreditPage form method code
********************************************************************
*  Description.......: BuildCreditPage
*  Calling Samples...:
*  Parameter List....:
*  Created by........: Nadya Nosonovsky 06/06/2002 04:01:36 PM
*  Modified by.......:
********************************************************************
if not used('formPos')
	use (m.dir_data+'formPos') in 0 shared
endif

with thisform.Refreshpf1
	.Page3.enabled = .t.
&& Made all controls invisible
	.Page3.setall('visible',.f.)
endwith

local lcMType, lcFld_Name, loControl, lnCnt, lblName
lcMType = BldMstr.MiscType

*--------------------------------------------------------------------------
* -- updated:rmm:12/13/01
* --	display the misc type for the user
*--------------------------------------------------------------------------
select MiscType
locate for BldMstr.MiscType = MiscType.code

with thisform.Refreshpf1.Page3.MisctypeLabel
	.caption = MiscType.fullname
	.visible = .t.
endwith

*--------------------------------------------------------------------------
* -- updated:rmm:12/06/01
* --	update the SELLNAME field appropriately
*--------------------------------------------------------------------------
select BldMstr
replace BldMstr.sellname with iif(thisform.txtMiscType.value='C','N','Y')

select * ;
	from FormPos ;
	order by tabord, left, top ;
	where code = m.lcMType ;
	and type = 'LBL' ;
	into cursor mTemp nofilter

if _tally = 0
*DO alert WITH "Please select a valid 'Credit Record Type' "
	use in mTemp
	return
endif

*--------------------------------------------------------------------------
* -- labels
*--------------------------------------------------------------------------
select mTemp
scan
	lcFld_Name = alltrim(mTemp.fld_name)
	loControl=evaluate('thisform.Refreshpf1.Page3.'+ m.lcFld_Name)

	with loControl
		.forecolor= rgb(0,0,160) 	&& updated:rmm:12/03/01
		.fontbold = .t. 			&& updated:rmm:12/03/01
		.autosize = .t.				&& updated:rmm:12/03/01
		.caption = alltrim(mTemp.cap)
		.left = mTemp.left
		.top = mTemp.top
		.width = 138
		.visible = .t. && Label
	endwith
endscan

*--------------------------------------------------------------------------
* -- Updated rmm  09/06/00
* -- display the text/edit fields
*--------------------------------------------------------------------------
select * ;
	from FormPos ;
	order by tabord, left, top ;
	where code = m.lcMType;
	and type = 'TXT' ;
	into cursor mTemp nofilter

lnCnt = 1

thisform.CreditFld = 'thisform.Refreshpf1.Page3.'+ alltrim(mTemp.fld_name) && First record

scan
	lcFld_Name = alltrim(mTemp.fld_name)
	loControl=evaluate('thisform.Refreshpf1.Page3.'+ m.lcFld_Name)

	with loControl

		if mTemp.fld_WIDTH <> 0
			.width = mTemp.fld_WIDTH
		endif

		.left = mTemp.left
		.top = mTemp.top
		.tabindex = mTemp.tabord && Set TabIndex
		.visible = .t. && Make textbox visible

		if m.lcFld_Name = 'TXTdocketref' ;
				and thisform.LocState='CT' and m.lcMType <>'BP'
			.enabled = .f.
		else
			if m.lcFld_Name = 'TXTdocketref'
				.enabled = thisform.EditMode
			endif
		endif

*:REV 12/28/01 SBB Disable for state = MA && ?????
		if m.lcMType = 'LA' and thisform.LocState='MA' and ;
				inlist(m.lcFld_Name,'TXTtaxType1','TXTtaxType2')
			.enabled = .f.
		else
			if inlist(m.lcFld_Name,'TXTtaxType1','TXTtaxType2')
				.enabled = thisform.EditMode
			endif
		endif
	endwith
*--------------------------------------------------------------------------
* -- Updated:rmm:04/05/01
* --	Put a '*' next to the field that are considered mandatory
*--------------------------------------------------------------------------
	if mTemp.Mandatory
		lblName = 'lbla'+alltrim(str(m.lnCnt,2))
		loControl = evaluate('thisform.Refreshpf1.Page3.'+ m.lblName)
		with loControl
			.caption = '*'
			.autosize = .t.
			.forecolor = rgb(255,0,0)
			.height = 17
			.width = 7
			.left = mTemp.left - 8
			.top = mTemp.top
*:Disable some labels that require hard coding here - OR condition added 12/28/01 SBB
			if (m.lcFld_Name = 'TXTdocketref' and ;
					thisform.LocState='CT' and m.lcMType<>'BP') or ;
					(m.lcMType = 'LA' and thisform.LocState='MA' and ;
					inlist(m.lcFld_Name,'TXTtaxType1','TXTtaxType2'))
				.visible = .f.
			else
				.visible = .t.
			endif
		endwith
		lnCnt = m.lnCnt+1
	endif Mandatory
endscan

*--------------------------------------------------------------------------
* -- Updated rmm  - clean up
*--------------------------------------------------------------------------
use in mTemp
select BldMstr
So, the first time everything is fine, I navigate from control to control using Tab. I save the transaction by pressing F9, and type the same C and BP.

The first object is activated correctly, but when I press TAB, I go to the last textbox, I finished my typing, not the second textbox. Why is that?

May be in FNine function I have to explicitly set focus to cmdSave to avoid this weird and annoying problem?
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform