Accelerator keys in modal dialog

Article ID: 850
Last updated: 05 Feb, 2008
Article ID: 850
Last updated: 05 Feb, 2008
Revision: 1
Views: 3011
Posted: 02 Sep, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


All menu accelerator keys, in a modal dialog which is a child of the main window, are going to the main window.


Cause


Changes need to be made to the zApp code base to allow this to work.


Action


This is a workaround for this problem if you really want to have a modal dialog from a main window and you need a menu with accelerator keys attached.

In the file app.cpp in the zApp source directory.

In the app::go() method, there are two instances of this code in this method. Make the change below in each of them.
 

Look for this code:

#ifndef __NOMDI__
    if (modalDialog || !zAppGetAppVar(hMDIclient)
|| !TranslateMDISysAccel(zAppGetAppVar(hMDIclient),&msg)) {
#endif

Add this code. Now it should look like this:

#ifndef __NOMDI__
    if (modalDialog || !zAppGetAppVar(hMDIclient)
|| !TranslateMDISysAccel(zAppGetAppVar(hMDIclient),&msg)) {
#endif
        if (modalDialog) //added 
to get accelerator key for modal dialog
               
if (TranslateAccelerator(zAppGetAppVar(activeDialog),hAccel,&msg));

goto again;

The new code added is the if (modalDialog ...

This code exists again a little further down in the same method, so you'll need to make the same change there.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 850
Last updated: 05 Feb, 2008
Revision: 1
Views: 3011
Posted: 02 Sep, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category