PEDN> Main Web>NPL>RadioBox (2008-02-29, LiXizhi) Change language en zh-cn? EditAttach

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

TIP 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

radioboxname  
groupname  

radiobox:new


for radiobox group

syntax

function radiobox:new (o)

parameters

o  

radiobox:GetCheck

get the isChecked property

syntax

function radiobox:GetCheck()

radiobox:SetCheck

set the check property

syntax

function radiobox:SetCheck(bChecked)

parameters

bChecked  

radiobox:SetText

set the text property

syntax

function radiobox:SetText(text)

parameters

text  

radiobox.OnCheck

called when the check button is pressed.

syntax

function radiobox.OnCheck(ctrName)

parameters

ctrName  

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

index  
Topic revision: r1 - 2008-02-29 - 15:26:12 - LiXizhi
 

ParaEngine Developer Network

This site is powered by the TWiki collaboration platformCopyright © 2004-2009 ParaEngine Corporation
Ideas, requests, problems regarding ParaEngine platform Send feedback