Hi!
Set _VFP.AutoYield to .T. for this code fragment, or use DOEVENTS command before getting the width of the label. When VFP do not process events, label will not be auto-resized until VFP gets a chanse to process events (either waiting state for input, DOEVENTS command or _VFP.AutoYield=.T. to process only certain events between code lines). DOEVENTS in VFP6 have a bug that cause application delay for 0.3 seconds, in VFP7 this bug is fixed.
HTH.
>Hi
>
>I am trying to add a Label to _SCREEN and then centering it, but when I go to center the Label, it's width is incorrect.
>
>ie
>
>
>_Screen.NewObject("lblTitle", "Label")
>
>WITH _Screen.lblTitle
> .Caption = "Application Title Here"
> .FontSize = 16
> .AutoSize = .T.
> .Left = (_Screen.Width / 2) - (.Width / 2)
> .Height = (_Screen.Height / 2) - (.Height / 2)
> .Visible = .T.
>ENDWITH
>
>
>When I get to the
.Left
part of the program, the width is incorrect on the Label, it seems that only when it's made visible it will change.
>
>Is there a way around it - by the way this happens on every label, not just labels on the _Screen.
>
>Any ideas?
>Thanks
>Kev
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.