Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to hide pageframe page such as checkbox click code
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01107214
Message ID:
01107462
Views:
15
Hey Soykan,

If you did not change the page order (or maybe even if you changed it, not sure, did not test it), you can simulate this using 2 pageframes, one with 4 pages and the other with 3, and then some code, for example:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	*-- XML Metadata for customizable properties
	_memberdata = ""
	Name = "Form1"


	ADD OBJECT pgffour AS pageframe WITH ;
		ErasePage = .T., ;
		PageCount = 4, ;
		Top = 53, ;
		Left = 5, ;
		Width = 361, ;
		Height = 169, ;
		Visible = .F., ;
		Name = "pgfFour", ;
		Page1.Caption = "Page1", ;
		Page1.Name = "Page1", ;
		Page2.Caption = "Page2", ;
		Page2.Name = "Page2", ;
		Page3.Caption = "Page3", ;
		Page3.Name = "Page3", ;
		Page4.Caption = "Page4", ;
		Page4.Name = "Page4"


	ADD OBJECT pgfonetothree AS pageframe WITH ;
		ErasePage = .T., ;
		PageCount = 3, ;
		Top = 53, ;
		Left = 5, ;
		Width = 361, ;
		Height = 169, ;
		Name = "pgfOneToThree", ;
		Page1.Caption = "Page1", ;
		Page1.Name = "Page1", ;
		Page2.Caption = "Page2", ;
		Page2.Name = "Page2", ;
		Page3.Caption = "Page3", ;
		Page3.Name = "Page3"

	ADD OBJECT check1 AS checkbox WITH ;
		Top = 16, ;
		Left = 15, ;
		Height = 17, ;
		Width = 91, ;
		AutoSize = .T., ;
		Alignment = 0, ;
		Caption = "Show Page 4", ;
		Value = .F., ;
		Name = "Check1"


	PROCEDURE hidepage4
		lparameters tnPage

		thisform.pgfFour.visible = .f.
		thisform.pgfOneToThree.ActivePage = tnPage
		thisform.pgfOneToThree.Visible = .t.
		thisform.check1.Value = .f.
	ENDPROC


	PROCEDURE showpage4
		thisform.pgfFour.ActivePage = 4
		thisform.pgfFour.Visible = .t.
		thisform.pgfOneToThree.Visible = .f.
		thisform.check1.Value = .t.
	ENDPROC


	PROCEDURE pgffour.Page1.Activate
		thisform.HidePage4(1)
	ENDPROC


	PROCEDURE pgffour.Page2.Activate
		thisform.HidePage4(2)
	ENDPROC


	PROCEDURE pgffour.Page3.Activate
		thisform.HidePage4(3)
	ENDPROC


	PROCEDURE pgffour.Page4.Activate
		this.Refresh()
	ENDPROC


	PROCEDURE check1.InteractiveChange
		if this.Value
			thisform.ShowPage4()
		else
			thisform.HidePage4(thisform.pgfOneToThree.ActivePage)
		endif
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform