---++!! !_guihelper.MessageBox %TOC{title="Contents:"}% %STARTINCLUDE% ---++ Default message box and dialog box | *Title* | Default message box and dialog box | | *Author(s)* | LiXizhi | | *Date* | 2005/10, revised 2008.5.8 | | *File* | script/ide/MessageBox.lua | ---+++ Description ---+++ Member Functions ---++++ !_guihelper.MessageBox <verbatim>--------------------------------------------------------------- message box (top level) --------------------------------------------------------------- the dialog background to used. if nil, it will be the default container background. _guihelper.MessageBox_BG = nil; how a message box is poped up. if nil, it is just displayed as a top level window. If 1, it will gradually grey out the background and pops up with an animation. If 2, it will grey out the background and pops up WITHOUT animations. _guihelper.MessageBox_PopupStyle = 1; Specifies constants defining which buttons to display on a MessageBox. _guihelper.MessageBoxButtons = { --The message box contains Abort, Retry, and Ignore buttons. AbortRetryIgnore = 1, -- The message box contains an OK button. OK = 2, -- The message box contains OK and Cancel buttons. OKCancel = 3, -- The message box contains Retry and Cancel buttons. RetryCancel = 4, -- The message box contains Yes and No buttons. YesNo = 5, -- The message box contains Yes, No, and Cancel buttons. YesNoCancel = 6, -- The message box contains no buttons at all. This is useful when displaying system generated message sequence -- Used in Aquarius login procedure Nothing = 7, }; Specifies identifiers to indicate the return value of a dialog box. _guihelper.DialogResult = { -- The dialog box return value is Abort (usually sent from a button labeled Abort). Abort = 1, -- The dialog box return value is Cancel (usually sent from a button labeled Cancel). Cancel = 2, -- The dialog box return value is Ignore (usually sent from a button labeled Ignore). Ignore = 3, -- The dialog box return value is No (usually sent from a button labeled No). No = 4, -- Nothing is returned from the dialog box. This means that the modal dialog continues running. None = 5, -- The dialog box return value is OK (usually sent from a button labeled OK). OK = 6, -- The dialog box return value is Retry (usually sent from a button labeled Retry). Retry = 7, -- The dialog box return value is Yes (usually sent from a button labeled Yes). Yes = 8, }; Specifies constants defining which information to display. _guihelper.MessageBoxIcon = { -- The message box contains a symbol consisting of a lowercase letter i in a circle. Asterisk = 1, -- The message box contains a symbol consisting of white X in a circle with a red background. Error = 2, -- The message box contains a symbol consisting of an exclamation point in a triangle with a yellow background. Exclamation = 3, -- The message box contains a symbol consisting of a white X in a circle with a red background. Hand = 4, -- The message box contains a symbol consisting of a lowercase letter i in a circle. Information = 5, -- The message box contain no symbols. None = 6, -- The message box contains a symbol consisting of a question mark in a circle. Question = 7, -- The message box contains a symbol consisting of white X in a circle with a red background. Stop = 8, -- The message box contains a symbol consisting of an exclamation point in a triangle with a yellow background. Warning = 9, }</verbatim>; [[display a simple message box. Contents in previous displayed box will be appended to the new one * _param_ __content__ : string: the text to be displayed * _param_ __MsgBoxClick__ :_CallBack: [optional] string or function or nil; the script or function to be executed when user clicked OK or Yes. if it is a function, the first input will be _guihelper.DialogResult * _param_ __buttons__ : [optional] type of _guihelper.MessageBoxButtons * _param_ __icon__ : [optional] type of _guihelper.MessageBoxIcon ]] __syntax__ <verbatim>function _guihelper.MessageBox(content,MsgBoxClick_CallBack, buttons, icon)</verbatim> __parameters__ | *content* | string: the text to be displayed | | *MsgBoxClick* | | | *CallBack* | | | *buttons* | [optional] type of _guihelper.MessageBoxButtons | | *icon* | | ---++++ !_guihelper.CloseMessageBox close the messagebox slightly. __syntax__ <verbatim>function _guihelper.CloseMessageBox()</verbatim> ---++++ !_guihelper.OnMessageBoxClick message box call back. __syntax__ <verbatim>function _guihelper.OnMessageBoxClick(dialogResult)</verbatim> __parameters__ | *dialogResult* | | ---++++ !_guihelper.ShowDialogBox --------------------------------------------------------------- dialog box (top level) --------------------------------------------------------------- [[ display a top level dialog. Use windows.dialog for advanced dialog. this function is only for displaying a very simple (usually databinding) dialog control. * _param_ __title__ : string of title text or nil. * _param_ __x__ :,y,width, height: position and size of the client area of the dialog. if x,y is nil, it is displayed at the center of the screen. * _param_ __ShowUI__ :_func: function (_parent) end. this function is called to create UIs in the dialog but excluding the OK|cancel buttons. UI created in it will be automatically destroyed when dialog closes. * _param_ __OnClick__ :_CallBack: [optional] function (dialogResult) end or the function name string. The first input will be _guihelper.DialogResult.This function will be called when the dialog returns but before UI is destoryed. If function returns true, the dialog will be closed; otherwise dialog is not closed. * _param_ __buttons__ :; [optional] type of _guihelper.MessageBoxButtons e.g. function SomeFunctionToCreateUIToGetherData() local package = Map3DSystem.App.Assets.CreatePackage({text="鏈懡鍚嶈祫婧愬寘"}); local bindingContext = commonlib.BindingContext:new(); bindingContext:AddBinding(package, "text", "AssetManager.NewAsset#packageName", commonlib.Binding.ControlTypes.ParaUI_editbox, "text") bindingContext:AddBinding(package, "icon", "AssetManager.NewAsset#textBoxIconPath", commonlib.Binding.ControlTypes.ParaUI_editbox, "text") bindingContext:AddBinding(package, "Category", "AssetManager.comboBoxCategory", commonlib.Binding.ControlTypes.IDE_dropdownlistbox, "text") bindingContext:AddBinding(package, "bDisplayInMainBar", "AssetManager.checkBoxShowInMainbar", commonlib.Binding.ControlTypes.IDE_checkbox, "value") _guihelper.ShowDialogBox("Add a new package", nil, nil, 263, 114, function(_parent) _this = ParaUI.CreateUIObject("container", "AssetManager.NewAsset", "_fi", 0,0,0,0) _this.background = ""; _parent:AddChild(_this); _parent = _this; _this = ParaUI.CreateUIObject("editbox", "packageName", "_mt", 85, 3, 3, 23) _parent:AddChild(_this); _this = ParaUI.CreateUIObject("editbox", "textBoxIconPath", "_mt", 85, 58, 3, 23) _parent:AddChild(_this); NPL.load("(gl)script/ide/dropdownlistbox.lua"); local ctl = CommonCtrl.dropdownlistbox:new{ name = "AssetManager.comboBoxCategory", alignment = "_mt", left = 85, top = 32, width = 3, height = 22, dropdownheight = 106, parent = _parent, text = "", items = {"Creations.BCS.doors", "Creations.BCS.windows", "Creations.Normals.Trees", }, }; ctl:Show(); NPL.load("(gl)script/ide/CheckBox.lua"); local ctl = CommonCtrl.checkbox:new{ name = "AssetManager.checkBoxShowInMainbar", alignment = "_lt", left = 3, top = 91, width = 166, height = 18, parent = _parent, isChecked = false, text = "娣诲姞鍒版垜鐨勫垱浣滃伐鍏锋爮", }; ctl:Show(); bindingContext:UpdateDataToControls(); end, function(dialogResult) if(dialogResult == _guihelper.DialogResult.OK) then bindingContext:UpdateControlsToData(); -- add to package list and update UI controls. Map3DSystem.App.Assets.AddPackage(package); end return true; end) end ]] __syntax__ <verbatim>function _guihelper.ShowDialogBox(title, x,y,width, height, ShowUI_func,OnClick_CallBack, buttons)</verbatim> __parameters__ | *title* | string of title text or nil. | | *x* | | | *y* | | | *width* | | | *height* | | | *ShowUI* | _func: function (_parent) end. this function is called to create UIs in the dialog but excluding the OK|cancel buttons. UI created in it will be automatically destroyed when dialog closes. | | *func* | | | *OnClick* | | | *CallBack* | | | *buttons* | ; [optional] type of _guihelper.MessageBoxButtons e.g. function SomeFunctionToCreateUIToGetherData() local package = Map3DSystem.App.Assets.CreatePackage({text="鏈懡鍚嶈祫婧愬寘"}); local bindingContext = commonlib.BindingContext:new(); bindingContext:AddBinding(package, "text", "AssetManager.NewAsset#packageName", commonlib.Binding.ControlTypes.ParaUI_editbox, "text") bindingContext:AddBinding(package, "icon", "AssetManager.NewAsset#textBoxIconPath", commonlib.Binding.ControlTypes.ParaUI_editbox, "text") bindingContext:AddBinding(package, "Category", "AssetManager.comboBoxCategory", commonlib.Binding.ControlTypes.IDE_dropdownlistbox, "text") bindingContext:AddBinding(package, "bDisplayInMainBar", "AssetManager.checkBoxShowInMainbar", commonlib.Binding.ControlTypes.IDE_checkbox, "value") _guihelper.ShowDialogBox("Add a new package", nil, nil, 263, 114, function(_parent) _this = ParaUI.CreateUIObject("container", "AssetManager.NewAsset", "_fi", 0,0,0,0) _this.background = ""; _parent:AddChild(_this); _parent = _this; _this = ParaUI.CreateUIObject("editbox", "packageName", "_mt", 85, 3, 3, 23) _parent:AddChild(_this); _this = ParaUI.CreateUIObject("editbox", "textBoxIconPath", "_mt", 85, 58, 3, 23) _parent:AddChild(_this); NPL.load("(gl)script/ide/dropdownlistbox.lua"); local ctl = CommonCtrl.dropdownlistbox:new{ name = "AssetManager.comboBoxCategory", alignment = "_mt", left = 85, top = 32, width = 3, height = 22, dropdownheight = 106, parent = _parent, text = "", items = {"Creations.BCS.doors", "Creations.BCS.windows", "Creations.Normals.Trees", }, }; ctl:Show(); NPL.load("(gl)script/ide/CheckBox.lua"); local ctl = CommonCtrl.checkbox:new{ name = "AssetManager.checkBoxShowInMainbar", alignment = "_lt", left = 3, top = 91, width = 166, height = 18, parent = _parent, isChecked = false, text = "娣诲姞鍒版垜鐨勫垱浣滃伐鍏锋爮", }; ctl:Show(); bindingContext:UpdateDataToControls(); end, function(dialogResult) if(dialogResult == _guihelper.DialogResult.OK) then bindingContext:UpdateControlsToData(); -- add to package list and update UI controls. Map3DSystem.App.Assets.AddPackage(package); end return true; end) end ]] | ---++++ !_guihelper.OnDialogBoxClick dialog box call back. __syntax__ <verbatim>function _guihelper.OnDialogBoxClick(dialogResult)</verbatim> __parameters__ | *dialogResult* | | %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