Click here to Skip to main content
15,914,481 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I have 3 push buttons. During runtime, based on some condition, I have to make the selection for each button among 3 buttons.

I tried with setfocus() (say m_btnDone.setfocus()) function but it didn't help me.


Pls help me with this.
Posted
Comments
Manfred Rudolf Bihy 28-Mar-11 8:56am    
Moved from non-solution on behalf of ganesh_IT:

Pls post your sample code with clear explanation
bunathangaraj 28-Mar-11 9:04am    
Hi, to be simple I want to set the selection for a push button during run time based on some condition. Is there anyway to do it?

1 solution

If your buttons are (as I suppose) inside a dialog then please read the following article:
"How to set focus in a dialog box"[^].
:-)
 
Share this answer
 
Comments
bunathangaraj 29-Mar-11 5:32am    
Thnx.. it is working fine but if I send WM_NEXTDLGCTL message from initdialog() it is not working. Tried code as below:

BOOL CTestAPP::OnInitDialog()
{

----
-------
::SendMessage(m_hWnd, WM_NEXTDLGCTL, WPARAM)m_btnTest.m_hWnd, TRUE);
----
-----
UpdateData(FALSE);

}








}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900