Programming with Reflection
InsertPopupItem method
Syntax object.InsertPopupItem ItemType, Popup, Item, Name, Description, Commands
Adds a new menu popup or a new menu item to the existing menu display.
A popup is a menu title (for example, File and Edit on the default menu bar.) A popup results in the display of one or more additional menu choices. You can add new popups to the main menu bar to add new drop-down menus, or you can add popups within existing drop-down menus to create cascading menus. (For an example of a cascading menu, see the Trace menu that appears under the default Connection menu).
An item opens a dialog box or invokes a Reflection command (for example, New Session and Exit on the default File menu). Like popups, items can be added directly to the main menu or can be added to the list of elements in an existing drop-down menu list.
This command creates a new menu popup called New Menu at the end of the main menu:
Session.InsertPopupItem rcUserDefinedPopup, rcMainMenu, _
rcLastItem, "New Menu", "This is a new menu", ""
This command adds an item to the end of the last popup menu. The item label is New Item and the action is opening the About dialog box:
Session.InsertPopupItem rcUserDefinedItem, rcLastPopup, _
rcLastItem, "New Item","Display About box", ".AboutReflectionDlg"
ItemType Argument type: Enumeration
Specifies what to add to the menu setup. This can be a user-defined popup, a user-defined item, a separator, or any one of the predefined, default menu popups or items.
rcUserDefinedPopup
Inserts a new, user-defined Popup. Specify a name with the Name argument. You may also specify a Description, or use an empty string for this argument. Use an empty string for ("") for commands; this argument is not relevant for Popup items.
rcUserDefinedItem
Inserts a new, user-defined item. Specify a name with the Name argument. You may also specify a Description, or use an empty string for this argument. Specify the command to invoke using the Command argument.
rcSeparatorItem
Inserts a line separating menu elements in a drop-down menu list. This value is not valid if the value of the Popup argument is rcMainMenu. Use an empty string ("") for the Name, Description, and Commands arguments; these arguments are not relevant for separators.
Note: The remaining values for this argument create predefined menu elements. These values are used to create the default Reflection menus. Note that these menu elements create shortcut keystrokes (for example Alt+F for the File menu). If you use a predefined popup or item, use an empty string("") for the Name, Description, and Commands arguments; these arguments are not relevant for predefined menu elements.
rcFilePopup
Creates a new File popup. These values create the individual menu items that appear under the default File menu:
rcNewSessionDlgItem
rcOpenSettingsDlgItem
rcSaveSettingsDlgItem
rcSaveSettingsAsDlgItem
rcSaveDisplayDlgItem
rcTransferDlgItem
rcPrintDlgItem
rcPrintSetupDlgItem
rcClosePrinterItem
rcSendMailDlgItem
rcExitItem
rcEditPopup
Creates a new Edit popup. These values create the individual menu items that appear under the default Edit menu:
rcCutSelectionItem
rcCopySelectionItem
rcAppendItem
rcPasteItem
rcPasteNextItem
rcUseTableFormatItem
rcPasteRangeItem
rcCopyPasteSettingsDlgItem
rcClearItem
rcSelectAllItem
rcSessionPopup
Creates a new Connection popup. These values create the individual menu items that appear under the default Connection menu:
rcSessionSetupDlgItem
rcConnectItem
rcDisconnectItem
rcTracePopup
Creates a new Trace popup. These values create the individual menu items that appear under the default Trace menu:
rcStartTraceDlgItem
rcPlayBackTraceDlgItem
rcStopTraceItem
rcSetupPopup
Creates a new Setup popup. These values create the individual menu items that appear under the default Setup menu:
rcTerminalSetupDlgItem
rcDisplaySetupDlgItem
rcEventSetupDlgItem
rcFileTransferSetupDlgItem
rcHotlistSetupDlgItem
rcHotspotSetupDlgItem
rcKeyboardSetupDlgItem
rcMenuSetupDlgItem
rcMouseSetupDlgItem
rcToolbarSetupDlgItem
rcPreferencesSetupDlgItem
rcViewSettingsDlgItem
rcDDESetupDlgItem
rcRestoreDefaultsItem
rcScriptPopup
Creates a new Macro popup. These values create the individual menu items that appear under the Macro menu:
rcMacrosDlgItem
rcStartRecordingItem
rcStopRecordingDlgItem
rcStopMacroItem
rcWindowPopup
rcVBAEditorItem
rcRecordingSetupDlgItem
rcHelpPopup
Creates a new Window popup. These values create the individual menu items that appear under the default Window menu:
rcToggleToolbarItem
rcToggleKeypadItem
rcNextWindowItem
rcPrevWindowItem
rcWindowPopup
Creates a new Help popup. These values create the individual menu items that appear under the default Help menu:
rcHelpTopicsItem
rcHelpSearchTopicItem
rcHelpTechSupportItem
rcAboutReflectionDlgItem
rcAdditionalItemsPopup
Creates a new Script popup. These values create the individual menu items that appear under the Script menu:
rcRunScriptDlgItem
rcEditScriptDlgItem
Popup Argument type: Integer or Enumeration
Specifies in which menu a new popup or item will appear. If you want to add a new menu element to an existing drop-down menu, use an integer value to specify which menu. (For example, use 1 to specify the File menu, or 2 to specify the Edit menu in the default menu bar.) Use rcLastPopup to add it to the last menu on the bar.
Use rcMainMenu if you 're adding a new menu popup and you want to add it to the main menu bar.
Item Argument type: Integer or Enumeration
Specifies where a popup, item, or separator should appear within an existing menu. Use an integer value to specify a specific location within the list (first, second, and so on). Use rcLastItem to add the new menu element after the last existing element in the menu. Use the Popup argument to specify which menu.
Name Argument type: String
The name of the Popup or Item as it will appear in the menu. This string can be up to 40 characters long.
Description Argument type: String
A description of the Popup or Item that appears on the status line when that menu element is selected. This string can be up to 120 characters long.
Commands Argument type: String
The Reflection method, or sequence of methods, to be executed when the new item is selected. Methods that return values can't be used. Use a space to separate multiple methods. Use double quotation marks around string arguments. For example, the following strings are all valid for this argument:
"Connect"
"TransmitAnsi ""Hello"" TransmitTerminalKey rcIBMEnterKey"
"RunMacro ""MyMacro"", """""
This string can be up to 260 characters long.