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) {...}{.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 {...}{.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) {...}{.raises: [], tags: [].}
Set the margins between the bitmap and the text of the button.
proc setBitmapMargins(self: wButton; size: wSize) {...}{.inline, raises: [], tags: [].}
Set the margins between the bitmap and the text of the button.
proc getBitmapMargins(self: wButton): wSize {...}{.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) {...}{.
    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]) {...}{.inline, raises: [], tags: [].}
Set the margins between the bitmap and the text of the button.
proc getBitmap4Margins(self: wButton): tuple[left: int, top: int, right: int, bottom: int] {...}{.
    raises: [], tags: [].}
Get the margins between the bitmap and the text of the button.
proc setBitmap(self: wButton; bitmap: wBitmap; direction = -1) {...}{.raises: [wNilAccess],
    tags: [].}
Sets the bitmap to display in the button.
proc getBitmap(self: wButton): wBitmap {...}{.raises: [wBitmapError], tags: [].}
Return the bitmap shown by the button. Notice: it create a copy of the bitmap.
proc setIcon(self: wButton; icon: wIcon; direction = -1) {...}{.raises: [wNilAccess], tags: [].}
Sets the icon to display in the button.
proc getIcon(self: wButton): wIcon {...}{.raises: [wIconError], tags: [].}
Return the icon shown by the button. Notice: it create a copy of the icon.
proc setDefault(self: wButton; flag = true) {...}{.raises: [], tags: [].}
This sets the button to be the default item.
proc setDropdownMenu(self: wButton; menu: wMenu = nil) {...}{.raises: [], tags: [RootEffect].}
Sets a dropdown menu for a button, or nil to cancel it.
proc showDropdownMenu(self: wButton) {...}{.raises: [Exception, wNilAccess],
                                    tags: [RootEffect].}
Show a dropdown menu for a button.
proc click(self: wButton) {...}{.inline, raises: [], tags: [].}
Simulates the user clicking a button.
proc init(self: wButton; parent: wWindow; id = wDefaultID; label: string = "";
         pos = wDefaultPoint; size = wDefaultSize; style: wStyle = 0) {...}{.raises: [
    wNilAccess, wWindowError, wCursorError, wBrushError, Exception, IndexDefect,
    wFontError], tags: [RootEffect].}
Initializes a button.
proc Button(parent: wWindow; id = wDefaultID; label: string = ""; pos = wDefaultPoint;
           size = wDefaultSize; style: wStyle = 0): wButton {...}{.inline, discardable, raises: [
    wNilAccess, wWindowError, wCursorError, wBrushError, Exception, IndexDefect,
    wFontError], tags: [RootEffect].}
Constructor.

Methods

method getDefaultSize(self: wButton): wSize {...}{.raises: [], tags: [].}
Returns the default size for the control.
method getBestSize(self: wButton): wSize {...}{.raises: [], tags: [].}
Returns the best acceptable minimal size for the control.
method release(self: wButton) {...}{.raises: [], tags: [RootEffect].}
Release all the resources during destroying. Used internally.