DEFINE WINDOW

AutoSize

This property determines whether controls stretch to fit their contents.

Usage

oObject.AutoSize = lFitSizeToContents lFitSizeToContents = oObject.AutoSize
For about half of the affected controls, Caption determines the size when AutoSize is .T. This is the case for labels, both kinds of buttons and check boxes. For option buttons and check boxes, AutoSize interacts with Alignment. The control grows or shrinks on the side it's aligned on—that is, when you set AutoSize to .T. and Alignment to Left for a check box, it's the left edge of the check box that moves when the Caption changes.

For the other controls affected by AutoSize, generally it's their contents that determine their size.

Don't turn on AutoSize for button groups until you've positioned the buttons where you want them. Trying to move buttons around inside a group that keeps resizing itself as you go is kind of like trying to swat a fly. It keeps moving and you're always one step behind.

You can set AutoSize on for individual buttons in a group without having it on for the button group as a whole. This can lead to weird results. Normally, you'll want AutoSize on for individual buttons only when it's on for the group. What good is a button that's stretched to fit its entire caption if the button doesn't fit inside its container? Actually, there is one situation where you do want that combination. You can make the button group larger than the buttons within, so you can make other controls look as if they're inside the border of the group. For example, a button choosing "output to file" might have a text box next to it to specify the filename.

For OLE controls (both OLE Container and OLE Bound), AutoSize interacts with the Sizable property. If both are true, when the OLE control is activated, dragging the shaded border of the OLE object changes the amount of space the OLE control takes up on the form. Since a clever user could use this "windowshade" effect to hide the OK/Cancel buttons, we use these properties only if the user really needs to be able to enlarge the object.

Example

* Normally, you'll set this property at design-time, but * here's the runtime equivalent. ThisForm.opgChoices.AutoSize = .T. ThisForm.opgChoices.optChoice1.AutoSize = .T. ThisForm.opgChoices.optChoice1.Caption = "Boy, is this long"

See Also

Alignment, Left, Sizable, Width


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net