Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pageframe Resize or Page Switch Resets ADDOBJECT() Contr
Message
 
 
À
11/12/2007 05:37:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01274717
Message ID:
01274723
Vues:
11
>I am making use of a pageframe made up of several pages. At run time, a container is added to Page 1 (using ADDOBJECT()), the container class is dependent on a variable property of the pageframe class.
>
>Once added I set the Top, Left, Height and Width to the relevant dimensions for the potentially resized pageframe, before setting Anchor to 15 and making the new control visible.
>
>The moment I resize the pageframe's parent form OR switch to another page and back again, the new control resets to its original position (0,0) and dimensions.
>
>
>*-- This code is a sample from a custom method within my pageframe
>*-- lcHeader, lcSubHeader and lcDetailsKey are set above this point
>
>WITH THIS.Page1
>	.bnr_Details.lbl_Header.Caption = lcHeader
>	.bnr_Details.lbl_SubHeader.Caption = lcSubHeader
>	
>	*-- Remove original object if present
>	IF TYPE("THIS.Page1.oDetails") = "O"
>		.RemoveObject("oDetails")
>	ENDIF
>	
>	*-- Add New Object and set DiaryEntryID
>	.AddObject("oDetails", "Container_Task_"+ALLTRIM(lcDetailsKey))
>	.oDetails.DiaryEntryID 		= THIS.DiaryEntryID
>	.oDetails.DiaryTaskID	 	= THIS.DiaryTaskID
>	.oDetails.Prepare()
>	.oDetails.Anchor 			= 0
>	.oDetails.Left 				= 0
>	.oDetails.Top 				= 103
>	.oDetails.Height 			= THIS.PageHeight - 103
>	.oDetails.Width 			= THIS.PageWidth - 1
>	.oDetails.Anchor 			= 15
>	.oDetails.Visible 			= .T.
>ENDWITH
>
>
>I've tried a number of work-arounds, including having a static container within the page that handles the adding of the variable container. I'm about to install sp2 but was wondering if anyone else has encountered this problem?
>
>Many thanks for any help or advice anyone can provide.
>
>Ben
>
>Update: I should have mentioned previously, the static container work-around does seem to get around the problem. Instead of the page's ADDOBJECT() being executed, the static container's ADDOBJECT() is used; this may seem convoluted but it does seem to get around the problem.

I'm not sure why do you remove the object? We use similar methodology, in page Activate method we add a container if it's not there using NEWOBJECT method. But once added, this container remains added.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform