Thread: radio buttons?

  1. #1
    Registered User
    Join Date
    Jan 2006

    radio buttons?

    How do you link a variable to a group of radio buttons... I want to an integer to -1 in a dialog constructor, then set the value to 0-5 depending on the radio button selected?

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Banks of the River Styx
    Using just the basic Windows API, in short, you don't link a variable to a group of radio buttons. If you're not using auto radio buttons (it's a button style), then you also have to check and uncheck the buttons as the user clicks. Otherwise, it'll do that automatically, assuming you've set it up correctly.
    If you're using MFC, I'm not sure (you mention a dialog constructor).
    Now, to set a variable to a radio buttons 'value', in Win32 API, you can either send a BM_GETCHECK to each individual radio button to test if it's marker or not when you need the value, or (probably easier) update a variable every time you receive a WM_COMMAND with one of the related radio buttons.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OwnerDrawn Radio Buttons?
    By Devil Panther in forum Windows Programming
    Replies: 0
    Last Post: 02-11-2006, 11:02 AM
  2. Radio Buttons in Visual C++ 6
    By Ripper1 in forum Windows Programming
    Replies: 22
    Last Post: 05-16-2003, 07:54 AM
  3. create radio buttons
    By bluecoder in forum Windows Programming
    Replies: 10
    Last Post: 05-14-2002, 12:01 AM
  4. radio buttons
    By RonShel in forum Windows Programming
    Replies: 5
    Last Post: 09-01-2001, 12:00 PM
  5. Grouping radio buttons
    By Bazz in forum Windows Programming
    Replies: 1
    Last Post: 08-28-2001, 07:15 AM