Dialog doesn't respond to tab key

This is a discussion on Dialog doesn't respond to tab key within the Windows Programming forums, part of the Platform Specific Boards category; I've got a VC++.net dialog with 2 edits, 3 buttons, and some static text. None of the controls are grouped. ...

Dialog doesn't respond to tab key

I've got a VC++.net dialog with 2 edits, 3 buttons, and some static text. None of the controls are grouped. Each non-static control has WS_TABSTOP, and I've set the Tab Order. The tab key works fine when I do "Test Dialog" in the Resource Editor, but when the program displays the dialog, the tab key is ignored.

I've searched the forum on this topic, and found a few related posts, but none answered this question. Any ideas will be appreciated.

It's a plugin module for SynthEdit, the modular software synth program by Jeff McClintock. If it's an application-specific thing, I'll ask him about it. I just thought it might be a more generic Windows issue.

The way the SynthEdit SDK is set up, a plugin doesn't have its own message loop. It's just a .dll with functions that get called -- event handlers for tasks like processing a block of audio samples, responding to a MIDI message, and so on. There's a base class with virtual functions for all of the calls that the host program can make to a plugin, and you override them as needed to build a particular module's functionality.

For this module, the function I'm overriding is called whenever a change occurs in an input signal. At that point, I determine which input has changed. For one particular control voltage input, I need to put up a dialog to get some info from the user of the synth before proceding. I'm just using GetForegroundWindow() as the dialog's parent window.

I've noticed that it's not just the tab key; the dialog also doesn't respond to the enter key to push the default button.

>> I need to put up a dialog to get some info from the user of the synth before proceding.
If you need the info from the dialog before proceding the you need to provide a message loop to run the dialog until you have that info.

If you use a function like DialogBox() it will provide the message loop for you.

This works great, except for one problem: if the host program is exited while this loop is running, another function in the module is called in another thread. All module windows, including the dialog, are closed/distroyed in an orderly way, and the above loop exits when IsWindow(hDlg) fails. So far, so good, but the host program then crashes. I've tried adding

Code:

if( WndCount == 0 ) ExitThread( 0 );

after the loop, but that didn't help. So I'm still stuck at the moment.

I don't see any reason why you can't use the DialogBox() function. In the code you posted, you can perform all the initialization between CreateDialog() and the message loop within the WM_INITDIALOG message within your DialogProc().

As for the crash - you can try using NULL as your parent window (just something to try...).
It may be that the root cause of the crash is that you're "blocking" the return of the plugin call that created the dialog. If that's the case, then you'll have to get creative with a non-blocking, multi-threaded solution that allows the plugin call to return.

If the plugin architecture supports a "we're shutting down" API then you'll want to tap into that of course.