Click to See Complete Forum and Search --> : Setting Focus


Starhawk
May 16th, 1999, 07:19 PM
I've noticed that in the Windows Calculator program, when you clidk on
a button with the mouse, the button does not gain focus (i.e. it has
no dotted line border inside it).

How do I duplicate that behavior in my program? Whenever I click on a
CButton object in my window, it highlights the button. I don't want
the button to remain higlighted.

I've found a small work around by using SetFocus to return focus to
the window, but if I click and hold the button down and move out of
the button, the button remains highlighted.

My problem is I don't want that dotted border at all...If the Windows
Calculator can do it, then so can any other program, I assume.

Anyone know how to do this? Thanks.

--Greg

Bob Clarke
May 16th, 1999, 08:10 PM
I don't have my MSDN CDs here to check this myself, but take a look under FocusRect and see if that gives any help.

windcolor
May 16th, 1999, 10:01 PM
GetDlgItem(YOUR_CTRL_ID)->SetFocus();

Playman Cheng
May 17th, 1999, 05:23 AM
Hi,the answer is the buttons of the Calculater is
owner-draw style,so you can set the button's style
to owner-draw,and draw the button yourself.To do this,you must override the DrawItem() function,
please refer to the help sample.