Caption
Text of the item. & marks the access key that Windows underlines; macOS hides it, and && shows one &. A Caption of - (one hyphen) makes a separator line.
Rebuild a Classic application with Menu Editor actions, runtime control arrays, control dragging, Type value copies, class initialization and Sub Main.
Create the layout below first. In Design → Menu Editor, add Actions as a title; indent Show details and Clear status underneath it. Name them mnuActions, mnuDetails and mnuClear; set Show details Checked True and Shortcut Ctrl+D. Parent values in the JSON are item IDs, not BASIC names. Give txtCell Index 0 and Dock None: it is the design-time template. DragMode 1 on lblToken is the automatic control-drag source; pnlDrop uses the Source As Control overload, not DragData. Project Settings selects Classic; Startup Object selects Sub Main. Add modStart, SessionCounter and WorkbenchTests before replacing their full source files below. The Boolean mLoaded prevents duplicate Load and missing Unload. Only the newly loaded member is removed; the original template remains. The record test distinguishes copied values (79) from shared identity, while two class instances keep separate counters.
Add MenuItem to the component tray and name it mnuActions for this example:
| Property | Example value |
|---|---|
Caption | "&Actions" |
Order | 0 |
Use the full lesson for the owner’s initialization code and its complete layout.
Contract defaults are shown below. Where a new control has a different Designer starting value, that value is listed separately.
CaptionText of the item. & marks the access key that Windows underlines; macOS hides it, and && shows one &. A Caption of - (one hyphen) makes a separator line.
ShortcutKey combination that chooses the item while its form is active: None, Ctrl+A to Ctrl+Z, F1 to F12, Ctrl+F1, Shift+F1 or Shift+Ctrl+F1 to F12, Ctrl+Ins, Shift+Ins, Del, Shift+Del or Alt+Bksp. On macOS Ctrl is the Command key. A menu title and a separator have none. Read-only in code.
CheckedShows a check mark beside the item. Choosing the item does not change it; set it in the Click handler.
EnabledWhether the item can be chosen. False greys the item and every item under it; their Click and Shortcut do nothing.
VisibleWhether the item is shown. False hides the item and every item under it. A hidden menu title still opens with PopupMenu.
WindowListOn a menu title, lists the open windows (the child forms of an MDIForm) after the title's own items. At most one title per form. Read-only in code.
ParentThe id of the menu item this item sits under; empty for a menu title on the menu bar. Menus have at most 5 levels. Set by the Menu Editor.
OrderPosition among the items with the same Parent, lowest first; equal values keep their order in the layout. Set by the Menu Editor.
Range: 0 to 32767.
IndexPosition of this item in its menu control array, 0 to 32767. Several menu items share one name only when every one of them has an Index. Absent from the layout, and -1 in code, when the item is not in an array.
Designer values: 0 to 32767. Clear the dedicated Index row for a non-array control; BASIC then reads -1.
Replace control with the object’s Name when creating a handler. ByRef arguments may be changed by your handler; ByVal arguments report an input value.
Occurs when the user chooses the item from the menu bar, a pop-up menu or its Shortcut. Disabled or hidden items, and the items under them, never raise it.
Private Sub control_Click()No parameters.
No methods are declared in this component’s built-in metadata. Use its documented properties and events; do not infer APIs from a similarly named control in another framework.
20f4bfed6b · Build manifestOriginal web explanation, reviewed against these repository sources. API tables and example files follow the implementation.
src/McBasic.Workspace/MenuRules.cssrc/McBasic.Workspace/MenuShortcuts.csmacos/McBasicIDE/Sources/MenuEditorWindow.swifttests/McBasic.Compiler.Tests/MenuCompilerChecks.cstests/McBasic.Compiler.Tests/PopupMenuChecks.cs