mainwindow - Manipulate Geocap's main menu interface

Name

mainwindow — Manipulate Geocap's main menu interface

Syntax

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 ]

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.

Arguments

open filename

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.

newtab tabname

The newtab adds another tab to the central tab widget.

settab tabname

Makes visible the given tab. An error is returned if the tab does not exist.

tabexists tabname

Returns the value 1 (true) if the tab exists, else 0.

closetab tabname

Closes the given tab page. It is an error if the page does not exist.

toolsmenu

Returns the Geocap Tools menu. This can be further modified using conventional QTcl commands, as shown in the following example.

helpmenu

Returns the Geocap Help menu. This can be further modified using conventional QTcl commands, as shown in the following example.

toolbox

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.

menubar

Returns the Geocap main menubar, located along the top of the main interface. This allows you to add additional menus using QTcl.

statusmessage message [timeout]

Shows a message in the status bar, located along the bottom of the main interface. The optional timeout argument sets the duration in milliseconds.

Examples

Example 1. Retrieving the Tools menu

# Get menu
set toolsmenu [mainwindow toolsmenu]

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

 

Example 2: Retrieving the Help menu

# Get menu
set helpmenu [mainwindow helpmenu]

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

Example 3: Retrieving the Toolbox

 # 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
 

Example 4. Retrieving the menubar

# 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!" }