Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Wiki Markup
{alias:mainwindow}

Name

mainwindow — Manipulate Geocap's main menu interface

...

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

No Format
# Get menu
set toolsmenu [mainwindow toolsmenu]

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

 

Example 2: Retrieving the Help menu

No Format
# Get menu
set helpmenu [mainwindow helpmenu]

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

Example 3: Retrieving the Toolbox

No Format
 # 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

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