Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Serious BUG: in Pageframe you can bypass valid()
Message
From
15/05/2004 05:29:09
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Serious BUG: in Pageframe you can bypass valid()
Miscellaneous
Thread ID:
00904291
Message ID:
00904291
Views:
52
If you use a
- CTRL+TAB or CTRL+SHIFT+TAB
- set into ActivePage a new pageActiveOrder value

you can bypass the Valid() and LostFocus() of the current activeControl on the current ActivePage.

Repro:
RUN
- you can see the situation with Click or with CTRL+TAB or CTRL+SHIFT+TAB or LEFTARROW ...
- go into the Page1 Input TextBox
- click on Page2, Valid is fired and stop the process
- Press CTRL+TAB or CTRL+SHIFT+TAB :
Valid and LostFocus they are not fired,
and you can go into another control without validate the input

and now you can move where you want.

If you insert/change characters on input textbox
the new value is NOT saved the first time, but if you swap on pages,
the not lostfocus event on Input textbox it has left of the traces within VFP,
and the Valid it is fired when you are returned on the Page1;
you can see this because you have the focus on page1 and on Textbox at the same time.

Now you have saved a invalid value and you can go anywhere.

DblClick on Input TextBox for to see the same violation with ActivePage.
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	Caption = "Bug when CTRL+TAB or CTRL+SHIFT+TAB"

	ADD OBJECT pageframe1 AS pageframe WITH ;
		ErasePage = .F., ;
		PageCount = 2, ;
		Top = 30, ;
		Left = 29, ;
		Page1.Caption = "input", ;
		Page2.Caption = "show"

	PROCEDURE pageframe1.Init
		this.Page1.AddObject('text1','myText')
		WITH this.Page1.text1
			.Move(30,20)
			.ControlSource = "M.vStoreInput"
			.Visible = .T.
		ENDWITH
		this.Page2.AddObject('text2','TextBox')
		WITH this.Page2.text2
			.Move(40,30)
			.ControlSource = "M.vStoreInput"
			.Visible = .T.
		ENDWITH
	ENDPROC
	
	PROCEDURE pageframe1.Page1.DblClick
		this.Parent.ActivePage = 2
	ENDPROC
	
	PROCEDURE pageframe1.Page2.Activate
		this.text2.Refresh
	ENDPROC
	
	PROCEDURE Load
		PUBLIC vStoreInpuT
		vStoreInput = 'XY'	&& init with a invalid value
	ENDPROC
	
	PROCEDURE UnLoad
		RELEASE vStoreInput
	ENDPROC
	
ENDDEFINE

DEFINE CLASS myText AS TextBox
	
	PROCEDURE Valid
		IF thisform.ReleaseType>0	&& FOR REMOVE YOUR STRESS
			RETURN
		ENDIF
		WAIT WINDOW "Validation" NOWAIT TIMEOUT 5
		RETURN LIKE('@*',m.vStoreInpuT) 	&& a validation rule
	ENDPROC

	PROCEDURE DblClick
		this.Parent.Parent.ActivePage = 2  && <== this do the same violation 
	ENDPROC
	
ENDDEFINE
workArounds:
- for CTRL+..+TAB you must capture the keypressed and to control the situation with an opportune code
- for ActivePage you must use a SetFocus before to set the value into the ActivePage property.

Fabio
Reply
Map
View

Click here to load this message in the networking platform