OWL NExt - Knowledge Base

[ Home | Contents | Search | Next | Previous | Up ]

Command Enablers: One functions -> many items

Date: 11/29/99
Time: 11:55:41 PM

Q. How can I enable/disable a set of menu items with only one handler? My programme has got various menu items which should all appear grayed depending on the condition that a pointer on an object points to NULL (which means the object does not exist). But if the condition (objPtr != NULL) is true all the relevant menu items should return to active state again.

A.
    void MWindow::EvCommandEnable (TCommandEnabler& tce)
    {
        if(tce.Id >= CM_FIRST_TOOL && tce.Id < CM_LAST_TOOL){
            tce.Enable(true);
            TWindow::EvCommandEnable(tce);
       }
    }

Yura.

Last changed: July 14, 2001