How to move focus to next edit box when TAB key is pressed? 
Author Message
 How to move focus to next edit box when TAB key is pressed?

I have created a list box with a number of edit boxes in it. The edit boxes
are used by the user to key in information. How do I move the focus from one
Edit box to the next when the user presses the TAB key?


Fri, 06 Aug 2004 10:24:39 GMT  
 How to move focus to next edit box when TAB key is pressed?
I'm a little confused since this should happen automatically depending on
the tab order and if you have the controls set up as tab stops.  You can
also use the GotoDlgCtrl() or NextDlgCtrl() or PrevDlgCtrl() to move from
control to control in your program.

Tom


Quote:
> I have created a list box with a number of edit boxes in it. The edit
boxes
> are used by the user to key in information. How do I move the focus from
one
> Edit box to the next when the user presses the TAB key?



Fri, 06 Aug 2004 11:59:20 GMT  
 How to move focus to next edit box when TAB key is pressed?

Quote:

> I'm a little confused since this should happen automatically depending on
> the tab order and if you have the controls set up as tab stops.  You can
> also use the GotoDlgCtrl() or NextDlgCtrl() or PrevDlgCtrl() to move from
> control to control in your program.

> Tom



> > I have created a list box with a number of edit boxes in it. The edit
>  boxes
> > are used by the user to key in information. How do I move the focus from
>  one
> > Edit box to the next when the user presses the TAB key?

Good luck I have never even been able to validate edit boxes as they loose
focus and then reset focus back when invalid, the couple of times I have
tried it. Perhaps I was reluctant to subclass edit boxes.

Do I understand it right?
You have an owner_draw list box with edit controls being drawn inside?

I was going to suggest subclassing the edit box and passing tabs to its parrent
the list box as cursor movements ( since thats what changes the selected item
in a list box or changing the selected item with LB_XX messages.
Then I realized that the TAB key never reaches the edit so you would have to
trap it in the parent of the list box.

As soon as you try anything little more advanced the whole keyboard interface
goes to hell.

Cheers, Sam



Fri, 06 Aug 2004 17:31:45 GMT  
 How to move focus to next edit box when TAB key is pressed?
Quote:

>I have created a list box with a number of edit boxes in it. The edit boxes
>are used by the user to key in information. How do I move the focus from one
>Edit box to the next when the user presses the TAB key?

Hello Paul

Have you included a call to IsDialogMessage in WinMain?

i.e.

while (GetMessage(&msg, NULL, NULL, NULL))
{
  if (!IsDialogMessage(foo, &msg))
  {
     TranslateMessage(&msg);
     DispatchMessage(&msg);
  }

Quote:
}

Andy


Fri, 06 Aug 2004 17:36:07 GMT  
 How to move focus to next edit box when TAB key is pressed?
Thanks Andy, it works now by including IsDialogMessage as you suggested, but
will this affect other messages not intended for my particular Dialog?

Paul

Quote:
> Have you included a call to IsDialogMessage in WinMain?
> i.e.

> while (GetMessage(&msg, NULL, NULL, NULL))
> {
>   if (!IsDialogMessage(foo, &msg))
>   {
>      TranslateMessage(&msg);
>      DispatchMessage(&msg);
>   }
> }



Sat, 07 Aug 2004 04:32:13 GMT  
 How to move focus to next edit box when TAB key is pressed?
Quote:

>Thanks Andy, it works now by including IsDialogMessage as you suggested, but
>will this affect other messages not intended for my particular Dialog?

Hello Paul.

You need to include the appropriate window handle in your call to
IsDialogMessage.

i.e. IsDialogMessage(YourParticularDialogHandle, NULL, NULL, NULL);

Andy



Sat, 07 Aug 2004 17:30:47 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. How to move focus to next tab stop?

2. Cannot press tab to move to a tab control after using WS_EX_CONTROLPARENT

3. press enter in an edit box and make it happen in an other edit box too

4. Using Tab to set the focus between edit boxes

5. Tab key in edit box

6. Mapping Enter key to Tab in edit boxes

7. Moving the focus to the next TabIndex

8. Move focus to next item

9. Trapping ENTER key to move to next control

10. Trapping key presses when a child window has focus

11. Key press & Mouse move event

12. Intercepting key presses if application is not in focus

 

 
Powered by phpBB® Forum Software