DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Configuring Panorama (xdt3) Desktop menus

Disabling menu commands

A menu command can be disabled, to indicate to the user that it is not applicable in the current situation.

It is better to disable an inapplicable menu command than to allow the user to choose it and then display an error dialog box.

To disable a menu command, include an enable_if clause in the menu_item clause defining the command. This has the form:

   enable_if { script }

In this example, script is a script that is executed when the menu is displayed. If it returns a ``true'' status the command is enabled; otherwise it is disabled.

For example, the following menu command is only enabled if at least one icon has been selected:

   menu: DesktopMyMenu
   {
     menu_item
     {
       title=MyCommand;
       enable_if
       {
         sels=`(query selections `(query thread_info -i $thread_name(2)))
         -gt $#sels 0
       }
       select_action
       {
         ...
       }
     }
   }

See also:



Next topic: Removing menus
Previous topic: Pop-up menus

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 26 May 2005