CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Posts
    388

    Default Ok buttons gets focus automatically!

    I am working with a dialog box with several edit boxes and buttons. When I start to write something in an edit box, the default 'ok' buttons gets the focus automatically, no matter if I had actually jumbed to the edit box from another button(= other button was in focus). So when I press enter the ok button is always executed. I don't want this to happen.
    I have changed the tab order but it is not working. I want focus on my last button from where I jumped into the edit box. Please help!


  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Default Ok buttons gets focus automatically!

    Change the style of the Ok button in your resource file or use the resource editor to change the style. It currently has the DEFPUSHBUTTON style, which is why it automatically gets the focus.

    Regards,

    Paul McKenzie


  3. #3
    Join Date
    May 1999
    Posts
    388

    thankx

    The problem was grave but the solution easy!
    thankx


  4. #4
    Join Date
    May 1999
    Posts
    8

    Re: thankx

    i'm suprised that worked
    add the OnInitDialog( ); message with the class wizzard
    and at the end of the source return FALSE; instead
    what it does as default by returning true is to put focus on the first Control in the dialog..




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