Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{alias:mainwindow}
h2. Name

*mainwindow* — Manipulate Geocap's main menu interface

h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}
*mainwindow open* _filename_ 
*mainwindow newtab* _tabname_ 
*mainwindow settab* _tabname_ 
*mainwindow tabexists* _tabname_ 
*mainwindow closetab* _tabname_ 
*mainwindow toolsmenu* 
*mainwindow helpmenu* 
*mainwindow toolbox* 
*mainwindow menubar* 
*mainwindow statusmessage* message [ timeout ]

{panel}

h2. Description

The *mainwindow* commands allows you to alter the main interface of Geocap. Typical tasks include adding menus, tabs, and opening files. Some arguments return a particular widget for further manipulation using standard QTcl syntax. 

h2. Arguments
*open* _filename_ 
{indent}The *open* command opens a file. The file should be recognizeable by Geocap. It is equivalent to performing the *File->Open* menu action in the main menu. 
{indent}
*newtab* _tabname_ 
{indent}The *newtab* adds another tab to the central tab widget.{indent} 
*settab* _tabname_ 
{indent}Makes visible the given tab. An error is returned if the tab does not exist.{indent} 
*tabexists* _tabname_ 
{indent}Returns the value 1 (true) if the tab exists, else 0.{indent} 
*closetab* _tabname_ 
{indent}Closes the given tab page. It is an error if the page does not exist.{indent}
*toolsmenu* 
{indent}Returns the Geocap *Tools* menu. This can be further modified using conventional QTcl commands, as shown in the following example. 

h3. Example 1. Retrieving the Tools menu 
{noformat:|borderWidth=1|bgColor=#eeeeee}
# Get menu
set toolsmenu [mainwindow toolsmenu]

# syntax : 
# qaddaction menu itemname commands
qaddaction $toolsmenu "Hello" { qinformation Hello "Hello there!" }

{noformat}
{indent}
*helpmenu*
{indent}Returns the Geocap *Help* menu. This can be further modified using conventional QTcl commands, as shown in the following example. 

h3. Example 2: Retrieving the Help menu 

{noformat:|borderWidth=1|bgColor=#eeeeee}
# Get menu
set helpmenu [mainwindow helpmenu]

# syntax : 
# qaddaction menu itemname commands
qaddaction $helpmenu "Hello" { qinformation Hello "Hello there!" }

{noformat}
{indent}
*toolbox*
{indent}Returns the Geocap *Toolbox*. The tool box resembles a vertically stacked tab widget. The Geocap toolbox contains items like the command shell and color tables. The toolbox can be further modified using conventional QTcl commands, as shown in the following example.
h3. Example 3: Retrieving the Toolbox 

{noformat:|borderWidth=1|bgColor=#eeeeee}
 # Get the toolbox
 set toolbox [mainwindow toolbox]

 # Create an editor...(this could be any widget)
 set editor [qtextedit ]

 #... and add the editor to the toolbox
 qadditem $toolbox "My Editor" $editor
            
{noformat}
{indent}
*menubar* 
{indent}Returns the Geocap main *menubar*, located along the top of the main interface. This allows you to add additional menus using QTcl. 

h3. Example 4. Retrieving the menubar
            
{noformat:|borderWidth=1|bgColor=#eeeeee}
# Get menu bar
set menubar [mainwindow menubar]

# Add menu
set menu [qaddmenu $menubar "My Menu"]

# syntax : 
# qaddaction menu itemname commands
qaddaction $menu "Hello" { qinformation Hello "Hello there!" }

{noformat}
{indent}           
*statusmessage* _message_ \[_timeout_] 
{indent}Shows a message in the status bar, located along the bottom of the main interface. The optional timeout argument sets the duration in milliseconds. 
{indent}

{pagebreak}