Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anchor & Adding controls at runtime
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Anchor & Adding controls at runtime
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01036333
Message ID:
01036333
Views:
53
I have a control I add to a pageframe when the user clicks on that page. I do not know the size of the pageframe because the Anchor property will resize the pageframe. So I add the control and set the height/width based on the pageframe's height/width. This works until the form is resized at which point the control snaps back to its original size and then resizes from there.

Is there a different technique I should be using to add the control and get sized correctly?
PUBLIC x
x = CREATEOBJECT("form")
x.ADDOBJECT("pf1","myPageFrame")
x.pf1.Visible = .T.
x.Show()

DEFINE CLASS myPageFrame AS PageFrame
   MemberClassLibrary = 'myPages.PRG'
   MemberClass = 'myPage'
   ANCHOR = 240
   PageCount = 1
   TOP = 10
   LEFT = 10
   HEIGHT = 200
   WIDTH = 250
ENDDEFINE

DEFINE CLASS myPage AS Page
   
   PROCEDURE CLICK
      this.AddObject("cn","container")
		this.cn.anchor = 240
		this.cn.height = this.Parent.Height-30
		this.cn.width = this.Parent.width -10 
		this.cn.visible = .T.
   ENDPROC
ENDDEFINE
Next
Reply
Map
View

Click here to load this message in the networking platform