CButton: focus and default 
Author Message
 CButton: focus and default

I have a dialog with multiple buttons, I set one button "Cmd" as the
default button so that when the dialog box appears it has the dark
black border around the "Cmd" button. This is what I want but I want
this to always be the default button.

When a "View" Button is pressed and displays its own dialog box and
when returning the black border is around the "View" button at this
time, not the default button that I want it to be. In the "OnView"
function I call the SetFocus function for "Cmd" and it sets my default
button to that but the black border doesn't go with it.

Any ideas on how to move the black border (which I think is the
DEFAULT) to a different button?

Thanks for the Help!

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Mon, 31 Dec 2001 03:00:00 GMT  
 CButton: focus and default
the default button will not change unless you change it. so check your code-
especially the code that is changing the default button see when it's being
called and put a couple of additional checks to see whether the code's
assumptions are valid.
HTH
sCaLLioN


Quote:
> I have a dialog with multiple buttons, I set one button "Cmd" as the
> default button so that when the dialog box appears it has the dark
> black border around the "Cmd" button. This is what I want but I want
> this to always be the default button.

> When a "View" Button is pressed and displays its own dialog box and
> when returning the black border is around the "View" button at this
> time, not the default button that I want it to be. In the "OnView"
> function I call the SetFocus function for "Cmd" and it sets my default
> button to that but the black border doesn't go with it.

> Any ideas on how to move the black border (which I think is the
> DEFAULT) to a different button?

> Thanks for the Help!

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



Mon, 31 Dec 2001 03:00:00 GMT  
 CButton: focus and default


Quote:
>the default button will not change unless you change it. so check your code-
>especially the code that is changing the default button see when it's being
>called and put a couple of additional checks to see whether the code's
>assumptions are valid.
>HTH
>sCaLLioN

Button->SetButtonStyle(Button->GetButtonStyle() | BS_DEFPUSHBUTTON);

Button being the button you wish to have the border around it.

You could use GetDlgItem but it made the example longer <g>

--
Malcolm Groom



Tue, 01 Jan 2002 03:00:00 GMT  
 CButton: focus and default
The answer below is risky. The better solution is CDialog::SetDefID, which
handles removing the default ID from the previous button and keeping the
dialog informed about what is going on.


Quote:


> >the default button will not change unless you change it. so check your
code-
> >especially the code that is changing the default button see when it's
being
> >called and put a couple of additional checks to see whether the code's
> >assumptions are valid.
> >HTH
> >sCaLLioN

> Button->SetButtonStyle(Button->GetButtonStyle() | BS_DEFPUSHBUTTON);

> Button being the button you wish to have the border around it.

> You could use GetDlgItem but it made the example longer <g>

> --
> Malcolm Groom



Wed, 02 Jan 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. CButton that does not gain focus?

2. Detecting keypress when the focus is on CButton

3. Q1 CButton without focus

4. Setting a CEDIT control default focus

5. ? PropertySheet and default input focus

6. Changing Default ListView - Lost Focus Color

7. How to set Property Sheet default focus

8. Problems with CButton::SetIcon and CButton::SetBitmap under Windows XP

9. How can I use class CLinkButton derived from CButton instead of class CButton

10. Change CButton color and CButton text color in CDialog

11. Set focus with focus border

12. Kill Focus, Set Focus and Message ?

 

 
Powered by phpBB® Forum Software