?
Solved

CButton states

Posted on 2003-02-22
7
Medium Priority
?
542 Views
Last Modified: 2013-11-20
Hi,
I have 8 CButton object on a sidebar dialog.
I would like to be able to synchronize them,which mean,when i push one button,and then another one, i
would like that the first pushed button will be released
and the second one will be pressed.
Just one button should be pressed each time.
I don't know how to realese CButton from its pressed
state.

Thanks a lot for any help.
0
Comment
Question by:dani333
[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
  • 3
  • 2
  • 2
7 Comments
 
LVL 9

Expert Comment

by:Priyesh
ID: 8001992
try SetState(TRUE) to press and SetState(FALSE) to release

you could get the state of a button using GetState()

if(m_Btn1.GetState() & 0x0004)//if btn1 pressed
{
   m_Btn1.SetState(FALSE) ;//release btn1
   m_Btn2.SetState(TRUE) ;//press btn2
}
0
 

Author Comment

by:dani333
ID: 8002969
Hi Priyesh,
It dosen't work.
if(m_Btn1.GetState() & 0x0004)//if btn1 pressed
When I use Debug mode it dosen't get inside the condition.
So I tried :
if(m_Btn1.GetState()!=0 )
but it dosen't release the button
m_Btn1.SetState(FALSE) ;//this line dosen't work


0
 
LVL 9

Accepted Solution

by:
Priyesh earned 200 total points
ID: 8004843
okay dani333,

try this

void CTestdlgDlg::OnOK()
{
     CButton* pButton = (CButton*)GetDlgItem(IDC_BUTTON1) ;
     pButton->SetState(!(pButton->GetState()&0x0004)) ;
}

if you have a button with id IDC_BUTTON1, this code will toggle the button. works for me in VC6.
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Expert Comment

by:mrbiggles
ID: 8018743
Hi try this...

Use the resource editor to place "radio buttons" in your dialog.  Then change the style properties on each button to "Push-like".

hope this helps.
0
 

Expert Comment

by:mrbiggles
ID: 8018881
Hi try this...

Use the resource editor to place "radio buttons" in your dialog.  Then change the style properties on each button to "Push-like".

hope this helps.
0
 

Author Comment

by:dani333
ID: 8021777
Hi,
Can you give me your e-mail please?
0
 
LVL 9

Expert Comment

by:Priyesh
ID: 8022326
padmavilas@hotmail.com
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

770 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