CreateButton

Creates a button on the screen.

Syntax:

<CreateButton name x y width height [text]>

Parameters

  • Name is the name of the button.

  • X is the horizontal screen coordinate of the window’s upper left corner.

  • Y is the vertical screen coordinate of the window’s upper left corner.

  • Width is the window’s width.

  • Height is the window’s height.

  • Text is the caption that appears on the button.

Remarks

The program has three button styles. This command creates the system style. You can create the other styles with CreateColoredButton and CreatePictureButton.

To assign a hotkey to a button, use SetButtonHotkey.

To assign a command to a button, use SetButtonCommand.

To change a button’s style from system to colored or vice versa, use SetButtonStyle.

To move a button, use TargetButton and SetWinPos or SetWinRect.

To change a button’s size, use TargetButton and SetWinSize or SetWinRect.

To change a button’s text, use SetButtonText.

To change a button’s colors, use SetButtonColors.

To hide a button, use TargetButton and HideWin.

To redisplay a hidden button, use TargetButton and ShowWin.

To create a group of buttons that you move as a unit, use CreatePanel.

To add a button to a panel, use AddButtonToPanel.

To display a list of all your buttons and panels, use ListButtons.

Use AutoExec

You should create all your buttons and panels in an AutoExec command that executes automatically when the script loads.

Destroying a button

Buttons get destroyed when you load or unload a script.

Example

<Command AutoExec>

<CreateButton Button1 100 100 50 50 On>

Related topics