Create Status-Line Help for Menu Items and Toolbar Items

AutoCAD ActiveX

 
Create Status-Line Help for Menu Items and Toolbar Items
 
 
 

Status-line help messages are an important aspect of native help support. These are the simple, descriptive messages that appear in the status line when a menu or toolbar item is highlighted. The status-line help for all menu and toolbar items is contained in the HelpString property for that item.

The HelpString property is empty when the menu or toolbar item is first created.

Add status-line help to a menu item

This example creates a new menu called “TestMenu” and then creates a menu item called “Open.” The menu item is then assigned status-line help with the HelpString property.

Sub Ch6_AddHelp()
 Dim currMenuGroup As AcadMenuGroup
 Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)
      
 ' Create the new menu
 Dim newMenu As AcadPopupMenu
 Set newMenu = currMenuGroup.Menus.Add _
 ("Te" + Chr(Asc("&")) + "stMenu")
      
 ' Add a menu item to the new menu
 Dim newMenuItem As AcadPopupMenuItem
 Dim openMacro As String
 ' Assign the macro the VBA equivalent of "ESC ESC _open "
 openMacro = Chr(3) + Chr(3) + "_open "
      
      
 ' Create the menu item
 Set newMenuItem = newMenu.AddMenuItem _
 (newMenu.count + 1, Chr(Asc("&")) _
 + "Open", openMacro)
      
 ' Add the status line help to the menu item
 newMenuItem.HelpString = "Opens an AutoCAD drawing file."
      
 ' Display the menu on the menu bar
 newMenu.InsertInMenuBar _
 (ThisDrawing.Application.menuBar.count + 1)
End Sub