The information in this article applies to:
SUMMARYThis article describes how OptionGroup buttons function. MORE INFORMATIONDetermining Which Option Button Is Clicked in an Option GroupWith FoxPro version 2.x, you could determine which radio button was clicked by setting up a case structure to return the number of the clicked radio button.In Visual FoxPro, radio buttons are called OptionGroup buttons, and in most cases, you no longer need a case structure to determine which option was clicked. Each OptionGroup button in the group can respond to a click event independently. Step-by-Step Example
Calling Parent CodeIt is possible to encapsulate code even further by using the concept of an parent object. Option buttons are part of an OptionGroup class, so the OptionGroup object is called the parent or the container of the buttons. Messages can be sent to a parent object by prefacing the method call with this.parent.In the following example, a set of OptionGroup buttons send messages to the Click method of the OptionGroup container (parent object):
Calling Button Code from the ParentTo run a given button's code from the OptionGroup object, refer to the event for that particular button. For example, the Click event of the OptionGroup object could run Option1 button's code with this code:
This causes the code in the Click procedure of the Option1 button to run
whenever the user clicks the option group frame instead of an actual
button. Of course, the code in the Option1 Click procedure also runs when
the user clicks the Option1 button directly. But even if another button had
the focus, and the user clicks within the frame of the OptionGroup
container, the code for the Option1 button is run.
Additional query words: VFoxWin
Keywords : |
Last Reviewed: August 24, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |