📄 sample.js
字号:
#ifdef MENU_BAR#define USE_VIEW_STATE#endif#ifdef TOOL_BAR#define USE_VIEW_STATE#endif///////////////////////////////////////////////////////////////////////////////// This application was generated with the Bindows Application Wizardfunction __APP__NAME__(){ this.updateUi(); this.hookUpEvents(); var label = application.getComponentById( "label" ); this.centerInParent( label );}// define static main method__APP__NAME__.main = function () { new __APP__NAME__();};_p = __APP__NAME__.prototype;#ifdef TOOL_BAR_p._showToolBar = true;#endif#ifdef SIDE_BAR_p._showSideBar = true;#endif#ifdef STATUS_BAR_p._showStatusBar = true;#endif#ifdef TOOL_BAR__APP__NAME__.addProperty( "showToolBar", Function.READ );#endif#ifdef SIDE_BAR__APP__NAME__.addProperty( "showSideBar", Function.READ );#endif#ifdef STATUS_BAR__APP__NAME__.addProperty( "showStatusBar", Function.READ );#endif#ifdef TOOL_BAR_p.setShowToolBar = function ( b ){ this._showToolBar = b; this.updateUi();};#endif#ifdef SIDE_BAR_p.setShowSideBar = function ( b ){ this._showSideBar = b; this.updateUi();};#endif#ifdef STATUS_BAR_p.setShowStatusBar = function ( b ){ this._showStatusBar = b; this.updateUi();};#endif// Define an application method_p.centerInParent = function ( c ){ var p = c.getParent(); var ph = p.getClientHeight(); var pw = p.getClientWidth(); var ch = c.getHeight(); var cw = c.getWidth(); c.setLeft( (pw - cw) / 2 ); c.setTop( (ph - ch) / 2 );};_p.updateUi = function (){#ifdef MENU_BAR var mb = application.getComponentById( "menu-bar" );#endif#ifdef TOOL_BAR var tb = application.getComponentById( "tool-bar" );#endif#ifdef SIDE_BAR var main = application.getComponentById( "split-pane" );#endif#ifndef SIDE_BAR var main = application.getComponentById( "main-area" );#endif#ifdef STATUS_BAR var sb = application.getComponentById( "status-bar" );#endif // show hide components#ifdef TOOL_BAR tb.setVisible( this.getShowToolBar() );#endif#ifdef SIDE_BAR main.setLeftVisible( this.getShowSideBar() );#endif#ifdef STATUS_BAR sb.setVisible( this.getShowStatusBar() );#endif // position components#ifdef MENU_BAR#ifdef TOOL_BAR tb.setTop( mb.getHeight() ); main.setTop( this.getShowToolBar() ? tb.getTop() + tb.getHeight() + 2 : mb.getHeight() );#endif#ifndef TOOL_BAR main.setTop( mb.getHeight() );#endif#endif#ifndef MENU_BAR#ifdef TOOL_BAR main.setTop( this.getShowToolBar() ? tb.getTop() + tb.getHeight() + 2 : 0 );#endif#ifndef TOOL_BAR main.setTop( 0 );#endif#endif#ifdef STATUS_BAR main.setBottom( this.getShowStatusBar() ? sb.getHeight() : 0 );#endif#ifndef STATUS_BAR main.setBottom( 0 );#endif};_p.hookUpEvents = function (){#ifdef MENU_BAR var aboutCommand = application.getComponentById( "about-command" ); var viewCommand = application.getComponentById( "view-command" );#endif#ifdef TOOL_BAR var showToolBarCommand = application.getComponentById( "show-tool-bar-command" );#ifndef MENU_BAR var viewCommand = application.getComponentById( "view-command" );#endif#endif#ifdef SIDE_BAR var showSideBarCommand = application.getComponentById( "show-side-bar-command" );#endif#ifdef STATUS_BAR var showStatusBarCommand = application.getComponentById( "show-status-bar-command" );#endif#ifdef MENU_BAR aboutCommand.addEventListener( "execute", this.about, this ); viewCommand.addEventListener( "uservaluechanged", function (e) { this.setViewState( e.getTarget().getUserValue() ); }, this );#endif#ifdef TOOL_BAR showToolBarCommand.addEventListener( "checkedchanged", function (e) { this.setShowToolBar( e.getTarget().getChecked() ); }, this );#ifndef MENU_BAR viewCommand.addEventListener( "execute", function (e) { this.setViewState( e.getTarget().getUserValue() ); }, this );#endif#endif#ifdef SIDE_BAR showSideBarCommand.addEventListener( "checkedchanged", function (e) { this.setShowSideBar( e.getTarget().getChecked() ); }, this );#endif#ifdef STATUS_BAR showStatusBarCommand.addEventListener( "checkedchanged", function (e) { this.setShowStatusBar( e.getTarget().getChecked() ); }, this );#endif // reposition label when the parent component is resized var label = application.getComponentById( "label" ); var p = label.getParent(); p.addEventListener( "resize", function ( e ) { this.centerInParent( label ); }, this );};#ifdef USE_VIEW_STATE// the view state does not really do anything__APP__NAME__.addProperty( "viewState", Function.READ );_p.setViewState = function ( s ){ this._viewState = s;#ifdef STATUS_BAR var vs = application.getComponentById( "view-status" ); vs.setText( s );#endif};#endif_p.about = function (){ alert( "This application was generated using the Bindows Application Wizard" );};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -