Menus
Menus are stored in menu files (.MNU format). For example, the default menu file is CADS.MNU.
You can use five different types of menus: drop-down, text, icon, and keyboard menus and toolbars. All menu actions are defined with command scripts. For more information, see Command scripts and macros. You can enter the command script directly to a menu item or define a command ID and define the command script elsewhere.
Menu files are text files that you can edit on a text editor. You can also edit certain menus in the program. For more information, see Customize toolbars and Edit icon menus. You can open menus using the following functions:
Define icon and text menus in a different menu file than drop-down menus and toolbars.
Menu files are divided into the following sections, each separated by a section identifier field:
-
Group data – General data of the menu group
In the groupdata section you define resource files that contain toolbar buttons and drop-down menu connections to other drop-down menus. The section syntax is as follows.
[Groupdata]
Resources=resource fileDefines the resource files (.dll) from which the program will look for the toolbar buttons.
Connect=pulldown menu connectionDefines the pulldown menu connections. The syntax is as follows.
Connect =command_id -= | = | += command_id
-= add menu item in front of the first item
= replace the first item
+= add menu item after the first item
Example[Groupdata]
Resources =scads.dll;buttons.dll
Connect =CADS.ID_POP_WINDOW-=ID_AVV_PK
[PulldownMenu]
POPUP "Schema", ID_AVV_PK
{
...
-
Drop-down menu definitions
Like all Windows programs, CADMATIC Draw contains drop-down menus that you can open from the menu bar. They consist of the main menu that is always visible and popup menus that open as you click on the main menu item. Define drop-down menus in a standard menu file (.MNU) starting with a section identifier [PulldownMenu].
The drop-down menu file structure is:
POPUP
"caption"
-
Caption is the part of a popup or a menu item that you can see in the actual menu. Apart from standard text, it can contain the following special characters:
-
&– Hot-key. Pressing the hot-key executes the menu item when the menu is open. The hot-key is underlined.
-
\t – Key combination. Pressing the key combination executes the menu item when the menu is not open.
-
[Flags]
-
There are two flag definitions:
-
MENUBARBREAK – The main menu bar is divided into two lines.
-
MENUBREAK – The popup menu is divided into two columns.
-
-
>[,"tool tip string"]
{
menu item
menu item
...
}
The menu item can be another popup, a command, or a separator. Optional parts are shown in square brackets. The command structure is one of the following:
-
"caption", "command script" [,flags] [,"tool tip string"]
-
"caption", command_id [,flags]
You can change the current drop-down menu with the Preferences function. You can also edit drop-down menus with the Menu function. For more information, see Define directory settings and Menu functions.
-
-
Toolbar menu definitions
A toolbar consists of buttons with bitmap images. Each button starts a separate command. A toolbar can float on the drawing area, or you can dock it to the side of the drawing area. You can edit toolbars in the drawing view as well. For more information, see Customize toolbars.
Toolbars are defined in three separate files:
-
Command definition in the menu file (.MNU)
-
Compiled menu file (.MNS)
-
Toolbar button images (.DLL or .BMP)
Toolbar buttons are bitmap images saved as a resource file (such as Buttons.dll) or as separate files (.BMP).
Save information on the visibility, location, and number of rows of toolbars in the Cads.ini file. The program gets the default values for these options from the menu file.
Toolbar definition starts with a section identifier [Toolbars]. You can define the functions of multiple different toolbar buttons in the same file.
Show/hide example[Toolbars]
TOOLBAR "Toolbar_name", command_id, "visibility location coordinates rows"
{"button", command_id}
Keyboard menu definitionsYou can edit keyboard menus also in the drawing mode. For more information, see Manage keyboard commands.
Keyboard menu definition starts with a section identifier [KeyboardMenu]. Each line represents a key or a key combination. The keyboard menu file structure is the following:
"key", "command script"
For more information, see Command scripts and macros.
You can use the following keys:
-
Ctrl + A – Ctrl + Z
-
F1–F9
-
Ctrl and Shift combinations of the function keys
Note: If you have assigned a shortcut key combination in Windows, you cannot use that combination in CADMATIC Draw. Windows has also reserved the F10 key as a hotkey for opening menus.
Show/hide example[KeyboardMenu]
"CTRL+Q", "^E^E'quit^#"
You only have to define the keys and key combinations that you want to use. The order of the rows does not matter.
-
-
Pointing device menu definitions
Pointing device menu definition starts with a section identifier [PointingdeviceMenu]. Each line represents a pointing device button or a combination of a pointing device button and a keyboard key. The keyboard menu file structure is the following:
"button", "command script"
For more information, see Command scripts and macros.
You can use the following buttons:
-
1...n
-
Function key
-
Ctrl and Shift combinations of the function keys
You cannot use button 0, which is the left mouse button. The mouse wheel (usually button 2) is reserved for zooming and panning. If you define functions for the wheel, you can access them by double-clicking the wheel.
Show/hide example[PointingdeviceMenu]
"SHIFT + 1", "|TEXTMENU CADS2^#BUTTON^#CURS^#"
"2", "^E"
In the above example, Shift + right-click is defined to open the text menu BUTTON, and double-clicking the wheel (button 2) is defined to correspond pressing Esc on the keyboard.
-
-
Icon menu definitions
An icon menu is a collection of graphical buttons. Each button starts a separate command script. You can open several icon menus on the screen at the same time. Most of the function menus are toolbars, but sometimes an icon menu is more suitable for the situation.
Icon menus are constructed of two files:
-
The actual menu file (MNU format)
-
An icon library file containing the icon graphics (VLB format)
An icon is a graphics format that is used to create icon menus. Draw the icon button face and save it in the icon format using the icon function. For more information, see Icon functions. You can save individual buttons in an icon library file (VLB format).
Also see Icon menus.
-
-
Text menu definitions
A text menu is structurally similar to an icon menu, but they look different. Text menus do not contain graphics, only text rows. When you select a text row, a command script that is defined for the row starts.
Text menu definition starts with a section identifier [TextMenu].
If the text menu has more lines than the program can display at one time, the program adds a scroll bar to the menu.
Open text menus using the Textmenu function. For more information, see Open text menus.
-
Itemdata – Command ID definitions
In the menus you can define a menu item that, instead of a command script, has only a command ID, which contains the actual command script and its tooltip string. You can also define information concerning the status of the menu item. Itemdata definition starts with a section identifier [Itemdata].
Command ID syntax is:
-
ID_command – Each command ID must have an individual code, which starts with a prefix ID_. It is advisable to use a descriptive name. Command IDs that start with a prefix IDCADS_ are internal IDs that cannot be modified.
-
"Infobar_tooltip_string\nTooltip_string" – Tooltip consists of two components separated by \n. The first component is displayed on the infobar and is usually longer. The second component is displayed beside the cursor.
-
Command="command script" – After the keyword Command= you define the actual command script that the item executes.
-
Checked=clause – After the keyword Checked= you define when the item is displayed as checked, i.e. toolbar button down. The clause is usually connected to a system variable. If the clause is TRUE, the item is displayed checked.
-
Gray= clause – After the keyword Gray= you define when the item is displayed as gray, i.e. disabled. The clause is usually connected to a system variable. If the clause is FALSE, the item is displayed gray.
Show/hide example 1ID_LINE "Draws a line\nDraw line"
Command="^E^Eline^&"
Show/hide example 2ID_GRID "Changes the grid settings\nChange grid settings"
Command="|'grid^#"
Checked=GRIDMODE
Command ID ID_GRID contains a checked clause GRIDMODE. When the value of the GRIDMODE system variable is other than 0 (=TRUE), the item is displayed checked (button down).
Show/hide example 3ID_FILTER "Sets filter\nSet filter"
Command="|'filter^#"
Checked=(FILTER&1)&(FILTER>1)
Command ID ID_FILTER contains a two-part checked clause. The first bit of the system variable FILTER must be 1 (= filter on) and the value must be greater than 1 (= some object type defined to the filter).
Show/hide example 4ID_VIEWPORTTILEDLIST "Lists saved viewport compositions\nList viewport compositions"
Command="|viewport ?^#"
Gray=TILEMODE
Command ID ID_ VIEWPORTTILEDLIST contains a gray clause TILEMODE. When the value of the TILEMODE system variable is 0 (=FALSE), the item is displayed gray (disabled).
-