From Xojo Documentation

For desktop applications, see PushButton.

Class (inherits from WebControl)

New in 2010r4

The standard button used for web apps. This control is implemented as a native browser control. You can alter its appearance by using a Style.

Action Hidden MouseMove
Close KeyPressed MouseUp
ContextualMenuAction LostFocus Open
DoubleClick MouseDown Resized
DropObject MouseEnter Shown
GotFocus MouseExit
AutoDisable HorizontalCenter Page fa-lock-32.png
Caption Left Parent fa-lock-32.png
ContextualMenu LockBottom Style
ControlID fa-lock-32.png LockHorizontal Top
Cursor LockLeft VerticalCenter
DragOverStyle LockRight Visible
Enabled LockTop Width
Height LockVertical Zindex
HelpTag Name fa-lock-32.png
AcceptPictureDrop AllowRawDataDrag MsgBox
AcceptRawDataDrop AllowTextDrag PresentContextualMenu
AcceptTextDrop Close SetFocus
AllowPictureDrag ExecuteJavaScript ShowURL


When the button is clicked, tapped or otherwise selected, the Action event handler is called.

You can completely alter the appearance of the button by creating a WebStyle with the appropriate properties and assigning it to the Style property of the button using the Layout Designer or in code.

Note that applying a WebStyle to a button will likely cause its default appearance to change. For example, buttons in Safari appear by default with rounded corners. If you apply a style to change the background, but do not specify the corner properties, then the button will appear as a rectangle in Safari.

Sample Code

This code changes the Caption of a button between Start/Stop when you click it:

If Button1.Caption = "Start" Then
Button1.Caption = "Stop"
Button1.Caption = "Start"
End If

See Also

WebSegmentedControl, WebToolbar, WebStyle classes; UserGuide:Web Button topic; PushButton desktop control