CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2007
    Location
    California
    Posts
    136

    enable tab feature

    Greetings all,

    I have several editboxes, and I would like to use "Tab" key to traverse through them, but my program doesn't seem to respond to the "Tab" key.

    Is there a setting I need to set in CreateWindowEx?

    Any suggestion is appreciated
    K.B.

  2. #2
    Join Date
    May 2005
    Posts
    4,954

    Re: enable tab feature

    Are you setting the WS_TABSTOP style?

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  3. #3
    Join Date
    Jun 2007
    Location
    California
    Posts
    136

    Re: enable tab feature

    Quote Originally Posted by golanshahar
    Are you setting the WS_TABSTOP style?

    Cheers
    Greetings,

    golanshahar, yes, I did set WS_TABSTOP on all of my edit boxes.
    It is still not recognizing the Tab key.
    I am creating my edit boxes dynamically with CreateWindowEx(), I did not use a resource script. I looked up similar problems on other posts, and it seems like I have to intercept KEYDOWN & VK_TAB messages, and process them myself.

    Does that mean WS_TABSTOP is an useless style for CreateWindowEx()?

    Thank you

  4. #4
    Join Date
    Aug 2001
    Location
    Texas
    Posts
    645

    Re: enable tab feature

    post your project so that we can build it and test it. Make sure that what you post can be compiled.

    What compiler are you using?

  5. #5
    Join Date
    Jun 2007
    Location
    California
    Posts
    136

    Re: enable tab feature

    Quote Originally Posted by cvogt61457
    post your project so that we can build it and test it. Make sure that what you post can be compiled.

    What compiler are you using?
    Greetings,

    cvogt61457, I am using VS 2005 Professional Edition.
    Here is my project: Project
    The project is created under Win32 Application, and alarm2.wav needs to be added to resource.

    The project is compiling with 6 warnings but no errors.

    If you stubble across some obvious mistakes while investigating the Tab problem, please point them out, I will greatly appreciate your comments.

    Thank you
    Last edited by kabilius; July 13th, 2007 at 02:39 PM.

  6. #6
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: enable tab feature

    Quote Originally Posted by kabilius
    ...I did set WS_TABSTOP on all of my edit boxes.
    It is still not recognizing the Tab key.
    I am creating my edit boxes dynamically with CreateWindowEx(), I did not use a resource script. I looked up similar problems on other posts, and it seems like I have to intercept KEYDOWN & VK_TAB messages, and process them myself.

    Does that mean WS_TABSTOP is an useless style for CreateWindowEx()?
    WS_TABSTOP simply indicates on what controls to stop if the window procedure moves focus from one control to another on TAB key.
    By default, only the Dialog Box proc does it. To make it work in generic window, you should call IsDialogMessage() yourself in your message loop:
    Code:
    // Message Loop
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
    	if(IsDialogMessage(hwnd, &Msg) == 0)
    	{
    		TranslateMessage(&Msg);
    		DispatchMessage(&Msg);
    	}
    }
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  7. #7
    Join Date
    Jun 2007
    Location
    California
    Posts
    136

    Re: enable tab feature

    Quote Originally Posted by VladimirF
    WS_TABSTOP simply indicates on what controls to stop if the window procedure moves focus from one control to another on TAB key.
    By default, only the Dialog Box proc does it. To make it work in generic window, you should call IsDialogMessage() yourself in your message loop:
    Code:
    // Message Loop
    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
    	if(IsDialogMessage(hwnd, &Msg) == 0)
    	{
    		TranslateMessage(&Msg);
    		DispatchMessage(&Msg);
    	}
    }
    Greetings,

    VladimirF, after adding IsDialogMessage(), the program is recognizing the TAB key. Problem solved =))
    Should I delete my project from the web space now?

    Thanks to golanshahar, cvogt61457, and VladimirF for helping me!
    Last edited by kabilius; July 13th, 2007 at 04:42 PM.

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