Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Activating a page
Message
De
18/02/2016 00:17:35
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01631622
Message ID:
01631641
Vues:
151
>Hi everybody,
>
>I forgot how to activate a page programmaticaly. I added a new page to the pageframe of 5 pages. I set that page Enabled = false and PageOrder = 2 in design time. The caption of that page is rather long and doesn't fit, so just in case I added the tooltiptext with the same info as a caption.
>
>I added the following code to the drop down InteractiveChange event on the first 'General' page:
>
>
>this.Parent.spnQuantity.visible = (this.Value = 0)
>this.Parent.Parent.pgfFixedQtyPerMembership.Enabled = this.Value = 8
>IF this.Value = 8
>   this.Parent.Parent.ActivePage = this.Parent.Parent.pgfFixedQtyPerMembership.PageOrder
>endif
>
>So, when I select a particular value in drop down I want to activate that page and make it enabled.
>
>I found offending code in first page activate that caused that behavior.


Hi Naomi,

your concept to assign desiredPage,PageOrder to pageFrame.ActivePage looks perfectly valid to me, and the following sample seems to work as expected here.
How does yours not?
PUBLIC oForm as Form
oForm = CREATEOBJECT('TestForm')
oForm.Show(2)
RETURN

DEFINE CLASS TestForm as Form
	AutoCenter = .T.

	ADD OBJECT pgfTest as PageFrame WITH ;
		Anchor = 15, PageCount = 5, Top = 50

	PROCEDURE Init
		LOCAL lnButton, lcButton, loButton
		FOR lnButton = 1 TO This.pgfTest.PageCount
			lcButton = 'Button' + TRANSFORM(m.lnButton)
			This.AddObject(m.lcButton, 'myButton')
			loButton = GETPEM(Thisform,m.lcButton)
			WITH loButton as CommandButton
				.Move(55*m.lnButton,5,50,24)
				.Visible = .T.
			ENDWITH
		ENDFOR

		WITH This.pgfTest
			.Page5.PageOrder = 1
			.Page1.PageOrder = 2
			.Page4.PageOrder = 3
			.Page2.PageOrder = 4
			.Page2.Enabled = .F.
		ENDWITH
	ENDPROC
ENDDEFINE

DEFINE CLASS myButton as CommandButton
	PROCEDURE Click
		LOCAL lcPage, loPage as Page
		lcPage = STRTRAN(This.Name,'Button','Page')
		loPage = GETPEM(Thisform.pgfTest,m.lcPage)
		IF m.loPage.Enabled = .F.
			m.loPage.Enabled = .T.
		ENDIF
		Thisform.pgfTest.ActivePage = m.loPage.PageOrder
	ENDPROC
ENDDEFINE
hth
-Stefan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform