---++!! !CommonCtrl %TOC{title="Contents:"}% %STARTINCLUDE% ---++ common control shared lib | *Title* | common control shared lib | | *Author(s)* | LiXizhi | | *Date* | 2006/5/29 | | *File* | script/ide/common_control.lua | ---+++ Description %T% __Sample Code__ <verbatim> NPL.load("(gl)script/ide/common_control.lua"); </verbatim> ---+++ Member Functions ---++++ !CommonCtrl.AddControl [[common control library]] if(not CommonCtrl) then CommonCtrl={}; end if(not CommonCtrl.allcontrols) then CommonCtrl.allcontrols={}; end [[add a new global control]] __syntax__ <verbatim>function CommonCtrl.AddControl(sControlName,ctl)</verbatim> __parameters__ | *sControlName* | | | *ctl* | | ---++++ !CommonCtrl.DeleteControl [[destroy and delete a global control. It will call the controll's Destroy() method if it exists]] __syntax__ <verbatim>function CommonCtrl.DeleteControl(sControlName)</verbatim> __parameters__ | *sControlName* | | ---++++ !CommonCtrl.GetControl [[ get control by name. return nil if control not found]] __syntax__ <verbatim>function CommonCtrl.GetControl(sControlName)</verbatim> __parameters__ | *sControlName* | | ---++++ !CommonCtrl.NewSubControlName in case, CommonCtrl.NewSubControlName's parentCtl is nil, this table ctl is used. CommonCtrl.DefaultNameCtl = {name = "gCtrl"}; create a new unqiue sub control name based on the parent ctl object. usually used for controls like tree view that needs to dynamically create a large number of sub controls whose name needs to unique however, creating a unique name each sub control will pollute the global environment. Using CommonCtrl.NewSubControlName and CommonCtrl.ReleaseSubControlName to generate control names will reuse control names as much as possible while ensuring that all visible control names are unique. * _param_ __parentCtl__ : the parent control object. If nil, a global unnamed table is used. * _return_ ____ : a unique name is returned. the name is (parentCtl.name or parentCtl.Name).."."..nNextEmptyIndex __syntax__ <verbatim>function CommonCtrl.NewSubControlName(parentCtl) </verbatim> __parameters__ | *parentCtl* | the parent control object. If nil, a global unnamed table is used. | ---++++ !CommonCtrl.ReleaseSubControlName when a sub control is not used, one needs to explicitly call this function to make its name reusable by newly created controls later on. * _param_ __parentCtl__ : the parent control object. * _param_ __subCtlName__ : the sub control name. __syntax__ <verbatim>function CommonCtrl.ReleaseSubControlName(parentCtl, subCtlName)</verbatim> __parameters__ | *parentCtl* | the parent control object. | | *subCtlName* | | ---++++ !CommonCtrl.DeleteAllSubControls delete all sub controls, whose name is created by CommonCtrl.NewSubControlName. Usually used by TreeView class during update. __syntax__ <verbatim>function CommonCtrl.DeleteAllSubControls(parentCtl)</verbatim> __parameters__ | *parentCtl* | | %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