Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pageframe Resize or Page Switch Resets ADDOBJECT() Controls
Message
From
11/12/2007 05:37:51
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Pageframe Resize or Page Switch Resets ADDOBJECT() Controls
Miscellaneous
Thread ID:
01274717
Message ID:
01274717
Views:
71
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.
Ben Sugden

"Remember to enjoy hunting - and that means relishing the search for the product that has never been advertised or placed handily at the front of the shop; Life begins on the uppermost shelf, avoid guide books and top 10's like the plague." - Ramsey Dukes
Next
Reply
Map
View

Click here to load this message in the networking platform