DEFAULTEXT()

Buttons, ButtonCount

Let me take you a button-hole lower.

William Shakespeare, Love's Labour's Lost

These properties tell you about the buttons in a button group, whether they're option buttons or command buttons. ButtonCount tells you how many are in the group, while Buttons gives you access to the PEMs of the individual buttons.

Usage

oObject.ButtonCount = nNumberOfButtons nNumberOfButtons = oObject.ButtonCount oButton = oObject.Buttons( nButtonNumber )
You can change the number of buttons in a group by changing ButtonCount. If you lower ButtonCount, any extra buttons disappear into oblivion.

The Buttons collection lets you get at the individual buttons within a button group without worrying about their names. You can look up or change properties or invoke buttons' methods by accessing the button through Buttons.

To change properties of all the buttons in a group, use the button group's SetAll method instead.

Example

* Look for the button whose caption is "My Favorite Button" * Assume we're in a method of the button group LOCAL nButton, lFoundIt nButton = 1 lFoundIt = .F. DO WHILE nButton <= This.ButtonCount AND NOT lFoundIt    IF This.Buttons[nButton].Caption = "My Favorite Button"       lFoundIt = .T.    ELSE       nButton = nButton + 1    ENDIF ENDDO IF lFoundIt    WAIT WINDOW "My Favorite Button is "+LTRIM(STR(nButton)) ELSE    WAIT WINDOW "My Favorite Button is missing" ENDIF

See Also

ControlCount, Controls, SetAll


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