Thread: Keyboard TAB Problem

  1. #1
    Registered User Gary's Avatar
    Join Date
    Mar 2002
    Posts
    7

    Keyboard TAB Problem

    HI,

    I'm developing a project written in C to provide non-C++ programmers with a "class" like library for creating GUI apps in Windows. I'm pretty far along, with most windows controls already functioning, but I recently discovered that my test apps are not responding to the keyboard TAB and ENTER keys. When I define the controls in the test apps, I always use the WS_TABSTOP style, but I get no response when I use the TAB or ENTER keys. When I write a test app in pure Win32API code, they work fine, so I know my keyboard is functioning properly. I've looked at tons of sample code from the internet and compared them to my code, and I seem to be doing everything right... except for the strange keyboard behavior. BTW... I am able to trap the TAB and ENTER keys using the WM_KEYUP message in my wndproc function.

    Any Thoughts?

    Thanks... Gary.

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Do you have small program that shows the behaviour that you could post, (zip it up with any necessary resource and header files).

    It is difficult to even guess where the problem is. If you simple test program works, then you obviously are doing something right! If your real apps are coded up the same way, but are performing differently, then you are doing something to make it fail.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User Gary's Avatar
    Join Date
    Mar 2002
    Posts
    7

    Keyboard TAB Problem

    Originally posted by adrianxw
    Do you have small program that shows the behaviour that you could post.
    Unfortunately, my program is approximately 130K in size and is the GUI library that other programmers will use to create windows apps (if I can ever figure this problem out). I could show the sample apps, but that would be pointless without my source code which is too lengthy to post here. I can only tell you that I am following the conventions that the windows books and other sample win32api code uses... at least that I've studied (very carefully).

    Is there anything that a program can do, accidently, to tell windows to ignore the TAB key? I can't think of anything.

    Thanks... Gary.

  4. #4
    Climber spoon_'s Avatar
    Join Date
    Jun 2002
    Location
    ATL
    Posts
    182
    You need to process IsDialogMessage in your message loop.

    Do something like:

    Code:
    	while(GetMessage(&msg, NULL, 0, 0) > 0)
    	{
    		if(!IsDialogMessage(hWnd, &msg))
    		{
    			TranslateMessage(&msg);
    			DispatchMessage(&msg);
    		}
    	}

  5. #5
    Registered User Gary's Avatar
    Join Date
    Mar 2002
    Posts
    7
    Originally posted by spoon_
    You need to process IsDialogMessage in your message loop.
    You are truly a lifesaver It now works exactly the way it's supposed to.

    I can't thank you enough. That one certainly got by me. I must of looked at it hundreds of times and still didn't see it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Keyboard port using other that a keyboard
    By antoinelac in forum C++ Programming
    Replies: 4
    Last Post: 06-12-2008, 02:46 PM
  2. Tab Ordering of GUI Controls
    By cloudy in forum Windows Programming
    Replies: 2
    Last Post: 04-22-2006, 09:13 AM
  3. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  4. Tab order in Tab Control
    By Halloko in forum Windows Programming
    Replies: 2
    Last Post: 05-08-2005, 11:08 PM
  5. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM