Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

Radio Buttons don't work.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter Aitken - 17 Mar 2005 21:06 GMT
I am working on a VC++ program in VS.Net 2003. I am following the
instructions in the help for putting a group of radio buttons on a form.

1) Put 3 radio buttons on the form.
2) Make sure they are seqential in the tab order.
3) For the first one in the tab order, set the Group property to true.
4) Right click the first one in the tab order and select Add variable.
5) Select the Control check box.
6) From the Category list select value.
7) Enter a name for the variable.
8) From the Variable Type list select int.

It's the last step that is throwing me - the list offers only type BOOL. How
can a type BOOL give me info on which of 3 radio buttons is selected? What
am I doing wrong?

Thanks,

Signature

Peter Aitken

Remove the crap from my email address before using.

Severian - 18 Mar 2005 05:20 GMT
>I am working on a VC++ program in VS.Net 2003. I am following the
>instructions in the help for putting a group of radio buttons on a form.
[quoted text clipped - 11 lines]
>can a type BOOL give me info on which of 3 radio buttons is selected? What
>am I doing wrong?

You have to check the state of each button (or at least 2 of the 3,
and assume that if neither is, then it is 3). Only one should be
selected.

Pseudocode:

if (button1 is checked)
 checked_button = 1
else if (button2 is checked)
 checked_button = 2
else
 checked_button = 3

I wrote a C variadic function that will take any number of button IDs
and return the ID that is selected, but I don't have the code
available to show right now.

There may be shortcuts to this in MFC, but I don't use it.

--
Sev
Peter Aitken - 18 Mar 2005 14:13 GMT
>>I am working on a VC++ program in VS.Net 2003. I am following the
>>instructions in the help for putting a group of radio buttons on a form.
[quoted text clipped - 25 lines]
> else
>  checked_button = 3

So I'd attach a BOOL to each button and check each one individually?

Thanks,

Peter
Peter van der Goes - 20 Mar 2005 16:24 GMT
>I am working on a VC++ program in VS.Net 2003. I am following the
>instructions in the help for putting a group of radio buttons on a form.
[quoted text clipped - 13 lines]
>
> Thanks,

The key phrase in the help article you missed is:

"In the Variable type list box, select int or ***type*** int."

(Asterisks added for emphasis).
If you type "int" into the combo box, your variables will be created as
described.

Signature

Peter [MVP Visual Developer]
Jack of all trades, master of none.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.