|
Introduction
Containers Layouts Widgets
|
Widgets -> buttonTo create a button, use the following syntax: $buttonName = button('Label' [, properties]);
Label refers to a string or text that will appear in the button. See table below for the list of properties. Here is an example of buttons. ![]() The snippet below shows how the above demo was created.
alias buttondemo {
# Create the main frame
$bframe = frame('Button Demo', 'size=310 220');
# 'Extract' the existing default panel from the frame
$fpanel = panel($bframe, 'layout=flow');
# Create the buttons
$b1 = button('Simple button');
$b2 = button('Button with icon', 'icon=icons/error.png');
$b3 = button('Button with custom font', 'font=14 Courier', 'fontstyle=BOLD ITALIC');
$b4 = button('Different color', 'bgcolor=GREEN');
# Add the buttons to the panel
addWidget($fpanel, $b1);
addWidget($fpanel, $b2);
addWidget($fpanel, $b3);
addWidget($fpanel, $b4);
show($bframe);
}
Hint: It is possible to use HTML tags as the button label/text. However, it is limited to HTML 3.2 only. Below is an example:
$b = button('<html><p>This is a button with<br>two lines of text</p></html>');
Properties
These properties are optional and can be in any order. Related commands and functions
|