?? c-adding3.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> Adding Tools to Tornado </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="c-adding.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-adding.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-adding2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-adding4.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="84558">6.3 Installing a New Application in Tornado</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84560"> </a>Tornado applications can be launched from the host command shell, as you did when testing this application. However, it is more convenient to launch them from the launcher (on UNIX hosts) or from the launch toolbar (on Windows hosts). The next sections explain how to install a new application.</p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84561">6.3.1 The Tornado Launcher (UNIX Hosts)</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84563"> </a>Once the new Tornado application is working, you can add it to the Tornado launcher. To do this, install a Tcl resource file containing the command that adds a button to the launcher in the <b class="file">Launch</b> directory. The name of this file is related to the application you are starting and is prefixed with "01" so that it will be sourced with other applications early in the initialization process. The complete path to the new resource file is:</p><dl class="margin"><dd><div class="Indent"><a name="84564"> </a><i class="textVariable">installDir</i><b class="file">/host/resource/tcl/app-config/Launch/01Wtxapp.tcl</b>.</div><br></dl><dd><p class="Body"><a name="84568"> </a>The Tcl program shown in <a href="c-adding3.html#84571">Example 6-2</a> uses the <b class="tclProc">objectCreate</b> command to create a new button in the Tornado launcher. This button is associated with the Tcl routine <b class="tclProc">launchWtxapp</b> that gets the name of the target server currently selected in the launcher target window and passes it as a parameter to <b class="command">wtxapp</b>.</p><dd><p class="Body"><a name="84569"> </a>The second parameter of <b class="tclProc">objectCreate</b> is the name of a bitmap file to be displayed as an icon at the bottom of the launcher. Add the bitmap file to the resource bitmap directory for the launcher. In this example the complete path to the bitmap is <i class="textVariable">installDir</i><b class="file">/host/resource/bitmap/Launch/objects/wtxapp</b>. This file can be created with an icon editor like <b class="command">bitmap</b> from the X11 distribution. For more information about <b class="tclProc">objectCreate</b>, see the online material under <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Tornado API Reference>GUI Tcl Library (UNIX)</font></b>.</p></dl></dl><h4 class="EntityTitle"><a name="84571"><font face="Helvetica, sans-serif" size="-1" class="sans">Example 6-2: Install wtxapp in Launcher</font></a></h4><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="84572"># Wtxapp.tcl - simple wtx application support for launch # # modification history # -------------------- # 01a,25jul95,p_m written #*/ # Add a wtxapp activation button to bottom of the launcher # The associated icon is the default icon (WRS logo) if there is not a # bitmap file called "wtxapp" in # <i class="textVariable">installDir</i>/host/resource/bitmaps/Launch/objects. objectCreate app wtxapp wtxapp {launchWtxapp}</a></b><dd> <b><a name="84573">######################################################################## # # wtxapp launch on selected target server #</a></b><dd> <b><a name="84575">proc launchWtxapp {} { global env global tgtsvr_selected global tgtsvr_user global tgtsvr_lock</a></b><dd> <b><a name="84577"> # check for a selected target server</a></b><dd> <b><a name="84579"> if {$tgtsvr_selected == ""} { noticePost error "Select a target first." return }</a></b><dd> <b><a name="84581"> # check if target server is locked</a></b><dd> <b><a name="84583"> if {$tgtsvr_lock == "locked"} { noticePost error "Target server locked by $tgtsvr_user." return }</a></b><dd> <b><a name="84585"> # check if we have access authorization on the selected target server if {$tgtsvr_lock == "unauthorized"} { noticePost error "Access not authorized." return } exec wtxapp $tgtsvr_selected & }</a></b></pre></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84587">6.3.2 The Launch Toolbar (Windows Hosts)</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84589"> </a>Once the new Tornado application is working, you can add it to the Tornado launch toolbar. To do this, install a Tcl resource file containing a command to add a button to the toolbar in the <b class="file">Tornado </b>directory. The name of this file is related to the application you are starting and is prefixed with "01"so that it will be sourced with other applications early in the initialization process. The complete path to the new resource file is:</p><dl class="margin"><dd><div class="Indent"><a name="84590"> </a><i class="textVariable">installDir</i><b class="file">\host\resource\tcl\app-config\Tornado\01Wtxapp.win32.tcl</b> </div><br></dl><dd><p class="Body"><a name="84594"> </a>The Tcl program shown in <a href="c-adding3.html#84597">Example 6-3</a> uses the <b class="tclProc">controlCreate</b> command to create a new button in the Tornado launcher. This button is associated with the <b class="tclProc">launchWtxapp</b> Tcl routine that gets the name of the target server currently selected in the launcher target window and passes it as a parameter to <b class="command">wtxapp</b>.</p><dd><p class="Body"><a name="84595"> </a>The <b class="command">-bitmap</b> parameter of <b class="tclProc">controlCreate</b> is the name of a bitmap file to be displayed as an icon on the button. Add the bitmap file to the resource bitmap directory for the toolbar. In this example the complete path to the bitmap is <i class="textVariable">installDir</i><b class="file">\host\resource\bitmaps\Launch\controls\wtxapp.bmp</b>. This file can be created with an icon editor such as Microsoft <b class="file">Paintbrush</b>. For more information about <b class="tclProc">controlCreate </b>see the online material under <b class="guiLabel"><font face="Helvetica, sans-serif" size="-1" class="sans">Tornado API Reference>GUI Tcl Library (Windows)</font></b>.</p></dl></dl><h4 class="EntityTitle"><a name="84597"><font face="Helvetica, sans-serif" size="-1" class="sans">Example 6-3: Install wtxapp on Launch Toolbar</font></a></h4><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="84598"># Wtxapp.win32.tcl - simple wtx application support for launcher # # modification history # -------------------- # 01a, 05may96, j_k written #*/ # Add a wtxapp activation button to the launch toolbar # The associated bitmap will be the default bitmap (WRS logo) if # there is no bitmap file called "wtxapp" in # <i class="textVariable">installDir</i>/host/resource/bitmaps/Tornado, no bitmap appears set wtxappBitmap [wtxPath host resource bitmaps Tornado]Wtxapp.bmp controlCreate launch [list toolbarbutton -name wtxapp \ -callback launchWtxapp \ -tooltip "Launch Wtxapp" \ -bitmap $wtxappBitmap]</a></b><dd> <b><a name="85295"></a></b><dd> <b><a name="85296"></a></b><dd> <b><a name="85297">############################################################################ # wtxapp launch on selected target server # proc launchWtxapp {} { global env # first get the name of the selected target set tgtsvr_selected [selectedTargetGet] if {$tgtsvr_selected == ""} { messageBox -stopicon "Select a target first." return } # Then try to attach to the tool without any errors. # If any, return the error to be displayed for the user. if {[catch {wtxToolAttach $tgtsvr_selected wtxapp} attachRetVal]} { messageBox -stopicon "Tool attach failed. $attachRetVal" return } # Next try to get the target server information. # If any errors, report to the user if [catch "wtxTsInfoGet" info] { if {[lindex $info 3] == "(SVR_TARGET_NOT_ATTACHED)"} { wtxToolDetach messageBox -stopicon "Target not attached" return } messageBox -stopicon "Couldn't obtain target server infomation" return } # If we get here, looks pretty good set tgtsvr_user [lindex $info 8] set tgtsvr_lock [lindex $info 11] # Now check if target server is locked if {$tgtsvr_lock == "locked"} { messageBox -stopicon "Target server locked by $tgtsvr_user." return } # Now check if we have access authorization on the selected target server if {$tgtsvr_lock == "locked"} { messageBox -stopicon "Access not authorized." return }</a></b><dd> <b><a name="85302"> # Finally since everything looks good lets launch the target server if {[catch {toolLaunch "Wtxapp" "wtxapp $tgtsvr_selected" \ $env(WIND_BASE)/host/x86-win32/bin 0 0 0 0 0 0} result]} { puts "\nError: wtxapp launch failed: '$result'\n" }</a></b><dd> <b><a name="84680"> }</a></b></pre></dl></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="c-adding.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-adding.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-adding2.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-adding4.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 4.0.11 template: CSS Template, Jan 1998 - Jefro --->
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -