Swap and Insert Pull-Down Menus (Concept)

AutoCAD

 
Swap and Insert Pull-Down Menus
Concept Quick Reference
 
 
 

Using the Customize User Interface (CUI) Editor, you can use workspaces to control the swapping of pull-down menus. However, you can also swap a pull-down menu programmatically (for example, when a user loads an application that requires an additional menu). Menu swapping activates one menu directly from another menu.

Swap Pull-Down Menus

Because the program has cascading pull-down menus, there is little need to swap menus. Also, swapping menus can detract from the consistency of the user interface. However, using $ commands, you can swap pull-down menus and submenus. An alternative to menu swapping involves relative (or global) referencing. Using this method, you can insert the new menu in front of a known menu and then remove the known menu.

For menu-swapping purposes, the pull-down menu areas are named P1 through P16. You can change the title that appears in the menu bar by replacing that line of the menu with a $Pn= command. You can use the special command $Pn=* from within any command to force the menu currently assigned to area POPn to pull down for greater flexibility in movement of the pointing device.

The following macro example replaces a menu at position P3 with the menu named MyMenu in the customization group named MYMENU.

$P3=mymenu.new3

The same thing can be done with the AutoLISP menucmd function as follows:

(menucmd "P3=mymenu.new3")

You can use the $Pn=* special command from within any macro to force the menu currently assigned to area POPn to be displayed.

NoteThe swapping of pull-down menus does not conform to the Microsoft® user interface guidelines and is not guaranteed to be available in future releases of the program.

Insert and Remove Pull-Down Menus

Menu swapping is done by activating one menu directly from another menu. Menu swapping is supported for the following interface elements:

  • Buttons
  • Pull-down menus
  • Mouse buttons
  • Image tile menus
  • Tablet menus

The syntax for the swapping of partial menus is as follows:

$section=menugroup.menuname

section

B1-4, A1-4, P0-16, T1-4

menugroup

Customization group name in the desired CUI file

menuname

Main label or alias

You can use the AutoLISP menucmd function to insert or remove a pull-down menu. The syntax is similar to that used to swap pull-down menus except that the left side of the assignment is the pull-down menu before which the new menu will be inserted. The right side of the assignment is a plus sign (+) followed by the name of the menu group, a period, and the menu's alias, as shown in the following syntax:

(menucmd "menugroup1.menuname1=+menugroup2.menuname2")

You can also insert a menu with the Pn= syntax. The following macro inserts a menu after the P5 menu. (You can also use the menucmd function with this format.)

(menucmd "P5=+mymenu.new3")

If you use this method to insert a menu, remember that you cannot rely on its being inserted at the P6 menu location as you might expect. There are two reasons that this may not be the case.

  • If the current menu bar has only three menus, inserting a menu after menu P5 results in the new menu's location being P4.
  • If the user inserts or removes a customization file with the CUILOAD command or when another application inserts or removes customization files, menu numbering can get out of sync.

This is the syntax for removing a menu:

(menucmd "Gmenugroup.menuname=-")

The following example removes the menu NEW3 that is a member of the MyMenu group.

(menucmd "Gmymenu.new3=-")

As you might expect, the preceding format is preferable to the Pn= format because it removes only the specified menu. The following example removes the menu at the P4 location (whatever it is).

$P4=-
NoteUse the Pn syntax as part of the syntax for a menucmd statement only. Use the $Pn syntax for macro-specific statements.

Control Toolbars Across Partial CUI Files

To control toolbars across partial CUI files, use the following syntax at the Enter toolbar name or [ALL]: prompt of the -TOOLBAR command.

        menugroup.subsection-name
      

This syntax accesses the toolbar identified by menugroup.menuname and allows you to use the full spectrum of -TOOLBAR command options on that toolbar.

If the menu group is left out of any of these commands and functions, the program defaults to the main CUI file.

You should be aware of the following:

  • Image tile menus cannot be swapped from external customization files.
  • You can swap customization elements of the same type only; that is, one shortcut menu for another, one toolbar for another, and so on. Trying to swap between types may result in unpredictable behavior.