Home > Archive > Visual Basic > February 2005 > Option buttons
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Peter Newman 2005-02-28, 3:55 pm |
| I have an array of option butons in Graphical style ( CmnOpt ). When the
user first enters the form non of the option buttons are shown as pressed (
clicked ) , but only Cmdopt(0) is enabled. Ehen that is clicked then
CmdOpt(1) become enables and cmdopt(0) is disables.
i have a standered cmd button which when clicked i want to reset the cmdopt
to the origional state , none showing a depressed state and only cmdopt(00
being enabled. im having loads of problems with this. any ideas's that do not
execute the
cmdOpt_Click(Index As Integer) procedure ?
| |
| Noozer 2005-02-28, 3:55 pm |
|
"Peter Newman" <PeterNewman@discussions.microsoft.com> wrote in message
news:340196A4-38AB-46F0-AC86-89C49C8F2FB1@microsoft.com...
> I have an array of option butons in Graphical style ( CmnOpt ). When the
> user first enters the form non of the option buttons are shown as pressed
(
> clicked ) , but only Cmdopt(0) is enabled. Ehen that is clicked then
> CmdOpt(1) become enables and cmdopt(0) is disables.
>
> i have a standered cmd button which when clicked i want to reset the
cmdopt
> to the origional state , none showing a depressed state
<snip>
Option buttons should *ALWAYS* have one button selected. If you need the
ability to have none selected, add another button labeled "NONE" or add a
checkbox to disable the option buttons.
| |
| Bjørnar Nilsen 2005-02-28, 3:55 pm |
| >I have an array of option butons in Graphical style ( CmnOpt ). When the
> user first enters the form non of the option buttons are shown as pressed
> (
> clicked ) , but only Cmdopt(0) is enabled. Ehen that is clicked then
> CmdOpt(1) become enables and cmdopt(0) is disables.
>
> i have a standered cmd button which when clicked i want to reset the
> cmdopt
> to the origional state , none showing a depressed state and only cmdopt(00
> being enabled. im having loads of problems with this. any ideas's that do
> not
> execute the
> cmdOpt_Click(Index As Integer) procedure ?
Some hard to understand what your problem really is. "Enable" is a state
which can be true or false. If state is false, you can't get access to it in
run-time.
You have to use the property "Value" to determine if the optionbutton is
pressed/unpressed or "marked/unmarked".
mvh
B. Nilsen
| |
| Rick Rothstein 2005-02-28, 3:55 pm |
| > I have an array of option butons in Graphical style ( CmnOpt ). When
the
> user first enters the form non of the option buttons are shown as
pressed (
> clicked ) , but only Cmdopt(0) is enabled. Ehen that is clicked then
> CmdOpt(1) become enables and cmdopt(0) is disables.
>
> i have a standered cmd button which when clicked i want to reset the
cmdopt
> to the origional state , none showing a depressed state and only
cmdopt(00
> being enabled. im having loads of problems with this. any ideas's that
do not
> execute the
> cmdOpt_Click(Index As Integer) procedure ?
I think you might be using the term "Enabled" incorrectly. When a
control's Enabled property is False, it cannot be interacted with. I
think the word you want is "selected". As to your question... if I
understand you correctly, I think this will do what you want
Dim OB As OptionButton
For Each OB In Cmdopt
OB.Value = False
Next
Rick - MVP
| |
| Ken Halter 2005-02-28, 3:55 pm |
| "Peter Newman" <PeterNewman@discussions.microsoft.com> wrote in message
news:340196A4-38AB-46F0-AC86-89C49C8F2FB1@microsoft.com...
>I have an array of option butons in Graphical style ( CmnOpt ). When the
> user first enters the form non of the option buttons are shown as pressed
> (
> clicked ) , but only Cmdopt(0) is enabled. Ehen that is clicked then
> CmdOpt(1) become enables and cmdopt(0) is disables.
>
It's kind of strange to enable/disable them like that (if I'm reading
correctly anyway...). If you want an option that sets them all to false, the
easiest way is to add another. At runtime, move the extra one off screen
(Left -70000 or something) and set it True. That'll set all others in that
group to False. It'll take some code to make sure that hidden button never
gets focus. If it gets focus, it'll set itself to True. What a pain eh?
<g>...
The "best" way is to add another option and set its caption = None. That
way, the user can easily see how to "unselect" the option.
--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
|
|
|
|
|