wButton

A button is a control that contains a text string, and is one of the most common elements of a GUI.

Appearance:
Superclass:wControl
Styles:
StylesDescription
wBuLeftLeft-justifies the label.
wBuTopAligns the label to the top of the button.
wBuRightRight-justifies the bitmap label.
wBuBottomAligns the label to the bottom of the button.
wBuNoBorderCreates a button without border.
Events:wCommandEvent
wCommandEventDescription
wEvent_ButtonThe button is clicked.
wEvent_ButtonEnterThe mouse is entering the button.
wEvent_ButtonLeaveThe mouse is leaving the button.

Consts

wBuLeft = 0x00000100
wBuTop = 0x00000400
wBuRight = 0x00000200
wBuBottom = 0x00000800
wBuNoBorder = 0x00008000

Procs

proc setBitmapPosition(self: wButton; direction: int) {...}{.validate, property, raises: [],
    tags: [].}
Set the position at which the bitmap is displayed. Direction can be one of wLeft, wRight, wTop, wBottom, or wCenter.
proc getBitmapPosition(self: wButton): int {...}{.validate, property, raises: [], tags: [].}
Get the position at which the bitmap is displayed. Returned direction can be one of wLeft, wRight, wTop, wBottom, or wCenter.
proc setBitmapMargins(self: wButton; x: int; y: int) {...}{.validate, property, raises: [],
    tags: [].}
Set the margins between the bitmap and the text of the button.
proc setBitmapMargins(self: wButton; size: wSize) {...}{.validate, property, inline,
    raises: [], tags: [].}
Set the margins between the bitmap and the text of the button.
proc getBitmapMargins(self: wButton): wSize {...}{.validate, property, raises: [], tags: [].}
Get the margins between the bitmap and the text of the button.
proc setBitmap4Margins(self: wButton; left: int; top: int; right: int; bottom: int) {...}{.
    validate, property, raises: [], tags: [].}
Set the margins between the bitmap and the text of the button.
proc setBitmap4Margins(self: wButton; margins: tuple[left: int, top: int, right: int,
    bottom: int]) {...}{.validate, property, inline, raises: [], tags: [].}
Set the margins between the bitmap and the text of the button. Get the margins between the bitmap and the text of the button.
proc setBitmap(self: wButton; bitmap: wBitmap; direction = -1) {...}{.validate, property,
    raises: [], tags: [].}
Sets the bitmap to display in the button.
proc getBitmap(self: wButton): wBitmap {...}{.validate, property, raises: [], tags: [].}
Return the bitmap shown by the button. Notice: it create a copy of the bitmap.
proc setIcon(self: wButton; icon: wIcon; direction = -1) {...}{.validate, property, raises: [],
    tags: [].}
Sets the icon to display in the button.
proc getIcon(self: wButton): wIcon {...}{.validate, property, raises: [], tags: [].}
Return the icon shown by the button. Notice: it create a copy of the icon.
proc setDefault(self: wButton; flag = true) {...}{.validate, property, raises: [], tags: [].}
This sets the button to be the default item.
proc setDropdownMenu(self: wButton; menu: wMenu = nil) {...}{.validate, property, raises: [],
    tags: [].}
Sets a dropdown menu for a button, or nil to cancel it.
proc showDropdownMenu(self: wButton) {...}{.validate, raises: [], tags: [].}
Show a dropdown menu for a button.
proc click(self: wButton) {...}{.validate, inline, raises: [], tags: [].}
Simulates the user clicking a button.
proc final(self: wButton) {...}{.raises: [], tags: [].}
Default finalizer for wButton.
proc init(self: wButton; parent: wWindow; id = wDefaultID; label: string = "";
         pos = wDefaultPoint; size = wDefaultSize; style: wStyle = 0) {...}{.validate,
    raises: [], tags: [].}
Initializer.
proc Button(parent: wWindow; id = wDefaultID; label: string = ""; pos = wDefaultPoint;
           size = wDefaultSize; style: wStyle = 0): wButton {...}{.inline, discardable,
    raises: [], tags: [].}
Constructor, creating and showing a button.

Methods

method getDefaultSize(self: wButton): wSize {...}{.property, raises: [], tags: [].}
Returns the default size for the control.
method getBestSize(self: wButton): wSize {...}{.property, raises: [], tags: [].}
Returns the best acceptable minimal size for the control.