Sign in to follow this  
Followers 0
jpm

ctrl-tab to change tab control

7 posts in this topic

Before Jon optimized/cleaned the GUI code

the following was working

  case WM_NOTIFY:

// AUT_DEBUGMSG("==> CGuiBox::WndProc : WM_NOTIFY\n")

mynmhdr=(LPNMHDR)lParam;

if(mynmhdr->code==TCN_KEYDOWN)

{

    #ifdef _DEBUG

  Util_DebugMsg("==> CGuiBox::WndProc : WM_NOTIFY (Vk_Control=%.8X, Vk_Tab=%.8X)\n", GetKeyState( VK_CONTROL), GetKeyState(VK_TAB));

    #endif

    if ( (GetKeyState(VK_CONTROL)<0) && (GetKeyState(VK_TAB)<0) )

    {

  i = (int)SendMessage(mynmhdr->hwndFrom,TCM_GETCURSEL, 0,0);

  if (GetKeyState(VK_SHIFT)<0)

      --i;

  else

      ++i;

  ObjAction(mynmhdr->hwndFrom, GetControlID(mynmhdr->hwndFrom), i);

    }

}

Now when Ctrl + tab are type the GetKeyState(VK_TAB) is not returning anymore a negative value.

How should we handle the the notification of the ctrl-tab

Thanks for the help :D

Share this post


Link to post
Share on other sites



Hi jpm :huh2:

I don't really know, but the MSDN says:

Return Values
The return value specifies the status of the given virtual key, as follows: 

If the high-order bit is 1, the key is down; otherwise, it is up. 
If the low-order bit is 1, the key is toggled. A key, such as the caps lock key, is toggled if it is turned on. The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled.

Is it maybe possible to use a bitshift-operation to check if the key is pressed?

Hmmm... :D

Share this post


Link to post
Share on other sites

Hi jpm  :huh2:

I don't really know, but the MSDN says:

Return Values
The return value specifies the status of the given virtual key, as follows: 

If the high-order bit is 1, the key is down; otherwise, it is up. 
If the low-order bit is 1, the key is toggled. A key, such as the caps lock key, is toggled if it is turned on. The key is off and untoggled if the low-order bit is 0. A toggle key's indicator light (if any) on the keyboard will be on when the key is toggled, and off when the key is untoggled.

Is it maybe possible to use a bitshift-operation to check if the key is pressed?

Hmmm... :D

I read all of that but that does not explain why GetKeyState(VK_TAB) return 1 or 0.

I am impossibility to tocheck that the TAB was pressed :)

Share this post


Link to post
Share on other sites

I read all of that but that does not explain why GetKeyState(VK_TAB) return 1 or 0.

I am impossibility to tocheck that the TAB was pressed :D

From what I read you have to test for TAB before the IsDialogMessage() / DispatchMessage() as that swallows it up. At this point I realised that you would have to change both message pumps and it would be a major hassle and I didn't think it was worth it.

Share this post


Link to post
Share on other sites

From what I read you have to test for TAB before the IsDialogMessage() / DispatchMessage() as that swallows it up.  At this point I realised that you would have to change both message pumps and it would be a major hassle and I didn't think it was worth it.

Thanks Jon,

I try a simple testing before the isDialogMessage but no success

if ((msg.wparam == VK_TAB) && (GetKeystate(VK_CONTROL)>0))

:D

Share this post


Link to post
Share on other sites

I chek with Spy the messages sent.

I cannot understand why the VK_CONTROL is Notify but not the VK_TAB?

Any idea to correct that

<00355> -tabctl- P WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0

<00356> -tabctl- S WM_GETDLGCODE

<00357> -tabctl- R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS

<00358> -guiwin- S WM_NOTIFY idCtrl:0 pnmh:0012FA90

<00359> -guiwin- R WM_NOTIFY

<00360> -tabctl- P WM_KEYDOWN nVirtKey:VK_TAB cRepeat:1 ScanCode:0F fExtended:0 fAltDown:0 fRepeat:0 fUp:0

<00361> -tabctl- S WM_GETDLGCODE

<00362> -tabctl- R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTCHARS

NO WM_NOTIFY

<00363> -editctl S WM_GETDLGCODE

<00364> -editctl R WM_GETDLGCODE fuDlgCode:DLGC_WANTARROWS | DLGC_WANTALLKEYS | DLGC_HASSETSEL | DLGC_WANTCHARS

<00365> -editctl S EM_SETSEL nStart:0 nEnd:2147483647

<00366> -editctl R EM_SETSEL

<00367> -tabctl- S WM_KILLFOCUS hwndGetFocus:002B03B8

<00368> -tabctl- R WM_KILLFOCUS

<00369> -editctl S WM_SETFOCUS hwndLoseFocus:-tabctl-

<00370> -guiwin- S .WM_CTLCOLOREDIT hdcEdit:6F010DDF hwndEdit:-editctl

<00371> -guiwin- R .WM_CTLCOLOREDIT hBrush:01100061

<00372> -guiwin- S .WM_CTLCOLOREDIT hdcEdit:6F010DDF hwndEdit:-editctl

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0