From Xojo Documentation
Jump to: navigation, search

For web applications, see WebButton.

Class (inherits from RectControl)

A PushButton is the standard button used in desktop apps.

Action DropObject MouseExit
Close GotFocus MouseMove
ConstructContextualMenu KeyDown MouseUp
ContextualMenuAction KeyUp MouseWheel
DragEnter LostFocus Open
DragExit MouseDown
DragOver MouseEnter

Active ReadOnlyProperty.png Italic Scope ReadOnlyProperty.png
AutoDeactivate Left TabIndex
Bold LockBottom TabStop
ButtonStyle LockLeft TextFont
Cancel LockRight TextSize
Caption LockTop Top
Default MouseCursor Transparent
Enabled MouseX ReadOnlyProperty.png TrueWindow ReadOnlyProperty.png
Handle ReadOnlyProperty.png MouseY ReadOnlyProperty.png Underline
Height Name Visible
HelpTag PanelIndex Width
Index ReadOnlyProperty.png Parent Window ReadOnlyProperty.png

AcceptFileDrop Close RefreshRect
AcceptPictureDrop DrawInto RemoveActionNotificationReceiver
AcceptRawDataDrop Invalidate SetFocus
AcceptTextDrop Push
AddActionNotificationReceiver Refresh


To set an accelerator character, precede the character in the Caption with an ampersand. In order to show an ampersand in the Caption, use two ampersands in a row.

The PushButton's Caption property can show a caption that uses an encoding that doesn't match the application’s region code (or while running within the IDE, the IDE's region code). For example, an English application can set a Japanese caption, as long as it first sets the button's TextFont to Osaka.

If your Pushbutton has a height greater than 22 pixels, on macOS it will not have the standard rounded appearance and will instead be drawn as a square button. This is a restriction of macOS.

Linux and Pi Button Height

On Linux and Pi you may find that the button height is not large enough to fit the text. This is because some themes will drastically increase the default font size for buttons causing it to exceed the size of the button. There are a couple things you can do to fix this. In the Open event of the PushButton you can choose to make the button larger:

Me.Height = 32

Or you can choose to make its font smaller:

Me.TextSize = 10

The above numbers are for example. You will want to adjust them as appropriate for the theme being used.

See Also

BevelButton, SegmentedControl controls; RectControl class.

Personal tools

Starting Out
Dig Deeper
More Help