I'm creating a window using CreateDialog() using a resource file for the window template. When I use DialogBox(), it allows me to use the tab key to change the focus of edit boxes and buttons. However, due to the vast amount of functions I'm using that require a window handle, I'm using CreateDialog(). With CreateDialog(), the tab key is disabled to allow for custom key handling by the programmer. So, does anyone know how to make it so the tab key changes the focus to the next element in the window?
I don't know of one that exists, but I have an idea:
If your dialog handler indexes the controls (I know the built-in allegro one does), you can just have a thing that checks for tab, and increments a number, and sets the focus to that number. If the number is too high, it sets it back to the start.
EDIT:
Otherwise you could index them yourself.
are you speaking abouf MFC or about allegro ?
In MFC , when I design a dialog there is a visual checkbox with the name TAB-STOP.
In Allegro I don't know. Is there some GUI for Allegro that create Dialogs ?
James: Eh, I don't really know how to go about doing that. It doesn't look like there's anything on MSDN for changing the focus from one dialog item to another unless I'm not searching for the right thing.
Roberto: I'm talking about Win32 dialogs. Not MFC or Allegro.
Sorry, I assumed you were using some dialog code you'd found on the Internet somewhere. In the Tab-Stop thing, just put the number you want it to come in the tab order. For example, first control would be 1, second would be 2, etc. I assume this is how it works, I haven't used Windows for a long time, and I never managed to make C++ work in it.
EDIT:
It might be ControlName->SetFocus() or ControlName->Focussed = 1.