Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I make this work?
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00529408
Message ID:
00529414
Views:
13
Mark,
The problem is that VFP doesn't do anything with respect to AutoSize until the form is shown. You can do your own calculations using a combination of FontMetric() and TxtWidth(). See Thread #455959 Message #455966 for a formula for this.

HTH.

>Before I show a form class, I am doing some positioning of the controls because of translations for multiple languages for the labels. How do I force VFP to recalculate the width of the labels after I programmatically change their captions? The following does not work.
>debugout This.lblPassword1.Width
>This.lblPassword1.Caption = This.Translate(This.lblPassword1.Caption)
>This.lblPassword2.Caption = This.Translate(This.lblPassword2.Caption)
>debugout This.lblPassword1.Width
>with This
>	lnMaxWidth = .lblPassword1.Width
>	if .lblPassword2.Visible
>		lnMaxWidth = max(lnMaxWidth, .lblPassword2.Width)
>	endif
>	.cboEmpID.Left     = .lblEmpNum.Left + .lblEmpNum.Width + 5
>	.txtPassword1.Left = .lblPassword1.Left + lnMaxWidth + 5
>	.txtPassword2.Left = .txtPassword1.Left
>	.AutoCenter = .t.
>endwith
>debugout This.lblPassword1.Width
>In all cases the DEBUGOUT returns the same value [63]. After the form shows, the actual width of the label is 74. I have also tried issuing an AutoSize on each of the labels. All fail. This is most annoying.
>
>TIA!
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform