CommonCtrl.SliderBar
a slider bar control using a button and a container: both vertical and horizontal slider is provided
| Title |
a slider bar control using a button and a container: both vertical and horizontal slider is provided |
| Author(s) |
LiXizhi |
| Date |
|
| File |
script/ide/SliderBar.lua |
Description
Sample Code
NPL.load("(gl)script/ide/SliderBar.lua");
local ctl = CommonCtrl.SliderBar:new{
name = "SliderBar1",
alignment = "_lt",
left = 0,
top = 0,
width = 150,
height = 20,
parent = nil,
value = 50, -- current value
min = 0,
max = 100,
};
ctl:Show();
-- one can also call UpdateUI manually after setting the value property.
-- ctl:UpdateUI();
Member Functions
SliderBar:UpdateUI
Update UI according to the current value, min, and max. But it does not fire onchage event
syntax
function SliderBar:UpdateUI()
SliderBar:ValidateData
ensure value is in proper range and steps
syntax
function SliderBar:ValidateData()
SliderBar:SetValue
set value, validate it and update UI
syntax
function SliderBar:SetValue(value)
parameters
SliderBar:GetValue
return the correct value
syntax
function SliderBar:GetValue(value)
parameters
SliderBar:UpdateData
update date according to a given mouse position.
syntax
function SliderBar:UpdateData(mouse_x, mouse_y)
parameters
SliderBar:OnChange
called when the check button is pressed.
syntax
function SliderBar:OnChange()
Topic revision: r1 - 2008-02-29 - 15:26:12 -
LiXizhi