Customizing Toolbars(part III)
 
This article reviews the creation of custom toobar buttons.
Part I reviews the modification of existing toolbars.
Part II reviews the creation of new toolbars.
Copyright©2000-2007 ActiveDwg.com

Creating custom toolbar buttons provides you the ability to access your own commands or macros with single click ease. Although it is a bit more involved than modifying existing toolbars or creating new toolbars, it is well worth the effort.
The first four steps are the same as Parts I & II.

First, right click on any toolbar on your screen:


Now, select 'Customize':


This will bring up the 'Toolbars' dialog. Note the 'Show Tooltips' checkbox is marked. Now click on the  'Customize...' button:


This will bring up the 'Customize Toolbars' dialog:


Now, click on the 'Categories' drop down and select 'Custom':



Now, click on and drag a blank button and drop it onto a toolbar (or create a new one):





Right  click on the blank button:


You will be presented with the 'Button Properties' Dialog. Note the various fields in this dialog. The 'Name' field will display as a 'tool tip' when the pointer hovers above the button. The 'Help' field will display in AutoCAD's status bar (in the lower left corner of AutoCAD's main window) when the pointer hovers above the button. The 'Macro' field contains the command or sequence of commands that will be sent to the AutoCAD command line when the button is clicked. First we will add an icon to for the button, so click on the 'Edit' button in the lower right of the dialog:


This will present you with the 'Button Editor':


The editor allows you to create a new icon from scratch or import / modify an existing icon. In our example, we'll be using an pre-existing icon for our 'ad_PlotLayouts' VBA macro. So we select 'Open', navigate to the bitmap image, select it, and open it:


Click 'Save' to associate the icon with the button, click 'Close', and you are returned to the 'Button Properties' dialog. Fill in the 'Name' and 'Help' fields, and next we'll look at the 'Macro' field:


The 'Macro' field can contain any valid AutoCAD command or command combination. This includes internal commands and custom VBA or Lisp macros. For a command sequence requiring several components, either a semicolon or space is used to represent a keyboard 'Return' or 'Enter'. We prefer the semicolon simply because it is visible. For example, a macro to execute a Zoom Extents would appear in the 'Macro' field as: Zoom;E; .
In our example we'll be 'demand loading' our VBA macro(that will be the subject of a future article). Fill in the 'Macro' field and click 'Apply':


Now close the 'Button Properties' dialog by clicking the 'Close Window' button:


Now close out the 'Customize' and 'Toolbar' dialogs and you have your custom button: