CommandButton                                                      Object

ADDOBJECT "CommandButton", name, xpos, ypos,

                width, height

Description

CommandButton is used to display a standard button object in the output window. The required component, name, is the name of a variable that is added to the program to reference the object, it must follow standard variable naming conventions. The required components, xpos, ypos, width, and height are numeric expressions that set the location and size of the object in pixels, measured from the upper left corner of the output window.

Setting the property Value to 1 toggles the button, fires the click event, and sets the value back to 0.

Properties Supported (see "Properties")

BackColor, Caption, Default, Enabled, FontBold, FontItalic, FontName, FontSize, FontStrikethru, FontUnderline, ForeColor, Height, Hwnd, Left, Name, ParentHWnd, TabStop, Tag, Text, Timer, Top, Visible, Width, WindowLong, Value

Methods Supported (see "Methods")

Hide, Move, SetFocus, Show

Events Supported (see "Events")

Click, DblClick, GotFocus, KeyDown, KeyPress, KeyUp, LostFocus, Timer

Example

REM CommandButton Example

'CommandButton is a standard button object

ADDOBJECT "CommandButton", "Button", _

  100, 10, 80, 20

Button.BackColor = Output.BackColor

Button.Text = "Click Me!"

Output.

BackColor = vbWHITE

SUB Button_Click

  PRINT "Button clicked"

  KillFocus

END SUB

Output

Related Items

ADDOBJECT, Events, Methods, Properties