Button without focus?
-
Hi, can I create a button which not get focus if it is clicked? (a focusless button like a button in a toolbar) The focus should stay with the current control and not be "stolen" by button click. Possibly it can be done by overriding WM_LBUTTONDOWN ...? It would be great if I can avoid ownerdraw (to keep XP style button, if code is running on XP). What I found on Google mentions it has to be a onwerdraw button rebuild from scratch. At the moment I simply set the focus back after button is clicked, but that's not that great. Thx for help, Moak
-
Hi, can I create a button which not get focus if it is clicked? (a focusless button like a button in a toolbar) The focus should stay with the current control and not be "stolen" by button click. Possibly it can be done by overriding WM_LBUTTONDOWN ...? It would be great if I can avoid ownerdraw (to keep XP style button, if code is running on XP). What I found on Google mentions it has to be a onwerdraw button rebuild from scratch. At the moment I simply set the focus back after button is clicked, but that's not that great. Thx for help, Moak
For example: CButton* bt = (CButton*)GetDlgItem(IDC_BUTTON1); void XDlg::OnButton1() { bt->EnableWindow(FALSE);//For Focusless } void XDlg::OnRbuttonDown() { bt->EnableWindow(TRUE);//For back to Focus; } Is this helpful to you.
-
Hi, can I create a button which not get focus if it is clicked? (a focusless button like a button in a toolbar) The focus should stay with the current control and not be "stolen" by button click. Possibly it can be done by overriding WM_LBUTTONDOWN ...? It would be great if I can avoid ownerdraw (to keep XP style button, if code is running on XP). What I found on Google mentions it has to be a onwerdraw button rebuild from scratch. At the moment I simply set the focus back after button is clicked, but that's not that great. Thx for help, Moak
i can't undesrtand...what is it you want..in a toolbar too we have focus on the buttons..when we click them..you can just disable it..and use if you want like that.. cheers Himanshu
-
For example: CButton* bt = (CButton*)GetDlgItem(IDC_BUTTON1); void XDlg::OnButton1() { bt->EnableWindow(FALSE);//For Focusless } void XDlg::OnRbuttonDown() { bt->EnableWindow(TRUE);//For back to Focus; } Is this helpful to you.
yaiii... amazing that this really works. nice trick, chepuri_uk! I changed the code a bit and use something like this now:
void CButtonFL::OnLButtonDown(UINT nFlags, CPoint point)
{
EnableWindow(FALSE);
CButton::OnLButtonDown(nFlags, point);
EnableWindow(TRUE);
}Gratefully, Moak PS: I own you a pizza :)
-
i can't undesrtand...what is it you want..in a toolbar too we have focus on the buttons..when we click them..you can just disable it..and use if you want like that.. cheers Himanshu
yeah like a button on a PC... like when you click and all the focus was gone... huuu.... like a button but just like without this focus... like when you click and... it then does not take focus... like in a toolbar we have. It's kind of button. Moak -- "...and it was like, bleep bleep bleep bleep bleep bleep bleep..." Ellen Feiss, Student ;)