CommonCtrl.RadioBox
a RadioBox control using a button and a text; automatically group radio buttons by parent.
| Title |
a RadioBox control using a button and a text; automatically group radio buttons by parent. |
| Author(s) |
LiXizhi |
| Date |
|
| File |
script/ide/RadioBox.lua |
Description
Sample Code
NPL.load("(gl)script/ide/RadioBox.lua");
local ctl = CommonCtrl.radiobox:new{
name = "radiobox1",
alignment = "_lt",
left = 0,
top = 0,
width = 150,
height = 26,
parent = nil,
isChecked = false,
text = "check box",
};
ctl:Show();
-- call later on
ctl:GetCheck();
ctl:SetCheck(true);
-- alternatively call following by any radiobox in a group
ctl:SetSelectedIndex(index);
ctl:GetSelectedIndex();
Member Functions
CommonCtrl.radiobuttonGroups.AddRadioboxToGroup
for group management
groupinfo, contains the {<parentName, {
, true}>}
CommonCtrl.radiobuttonGroups = {};
return the group object and the index of this radio starting from 1.
syntax
function CommonCtrl.radiobuttonGroups.AddRadioboxToGroup(radioboxname, groupname)
parameters
radiobox:new
for radiobox group
syntax
function radiobox:new (o)
parameters
radiobox:GetCheck
get the isChecked property
syntax
function radiobox:GetCheck()
radiobox:SetCheck
set the check property
syntax
function radiobox:SetCheck(bChecked)
parameters
radiobox:SetText
set the text property
syntax
function radiobox:SetText(text)
parameters
radiobox.OnCheck
called when the check button is pressed.
syntax
function radiobox.OnCheck(ctrName)
parameters
radiobox:GetSelectedIndex
return the index of the current selected radio box in the group.
syntax
function radiobox:GetSelectedIndex()
radiobox:SetSelectedIndex
set a radio button by its index.
syntax
function radiobox:SetSelectedIndex(index)
parameters
Topic revision: r1 - 2008-02-29 - 15:26:12 -
LiXizhi