CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Setting Focus

  1. #1
    Join Date
    May 1999
    Posts
    2

    Setting Focus

    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


  2. #2
    Join Date
    May 1999
    Posts
    42

    Re: Setting Focus

    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.


  3. #3
    Join Date
    May 1999
    Posts
    5

    Re: Setting Focus

    GetDlgItem(YOUR_CTRL_ID)->SetFocus();


  4. #4
    Join Date
    Apr 1999
    Posts
    16

    Re: Setting Focus

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured