grail.ip.gview Module

Version: 16.2

Table of Contents

Overview

GView windows are used in MineSight® Interactive Planner (IP) scripts to display reserves information. The GView windows are controlled by display calls in the user script, the functions defined below.

Creating a Simple GView

Whenever we start creating a GView we are basically using the functions defined in this module to write a file that is read by the gview.exe. The first stages are,

numrows = 3
numcols = 3
windownum = 1

phndl = gview.OpenStdGrid(numrows, numcols, windownum)
gview.SetWinLev(phndl, 1)
gview.SetWindowTitle(phndl, 'Cumulative Reserves')

The important items to notice here are the windownum and phndl. You may want to display more than one table during your script execution, the windownum defines which table (window) you are working with. The phndl is used as a reference for all subsequent operations involving the insertion of data and the naming of the window title (see How GView.exe Works).

Now lets insert some data into the window.

gview.SetCellValue(phndl, 1, 1, "Data")

This will set the cell at row equal to 1 and column equal to 1 to contain "Data". If you wanted to insert a floating point value, you will need to format it into a string prior to calling SetCellValue. For example,

gview.SetCellValue(phndl, 1, 2, "%6.2f" % (10.2))

Will set the string value ' 10.20' [1].

When you are done filling in your GView data, you must end your script with a close and display instructions,

gview.CloseStdGrid(phndl)
gview.DisplayStdGrid(phndl)

Setting GView Window Positions

You may position your window in a specific location using the following functions,

  • Stewing
  • SetWinLev
  • SetWinSize

How GView.exe Works

Underneath this module there is really a call to the gview.exe. A basic understanding of how gview.exe works should help to make this module more informative.

gview.exe works by accepting a description file which is passed in as an argument to gview.exe (along with an instance index). This module creates the description file and starts the gview.exe program. gview.exe opens the description file and looks at the index passed in. If this index exists for another gview.exe instance it passes the description file information on to the other window for display and stops itself. If the description file does not exist then it set itself with that index and displays the information. To close all windows spawn gview.exe with a negative index and a close signal is sent to all other windows then gview.exe closes itself.

Functions

OpenStdGrid(rows, columns, index[,filename])

Returns MetaGrid used in all other calls. Can use different index values to spawn different windows, and use the same index value to update one. If your index is equal to -1, then all active windows will close.

The default filename is ptemp.gvw.

CloseStdGrid(MetaGrid)
Close the grid before trying to display it.
DisplayStdGrid(MetaGrid)
Displays the new grid, or updates an existing grid if one with the same indexes exists.
SetCellValue(MetaGrid, row, col, value)
Sets cell value.
SetCellColor(MetaGrid, row, col, red, green, blue)
Sets cell color.
SetColumnColor(MetaGrid, col, red, green, blue)
Sets column color.
SetRowColor(MetaGrid, row, red, green, blue)
Sets row color.
SetWinSize(MetaGrid, width, height)
Sets window size.
SetWinLev(MetaGrid, lev)
Sets precedence behavior of window i.e. who is on top (lev = 1-4).
SetWindowTitle(MetaGrid, title)
Sets window title.

[1]"String Formatting Operations" Python Library Reference. 21 December 2001. 31 May 2004 <http://www.python.org/doc/2.2/lib/typesseq-strings.html>