Click to See Complete Forum and Search --> : How to Enable Tabbing in Modeless Dialog
SteveMurphy
October 26th, 2004, 11:43 AM
HI All.
I have a modeless dialog box and need to let the user tab through the various controls. I set the dialog to be a Control Parent in the Extended Styles tab of the properties for the dialog. For each of the controls on the dialog I set the Tab Stop option in the properties for the controls. When I display the dialog, tabbing is not enabled.
Question: I noticed that the buttons don't generate WS_TABSTOP in the resource file when you select the Tab Stop option. However, when you unselect the option, then "NOT WS_TABSTOP" appears in the resource file. Is this part of the problem?
Can anyone help?
Thanks!
Here is a snippet from my resource file:
IDD_DIALOG_RTR DIALOG DISCARDABLE 0, 0, 267, 156
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
LISTBOX IDC_LIST_RTR,15,10,175,90,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&New...",IDC_BTN_NEW,200,10,50,15
//Other controls defined here...
END
kirants
October 26th, 2004, 12:34 PM
Remove the POPUP style and add CHILD style to the dialog
SteveMurphy
October 26th, 2004, 01:19 PM
Kirants,
I made the change you suggested, but now the dialog does not display at all. Can you help?
Thanks.
kirants
October 26th, 2004, 01:20 PM
Probably, you do not have VISIBLE style set ?
SteveMurphy
October 26th, 2004, 01:30 PM
You were right. Visible was not selected. I selected, recompiled and ran the program, but still the dialog does not show.
kirants
October 26th, 2004, 01:38 PM
How are you creating this dialog ?
What is the parent you are setting for this dialog ?
SteveMurphy
October 26th, 2004, 01:47 PM
I'm creating the dialog with the CreateDialog function. I just set the parent to the desktop (GetDesktopWindow) and the dialog is now visible, but I cannot select items in a list box that is in the dialog. Also, the minimize control in the title bar is gone. Also, moving the dialog is slow.
The dialog is a plugin to another application. Before I made your suggested changes, I had the parent window set to NULL.
does this help?
kirants
October 26th, 2004, 02:05 PM
Hm.. all along I was under the impression you were creating a modeless dialog as a child of another dialog/window.
Doesn't look like that is the case. Are you looking at creating a popup dialog , but a non-modal one ?
SteveMurphy
October 26th, 2004, 02:29 PM
Sorry about the miscommunication.
I'm trying to create a modeless dialog. I guess the particular style does not matter, but I would like to have the minimize button in the title bar and tabbing is just about essential.
Have you ever heard of this before?
BTW, I'm fairly new to the windows sdk -- I hope my reply makes sense.
kirants
October 26th, 2004, 02:37 PM
Perhaps this would help:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/usingdialogboxes.asp
Note: There are some sample codes for creating modeless dialogs and the message pump.
Probably, you are missing a call to IsDialogMessage in your loop !!
SteveMurphy
October 27th, 2004, 05:47 PM
Kirants,
What you said about the IsDialogMessage might be correct so I want to investigate this.
However, my app is a non-mfc dialog app. I create the dialog with CreateDialog and respond to messages with a callback. I have two things to overcome:
1) How do I deal with the IsDialogMessage in the context of my app? As far as I know, I dont have access to the message pump, but like I said, I'm a windows novice.
2) The second parameter to IsDialogMessage is a pointer to an MSG structure. Two of the fields in that structure require data that (I think) are not available: coordinates of mouse and time. I think I can get this data. But still my question remains: How do I deal with the IsDialogMessage in the context of my app?
If you can help with this, I'd be eternall grateful! Otherwise, I might have to take an entirely different approach to this whole thing.
kirants
October 27th, 2004, 05:56 PM
Is this an app fully written by you / your team.. i.e. it is not a plug in sort of thing which plugs in to an app over which you don't have control , right ?
Ok. To make matters simple.. do you see a WinMain in your code somewhere ?
If so, do you see something similar to:
while(GetMessage())
{
TranslateMessage();DispatchMessage();
}
?
SteveMurphy
October 28th, 2004, 11:57 AM
Kirants,
Here's the deal. The app is a plugin and is a dll. There is no winmain function. The entire plugin is kind of like one big callback that the primary app calls under certain situtations. When the primary app call it, it displays the modeless dialog box that you've been so generously helping me with. In the dialog, the user takes actions and the plugin talks to the primary app to implement user actions so the plugin is like an interface between the primary app and the user.
Does this help?
Thanks.
Steve
kirants
October 28th, 2004, 12:16 PM
Hm... and you won't be able to change the app , wpuld you ?
SteveMurphy
October 28th, 2004, 12:22 PM
No, I would not be able to change the primary app.
kirants
October 28th, 2004, 12:26 PM
Oh man :mad: Let mr think and get back..
kirants
October 28th, 2004, 01:00 PM
One option could be to use hooks to hook into GetMessage.. See SetWindowsHookEx with WM_GETMESSAGE..
Only tricky thing is when to unhook it ? Probably , when your dialog's being destroyed..
Bond
October 28th, 2004, 03:21 PM
So when is the dialog supposed to be loaded? In DllMain?
SteveMurphy
November 1st, 2004, 02:13 PM
Hi Kirants,
Just wanted to let you know I was able to implement the windows hook and the IsDialogMessage function. Tabbing works great.
Thank you very much for your help!!!
kirants
November 1st, 2004, 02:14 PM
Awesome!! :wave:
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.