---++!! !MCMLBrowserCtrl %TOC{title="Contents:"}% %STARTINCLUDE% ---++ a simple mcml web page browser window | *Title* | a simple mcml web page browser window | | *Author(s)* | LiXizhi | | *Date* | 2008/3/10 | | *File* | script/kids/3DMapSystemApp/MCML/BrowserWnd.lua | ---+++ Description a thin wrapper of PageCtrl in a web browser style API. %T% __Sample Code__ <verbatim> NPL.load("(gl)script/kids/3DMapSystemApp/mcml/BrowserWnd.lua"); local ctl = Map3DSystem.mcml.BrowserWnd:new{ name = "McmlBrowserWnd1", alignment = "_lt", left=0, top=0, width = 512, height = 290, parent = nil, }; ctl:Show(); -- One can also create NavBar elsewhere, like below ctl:CreateNavBar(_parent, "_mt", 0, 0, 0,32) ctl:Goto("%WIKI%/Main/ParaWorldFrontPageMCML"); ctl:Goto(url, Map3DSystem.localserver.CachePolicy:new("access plus 1 day")); </verbatim> ---+++ Member Functions ---++++ !BrowserWnd:new <verbatim>-------------------------------------------------------------------- a browser window instance: internally it is a PageCtrl -------------------------------------------------------------------- local BrowserWnd = { -- the top level control name name = "BrowserWnd1", -- normal window size alignment = "_lt", left = 0, top = 0, width = 300, height = 290, parent = nil, background = "", -- current url url = nil, -- boolean: whether to create the nav bar, if nil NavBar will not be created. if false, it will be created but not visible. DisplayNavBar = nil, -- whether to display nav address combo box, if this is DisplayNavBar is not true, this parameter takes no effect. DisplayNavAddress = true, -- a file containing url addresses historyFileName = "config/mcmlbrowser_urls.txt"; -- max number of history files max_history_items = 200, -- window object that will be passed to the internal pageCtrl. window = nil, }</verbatim> Map3DSystem.mcml.BrowserWnd = BrowserWnd; constructor __syntax__ <verbatim>function BrowserWnd:new (o)</verbatim> __parameters__ | *o* | | ---++++ !BrowserWnd:Destroy Destroy the UI control __syntax__ <verbatim>function BrowserWnd:Destroy ()</verbatim> ---++++ !BrowserWnd:CreateNavBar create navigation bar for this window __syntax__ <verbatim>function BrowserWnd:CreateNavBar(_parent, alignment, left, right, width, height)</verbatim> __parameters__ | *parent* | | | *alignment* | | | *left* | | | *right* | | | *width* | | | *height* | | ---++++ !BrowserWnd:Show * _param_ __bShow__ : boolean to show or hide. if nil, it will toggle current setting. * _return_ __true__ : if UI is created __syntax__ <verbatim>function BrowserWnd:Show(bShow)</verbatim> __parameters__ | *bShow* | boolean to show or hide. if nil, it will toggle current setting. | ---++++ !BrowserWnd:Goto -------------------------------------- public method -------------------------------------- go to a given url, refresh * _param_ __url__ : if nil it will clear the browser. it can also be string "backward", "forward" which opens last page and forward page. __syntax__ <verbatim>function BrowserWnd:Goto(url, cache_policy, bRefresh)</verbatim> __parameters__ | *url* | if nil it will clear the browser. it can also be string "backward", "forward" which opens last page and forward page. | | *cache* | | | *policy* | | | *bRefresh* | | ---++++ !BrowserWnd:GetUrl return nil or current url __syntax__ <verbatim>function BrowserWnd:GetUrl()</verbatim> ---++++ !BrowserWnd:ShowNavBar show or hide the nav bar on top. __syntax__ <verbatim>function BrowserWnd:ShowNavBar(bShow)</verbatim> __parameters__ | *bShow* | | ---++++ !BrowserWnd:ShowAddressBar show or hide the nav address bar on top. __syntax__ <verbatim>function BrowserWnd:ShowAddressBar(bShow)</verbatim> __parameters__ | *bShow* | | ---++++ !BrowserWnd:UpdateHistoryFiles load history test files __syntax__ <verbatim>function BrowserWnd:UpdateHistoryFiles()</verbatim> ---++++ !BrowserWnd:SaveToHistoryFile save recently opened file to history __syntax__ <verbatim>function BrowserWnd:SaveToHistoryFile(url)</verbatim> __parameters__ | *url* | | ---++++ !BrowserWnd.OnPage_CallBack called when a new page is downloaded. __syntax__ <verbatim>function BrowserWnd.OnPage_CallBack(sCtrlName)</verbatim> __parameters__ | *sCtrlName* | | ---++++ !BrowserWnd:open replace the context in this window with input mcmlNode. * _param_ __mcmlNode__ : must be a raw mcmlNode, such as from a url or local server. __syntax__ <verbatim>function BrowserWnd:open(mcmlNode)</verbatim> __parameters__ | *mcmlNode* | must be a raw mcmlNode, such as from a url or local server. | ---++++ !BrowserWnd:ShowMessage show a message to inform the user about a background action or status. * _param_ __text__ : string or nil. if nil, it will clear the message box. __syntax__ <verbatim>function BrowserWnd:ShowMessage(text)</verbatim> __parameters__ | *text* | string or nil. if nil, it will clear the message box. | ---++++ !BrowserWnd.OnClose close the given control __syntax__ <verbatim>function BrowserWnd.OnClose(sCtrlName)</verbatim> __parameters__ | *sCtrlName* | | ---++++ !BrowserWnd.OnClickNavBackward navigate to last url __syntax__ <verbatim>function BrowserWnd.OnClickNavBackward(sCtrlName)</verbatim> __parameters__ | *sCtrlName* | | ---++++ !BrowserWnd.OnClickNavForward navigate to next url __syntax__ <verbatim>function BrowserWnd.OnClickNavForward(sCtrlName)</verbatim> __parameters__ | *sCtrlName* | | ---++++ !BrowserWnd.OnClickNavTo navigate to the current url in combo box __syntax__ <verbatim>function BrowserWnd.OnClickNavTo(sCtrlName)</verbatim> __parameters__ | *sCtrlName* | | ---++++ !Map3DSystem.mcml.BrowserWnd.OnClickNavRefresh do not use cached version and refresh __syntax__ <verbatim>function Map3DSystem.mcml.BrowserWnd.OnClickNavRefresh(sCtrlName)</verbatim> __parameters__ | *sCtrlName* | | %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