How To: Apply an icon to a button using Avenue
This article explains how to set the icon for a new button. An icon can be any size, but the IconMgr shows only those that are less than 24x24 pixels by default. The script below opens an Icon manager that displays icons of all sizes.
- Open a new script window A. Activate the Project window.
B. Click the Scripts icon.
C. Click New.
- Paste the following code into the new script window:
'-- Create a button and prompt the user to choose an icon for it
newButton = Button.Make
newButton.SetIcon(IconMgr.Show(0)) '<-- IconMgr.ShowWithDefault can be used as well
Refer to ArcView Help for more information on the class IconMgr and the requests ShowWithDefault or Show.
- Replace the text "Script" with the name of the scripts you would like to attach to the button.
- Select Compile from the Script menu or click the
- Click the
button to run the script.