---++!! !CommonCtrl.colorpicker %TOC{title="Contents:"}% %STARTINCLUDE% ---++ color-picker control | *Title* | color-picker control | | *Author(s)* | LiXizhi | | *Date* | 2008/6/8 | | *File* | script/ide/colorpicker.lua | ---+++ Description CommonCtrl.ColorPicker displays a color edit control with 3 sliderbars to adjust R,G,B value %T% __Sample Code__ <verbatim> NPL.load("(gl)script/ide/colorpicker.lua"); local ctl = CommonCtrl.ColorPicker:new({ name = "coloredit", r = 255, g = 255, b = 255, left = 0, top = 0, width = 182, height = 72, parent = nil, onchange = nil, background = nil, }); ctl:Show(); </verbatim> ---+++ Member Functions ---++++ !ColorPicker:new <verbatim> define a new control in the common control libary default member attributes local ColorPicker = { -- normal window size alignment = "_lt", left = 0, top = 0, width = 182, height = 72, r = 255, g = 255, b = 255, -- container background, default to nil. background = nil, -- parent UI object, nil will attach to root. parent = nil, -- the top level control name name = "defaultcoloredit", -- onchange event, it can be nil, a string to be executed or a function of type void ()(sCtrlName, r,g,b) onchange= nil }</verbatim> CommonCtrl.ColorPicker = ColorPicker; constructor __syntax__ <verbatim>function ColorPicker:new (o)</verbatim> __parameters__ | *o* | | ---++++ !ColorPicker:Destroy Destroy the UI control __syntax__ <verbatim>function ColorPicker:Destroy ()</verbatim> ---++++ !ColorPicker:SetRGB set/get the rgb of the control. __syntax__ <verbatim>function ColorPicker:SetRGB(r,g,b)</verbatim> __parameters__ | *r* | | | *g* | | | *b* | | ---++++ !ColorPicker:SetRGBString set/get the rgb of the control. such as "255 255 255" * _param_ __silent__ : if true, no onchange or UI update is called. __syntax__ <verbatim>function ColorPicker:SetRGBString(rgb, silent)</verbatim> __parameters__ | *rgb* | | | *silent* | if true, no onchange or UI update is called. | ---++++ !ColorPicker:GetRGBString * _return_ __color__ : such as "255 255 255" __syntax__ <verbatim>function ColorPicker:GetRGBString()</verbatim> __parameters__ | *return* | such as "255 255 255" | ---++++ !ColorPicker:SetValue * _param_ __value__ : such as "255 255 255" or "#FFFFFF" * _param_ __silent__ : if true, no onchange or UI update is called. __syntax__ <verbatim>function ColorPicker:SetValue(color, silent)</verbatim> __parameters__ | *color* | | | *silent* | | ---++++ !ColorPicker:GetValue * _return_ __color__ : such as "255 255 255" __syntax__ <verbatim>function ColorPicker:GetValue()</verbatim> __parameters__ | *return* | such as "255 255 255" | ---++++ !ColorPicker.Update [[ update the r,g,b, values from the control. * _param_ __sCtrlName__ : if nil, the current control will be used. if not the given control is updated. ]] __syntax__ <verbatim>function ColorPicker.Update(sCtrlName)</verbatim> __parameters__ | *sCtrlName* | if nil, the current control will be used. if not the given control is updated. ]] | %STOPINCLUDE%
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2008-02-29
-
LiXizhi
Home
Site map
CCWeb web
HaqiTeen web
Main web
ParaEngine web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
导航页WebTopMenu
Preferences
开发指南
Getting Started
ParacraftSDK
NPL
MCML
NPL Reference Manual
美术Mod
Account
Log In
English
简体中文
簡體中文
E
dit
A
ttach
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback