Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Radio Button not Checking

Posted on 2004-04-09
4
Medium Priority
?
1,076 Views
Last Modified: 2013-11-20
Hi, I am a newbie C programmer and am pulling my hair out on this simple problem.

I have 2 radio buttons "IDC_TargetMD" & "IDC_TargetSC" in group "IDC_STATIC"

Both buttons have the "Auto" property checked and "IDC_TargetSC" has the "Group" Property checked.

When "TargetChoice" equals 2, the mesage box pops and the "IDC_TargetSC"is selected.
When "TargetChoice" does not equal 2, the mesage box pops but no check boxes are selected!!!!!!!

if (TargetChoice==2)
{
      MessageBox(plugin.hwndParent,"SC", "SC",MB_OK);
      CheckRadioButton(hwndDlg, IDC_TargetMD, IDC_TargetSC, IDC_TargetSC);
}
else
{
      MessageBox(plugin.hwndParent,"MD", "MD",MB_OK);
      CheckRadioButton(hwndDlg, IDC_TargetMD, IDC_TargetSC, IDC_TargetMD);
}

HEELLLLPPPP ... going bald :D
(Working in Visual Sudio C++ 6.0)
0
Comment
Question by:Peter-Pan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 14

Assisted Solution

by:wayside
wayside earned 75 total points
ID: 10792018
Check the error code from CheckRadioButton:

BOOL worked = CheckRadioButton(hwndDlg, IDC_TargetMD, IDC_TargetSC, IDC_TargetMD);;

if (worked == FALSE) {
  DWORD errcode = GetLastError();
}

Are you handling the events generated when you check a button? I believe when the button is checked programatically the button fires another event that tells you it's been checked. Perhaps in handling this event you are doing something to cause the button to become unchecked. It's hard to say without seeing more code.
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 75 total points
ID: 10792103
IDC_STATIC is not a group. Group is number of controls arranged by tab order. First control in group has "Group" checked, all other have "Group" unchecked. Check whether IDC_TargetMD and IDC_TargetSC have consequent tab order number (see Layout - Tab Order menu command).
0
 
LVL 1

Author Comment

by:Peter-Pan
ID: 10792246
@wayside -> I tried your code and "worked" was TRUE

@AlexFM -> I meant that "IDC_STATIC" was the "Group box" control that they are sitting in.

My Dialog box has 5 elements (TabOrder):
Button - IDOK(1)
Button - IDCANCEL(2)
Group Box - IDC_STATIC(3)
RadioButton - IDC_TargetMD(4)
RadioButton - IDC_TargetSC(5)

Only IDC_TargetMD has "Group" checked.
0
 
LVL 1

Author Comment

by:Peter-Pan
ID: 10799652
Ok, turns out that there was something stuffed up in my resource.h file. I will just split the points.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question