Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Label.AutoSize
Message
From
16/04/2008 14:05:00
 
 
To
16/04/2008 13:58:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01310962
Message ID:
01311241
Views:
32
>Well, sorry then. It was just an idea - Thought you said it did not work in the debugger. That has all the likes of autosize = FALSE
>
>One last - and I may be wrong, it may have no effect on it - Is form.LockScreen = FALSE ?
>_

Another good thought.......
I had tried playing with LockScreen but it had no effect. It's not changed anywhere in the code anymore.






>>>Stupid question ... You're sure that This.label1.AutoSize = TRUE ?
>>
>>I've heard many times that there is no such thing as a stupid question!!!! That's a patently silly statement as an absolute, but in this case it isn't silly at all. I can't count the number of tech support calls in the early days of PC that were simply "It wasn't plugged in" or "Forgot to turn on the power strip."
>>
>>In this case, however, I've triple checked and AutoSize really is TRUE.
>>
>>
>>>_
>>>>A good thought.......Unfortunately, neither DOEVENTS nor INKEY() change the behavior. Setting the caption on the label does not seem to reset the width.
>>>>
>>>>
>>>>>Rich,
>>>>>
>>>>>I think vfp only updates the width when it's not busy
>>>>>
>>>>>
>>>>>>lcOldCaption = This.label1.caption ---> "Action Text"
>>>>>>lnOldWidth = This.label1.Width -------> 57
>>>>>>This.label1.Caption = tcCaption ------> "Update Chassis Information"
>>>>>
>>>>>=INKEY(.0001)  && may help, or a doevents
>>>>>
>>>>>>lnNewWidth = This.label1.Width -------> 57 ??????????
>>>>>>This.Width = This.Width + (lnNewWidth  - lnOldWidth)
>>>>>
>>>>>
>>>>>______________________
>>>>>>I tried this and got the same result, even with the debugger turned on. Maybe my basic understanding is flawed.
>>>>>>
>>>>>>My assumption was that if the textbox AutoSize is set to .T. then the textbox will resize whenever the caption changes. If this is not correct, then is there something else I must do (beside try to calculate the width of the control manually) to reset the width? Right now, when I run through the debugger I see
>>>>>>* Method SetCaption
>>>>>>LPARAMETERS tcCaption
>>>>>>lcOldCaption = This.label1.caption ---> "Action Text"
>>>>>>lnOldWidth = This.label1.Width -------> 57
>>>>>>This.label1.Caption = tcCaption ------> "Update Chassis Information"
>>>>>>lnNewWidth = This.label1.Width -------> 57 ??????????
>>>>>>This.Width = This.Width + (lnNewWidth  - lnOldWidth)
>>>>>>
>>>>>>
>>>>>>Once again, all help greatly appreciated
>>>>>>
>>>>>>>Rich,
>>>>>>>
>>>>>>>Create method SetCaption for container class and use it instead of settting label caption directly
>>>>>>>
>>>>>>>* Method SetCaption
>>>>>>>LPARAMETERS tcCaption
>>>>>>>lnOldWidth = This.label1.Width
>>>>>>>This.label1.Caption = tcCaption
>>>>>>>lnNewWidth = This.label1.Width
>>>>>>>This.Width = This.Width + (lnNewWidth  - lnOldWidth)
>>>>>>>
>>>>>>>
>>>>>>>>I've created a container class. It has a label class inside it. The label class has AutoSize set to TRUE. It also has an Assign method
>>>>>>>>LPARAMETERS vNewVal
>>>>>>>>
>>>>>>>>THIS.CAPTION = m.vNewVal
>>>>>>>>This.Parent.Width = this.Width + this.Parent.image1.Width + 2
>>>>>>>>
>>>>>>>>If I step through this code, the container resizes properly.
>>>>>>>>
>>>>>>>>However, without stepping through the code, the Width of the label does not reset when it is given a new value. It retains the width of the label in the class definition.
>>>>>>>>
>>>>>>>>I've tried putting This.Refresh and This.Parent.Refresh at various points in the method, but to no avail.
>>>>>>>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform