TOC PREV NEXT INDEX

Put your logo here!


2 USER'S GUIDE

This chapter describes how to use the panel editor which is a VLT tool to build VLT graphical user interfaces.

2.1 OVERVIEW

The VLT User interface is actually implemented into two parts:

· The Programmatic Interface, consisting of a library of general purpose procedures provided by the panel editor and a set of TK widget classes.
The TK widget classes are used by the panel editor to build user interfaces. Each widget is implemented as a incr Tcl class providing the user public configuration variables and methods to interact with the widget (for example to add element to a uifListBox).


· The Panel Editor, which is a tool to help the user design and create user interfaces. This tool allows the user to position widgets within the panel (from now on this term is used to indicate the empty working frame where to place the widget to create a user interface) and configure them.
The Panel Editor enforces the ESO user interface common conventions.

GUIs can be classified to belong to one of these categories:

GUIs for Control Panels.
These are GUIs which are used to control telescopes and instrumentation and should be designed using only the features provided by the panel editor: in particular the use of TCL procedures changing the panel layout should be avoided.


GUIs for Utilities.
These are GUIs for off-line tools which perform specific tasks to assist the SW developer and are typically developed inside the SW group, such as: errEditor, ccsei, etc...

For this kind of GUIs a higher level of customization is allowed and the Panel Editor provides means to customize the behaviour of the utility.

2.1.1 The Main Panel

The panel editor utility is invoked by the command

> panel &

The following windows are displayed:

· The main window containing the main editing commands
· The set of basic VLT widgets
· The so called "working window" where the user can add widgets and whose contents can be saved to generate a new panel.

The panel editor supports a set of basic widgets available through the "Widget" window and they are grouped into three categories:

· Basic Widgets - These are the basic widget used by the panel editor: these widgets differ from the standard Tk widgets because they have a reduced number of widget configuration options and implement additional methods in order to fulfil the VLT Look & Feel.

· Common Widgets - These widgets are typically directly implemented in itk and provide specific `high-level' funtionalities.
Who has developed a widget of common interest can submit the new widgets to the responsible of the VLT User Interface to include them into the library.

· Graphic Widgets - These are not real widgets but they are added to the canvas as "graphic elements": for the time being only the text element is supported.

Widget selection and configuration is done using the mouse, hereafter there is a short description of all operations available during the editing of the panel (see paragraph 5.2.6 on page 96 for more details).


· Set the widget insertion position - Position the cursor where you want the widget to appear and click <B1>: from now on all widgets will appear in this position, unless the previous sequence of commands is repeated.

· Create a new widget - Go with cursor on the list shown by the window "widgets" and click on the selected widget: the widget will appear in the insertion position with a standard configuration.

· Move widget - Allows the user to move a single widget or a group of widgets.

· Configure a widget - Go with cursor on the widget and click <B3>: the configuration panel for that widget will appear: from this panel the user can also delete the widget or move it to a different location by changing X and Y coordinates.

· Delete a widget - Allows the user to move a single widget or a group of widgets

· Copy a widget - Creates an instance of the selected widget with the same options setup but different name.

2.1.2 Structure of the Working Window

The working window contains the panel you are building and it is made of several components, as shown in the picture below:

You can only work on one panel at a time.

Menu Bar

The menu bar is placed at the top of the panel. In its initial configuration it contains the following standard menus "File" "Std. Options" and "Help": the user can configure it by moving the cursor on it and click <B3>

Canvas

Is the area where the user can freely place all the widgets: the size of the panel can only be modified during editing.


Command Feedback Window

The Command Feedback Window allows the user to see the replies got after sending commands to other processes by using the panSendCommand procedure. For each reply it shows:
· The time when the reply has been received.
· The reply description.


Short Help Widget

The short help widget is placed at the bottom of the panel. When the cursor moves onto a widgets it provides the user on line information on the widget functionality.
Each widget configuration panel provides an entry to define the associated short help.
The Short-Help contains:
- the "Heart-Beat widget" which beats at the same rate as the database polling rate.
- the "Database Re-connection button" which allows the user to force an update of all widgets connected to the `control system' database and it also re-attach events to the database attributes linked to the widgets in the panel.

The Heart-Beat can be removed by an option in the "Std.Comp" menu button.

Action Button Area

This part contains only buttons which are normally used to perform global action on the panel.

Action buttons, appear automatically in the panel's action area and they can be moved to the final position using the mouse middle-button (as described above for the other widgets).

Example of action area referred to the widget configuration panel.

2.1.3 Structure of the MenuBar

The menu bar is placed at the top of the panel and can be inserted to or removed from the panel by clicking the "Menu bar" option in the "Std. Comp." menu of the main panel.
In its initial configuration it contains two menus called "File" and "Help": the user can configure it by moving the cursor on it and click the `mouse-third-button'.

The menu Bar is formed by a row of widgets called "menuButtons" which give access to the underlying menu structure.
Each menu can contain the following kind of entries:

cascade A cascade entry is associated to a sub-menu.
separator Creates a `separation' line between menu items
checkButton Creates a menu item with the characteristics of the `checkButton' widget
radioButton Creates a menu item with the characteristics of the `radioButton' widget
command Creates a menu item which invokes a command

When the menu bar appears in the panel, it can be configured by clicking on it with the mouse right-button, and the following configuration panel appear

Each menu Button or cascade menu can contain several entries which are referenced within the menu with their position. MenuButtons and cascade menus can also be addressed by the full widget path.

To know more on how to create and configure the menu bar, see the dedicated paragraph 5.6 in the reference section

2.1.4 EXAMPLE: Enable/Disable Menu entries

A set of specific procedures is available when the GUI application needs to perform some operations on the menu bar such as, for example, to enable/disable entries according to the current GUI configuration.

The procedures perform the following operations

- Get the full widget name of a menu button
- Get information of a menu entry: this will return the full widget name of the menu
containing the entry, the type of entry and its position in the menu.
- Enable or disable menu entries

Taking as panel reference the one shown in the above picture, some example of use for such procedures are the followings:

Get full Name of "MenuButton1"

seqWish > panGetMbPath MenuButton1
> .menuBarTest.topMenu.menu.file

Disable and enable menu Button "MenuButton1"

seqWish > panSetMbState MenuButton1 disbaled
seqWish > panSetMbState MenuButton1 normal

Get information on the menu entry with label "cmd1" under the menu Button "MenuButton1"

seqWish > panQueryMenuEntry MenuButton1 cmd1
> .menuBarTest.topMenu.menu.file.menu command 2

The returned values is a list specifying: full widget name of the menu containing the entry, the type of entry and its position in the menu.

Get information on the menu entry with label "Menu 3" under the menu Button "MenuButton1"

seqWish > panSearchMenuEntry MenuButton1 "Menu 3"
> .menuBarTest.topMenu.menu.file.menu.submenu2 cascade 4

Disable and enable checkButton "checkButton2" under the menu Button "MenuButton1"

seqWish > panDisableMenuEntry MenuButton1 "checkButton 2"
seqWish > panEnableMenuEntry MenuButton1 "checkButton 2"

2.1.5 Getting Started

This is a simple example to show how to create and configure a widget, save a panel and re-load again its definition

The table below describes what the user should do to create the panel and properly configure the widgets.

User Action
Parameter
Value/Action
Create an "entry" widgets

Select "entry" on Widget Window
Move widget to right position

Press <B2> on the widget to move it
Create an "output" widgets

Select "output" on Widget Window
Move widget to right position

Press <B2> on the widget to move it
Click <B3> on entry widget
Configure widget

Label
Variable
Default
Enter String
string Value
Hello World
Click <B3> on output widget
Configure widget

Length
Variable
Click on Font...
Click on Colour...
Position
20
string Value
Choose Bold ; click Close
Choose Bold ; click Close
Left

Once the panel has been created the tool allows the user to save its definition and run it again as stand alone process.

User Action
Parameter
Value/Action
Change Title

Example1
Save as ... Move widget to right position
Selection
example1
Load
The "load" command is used to edit an existing panel.

Double click on the filename

2.1.6 How To Run a Panel

In the VLT environment a panel is seen as normal executable and is created through the VLT Makefile as specified in paragraph 2.8 on page 63.

In the previous example the panel has been save with the name example1.pan and the VLT makefile will produce an executable with the same name but without the".pan" extension: to run it independently just type:

> example1

2.1.7 Run Time Parameters

Panels are TCL scripts that can be run from a shell, just by invoking the associated command line, for example:

fileName "ccdName=newName" "imageDir=cstest:image.imageDirectory"

The run-time parameters are passed with the following format: "<varName>=<newValue>"

- <varName> should specify the name of a global variable, typically one of those defined by the user in the procedure panUsrGlobalData: it is recommended to always give a default value to the variables passed as run-time parameters to avoid the presence of `undefined' variables.

- <newValue> is the run-time values assigned to <varName>. This value overrides the one previously assigned to <varName>.

There are some built-in parameters, controlling the panel functionality, as specified in the following table:

Specific Parameter
Description
pollRate
Set the polling rate for database element. The polling rate is expressed in seconds, example:

fileName "pollRate=2"
cwp
Sets the Current Working Point for the database accesses in the panel, example:

fileName "cwp=:Appl_data:ccdtest"
fileName "cwp=@wte39:PARAMS:SCALARS"
panDEBUG
Displays on the screen `debugging' messages during the processing of the panel's definition.
See paragraph 2.7.2 on page 62 for more details.

fileName "panDEBUG=ON"
fileName "panDEBUG=dbgDEV"
xcoord or ycoord
Define where in the screen the panel should appear.
fileName "xcoord=100" "ycoord=600"

2.1.8 Miscellaneous

This section contains the description of other editing functionalities contained in the main panel.

Title of the panel

Click the "Change Title ..." button to give a name to the panel.
Note that this name only gives the "title" to the panel and it is not the name of the file where the panel is stored.
At run time the title will be completed by adding the name of the host where the panel runs.

Widget positioning

Display the grid by choosing the "Grid" option. A grid is displayed to help you place the widgets on the working panel.

Resize the panel

Using the resize borders handles in the external frame of the panel window, resize the panel to the actual size you want. Remind that panels are not resizable at run time.

Set the panel final position on the screen

Move the panel in the position on the screen where it should appear and push "Set Panel Position". This position is recorded and used to position the panel on the screen whenever it is called: in this way the user is free to move the panel during editing.

Saving the panel

Save your panel with the "Save as..." option from the File menu and give the file name either by typing a new name or by selecting an existing filename.
The panel is saved as a Tcl/Tk script with the extension ".pan" -e.g- inputPanel.pan

Quit the Panel Editor

Click "Quit" option from the File menu: the user is asked to confirm the operation.
In this case the configuration of the current panel is not saved

Execute the panel.

The filename of the new panel must be added to the Makefile.
Type the name of the file (without the .pan extension) and execute it.

Modify the panel.

Call the panel editor again, click on the "Load" option from the File menu and select the panel file name to reload the panel into the Panel Editor. The panel is displayed in the panel window.

Use any of the available features of the Panel Editor to add, delete, modify widgets in the panel.

2.2 NAMING CONVENTIONS

2.2.1 Widget Names

The panel editor gives each widget a name, but this can be changed by the user during the configuration of the widget. This allows the user to write procedures which can directly interact with the widget.

Tk graphical user interfaces are organized as hierarchy of widgets, in the same way as the Unix file system is organized with the exception that the "." is used as separator instead of "/".

· The name "." refers to the topmost widget in the hierarchy.
· The name .a.b.c refers to a widget c which is contained in the widget .a.b
· Widget names cannot start with numbers of uppercase letters.

Therefore the creation or the configuration of one widget requires the full path name -e.g.- the output widget "ccdRemTime" added to a panel will have the full path set to "<fileName>.top.wdg.can.ccdRemTime".

The sections of the panel where the user can add/edit widgets are the menu bar, the application area and the action area.

The Menu Bar

The menu Bar is placed at the top of the panel and consists of a row of buttons (menuButtons) which can be organized in sub-menus (cascade menus). Each menu Button or cascade menu can contain several entries which are addressed within the menu with their position in the menu.

The Application Area and the Action Area


The Application Area and the Action Area are canvases whose names is stored in the global variable "cv" and "bcv", but the following procedure allows the user to get to the name of the two canvases:

panGetCvNames $par(ROOT_PANEL) cv bcv

the full name of the widget is formed by concatenating the name of the canvas containing the widget and the widget name and therefore the widget path is:
$cv.$name, for widgets in the "Application Area"
$bcv.$name, for widgets in the "Action Area"

The panel editor assigns a name to each widget making sure that the name does not clash with one of another panel (this is very important in the case that several panels are run under the same Tcl interpreter), with the following format:

<fileName>-wdg<N> , where <N> is a number.

When the panel is saved the panel editor process the name of the widgets according to the following table

Widget Name
New Name
Comment
<fileName>-wdg<N>
<newFileName>-wdg<N>
Where N is re-calculated. This is an internal format and it is processed automatically by the panel editor.
Do not rely on this name in your Tcl procedures.
<fileName>-wdgName
<newFileName>-wdgName
Users have the tendency to use this format to customize the widget names : Do Not Use this format.
<fileName>-ccdName
<newFileName>-ccdName

ccdName
ccdName

2.2.2 Widget Names within a uifClass

uifClass are widgets formed by a frame and a canvas inside a frame, therefore the full path name of a a widgets within a uifClass is:

<fullInstanceName>.cv.<widgetName>

The uifClass has a public variable containing the name of the parent widget

Example: if "myInstance" is the name of the uifClass contained in a panel and "myWidget" is the name of a widget within the class, the full widget name can be obtained as follows:

set fullClassName "$cv.myInstance"
set parent [$fullClassName getClassPath]
set widgetPath $parent.cv.myWidget

2.2.3 Variables Names

Widgets of the same panel can share the same parameter (or value) by specifying the same name in the configuration parameter `Variable': this parameter tells the widgets where to store or retrieve data.

The Tcl/Tk interpreter has a unique global data area and the panel editor uses some conventions in
order to avoid name clashing, therefore the user must be aware of some constraints on the syntax of
variable names.

· In menu entries these variables are defined as "global" and they can be accessed as any other global variable. The user must explicitly define the variable associated to a menu entry with the name gvar(<variable name>) to connect the entry with another "normal" widget.

· For the widgets used in the application/action areas these variables are mapped into a global array gvar.
For example if a widget uses a variable name `pan:var:scal.i1', the data hold by that variable is actually stored in a global array as gvar(pan:var:scal.i1).

When a new widget is created, the panel editor assign by default the name of the variable:
<widgetName>Var
where <widgetName> is name of the widget automatically generated. This is formed using the current name of the panel and when the panel is saved it is updated according to the new name.

For portability reasons it is recommended to use the naming conventions defined by the VLT Programming Rules, in particular avoid to use the following characters "-", "_".

When the panel is saved all variables whose name has the format <fileName>-<whateverstring>

are updated according to the new name of the file.

2.2.4 Mapping of run-time data.

2.3 DATABASE INTERFACE

2.3.1 Basics

Widgets can be configured to read/write values from/to the database: those values are specified using the database symbolic address.

Example of Symbolic Address
Description
:PARAMS:SCALARS.scalar_int16
Absolute symbolic address. This address takes the `root' database point as starting point, regardless the value of the Current Working Point
<alias>SCALARS.scalar_int16
The database attribute is accessed using the alias of the point where it is located
<relative> SCALARS.scalar_int16
The database attribute is accessed taking the symbolic address relative to the Current Working Point.

In this case the it should be: "cwp=:PARAMS"
SCALARS.scalar_int16
Since the symbolic address does not start with ":", the whole address is regarded as "relative" to the Current Working Point

All configuration parameters which can access the database are followed by the "DB" checkButton which specifies that the parameter supplied by the user is a DB symbolic address.

If the user specifies a database address but does not set the corresponding `DB' checkButton, that parameter is regarded as a local variable.

The user can specify the so called "Current Working Point" (CWP) which sets the database searching path at the beginning of a specific database point -i.e.- symbolic addresses are resolved inside a database sub-tree.

By default the CWP is set to the database root point (":"), but the user can change it by specifying the new value in the panel command line.

2.3.2 Access to a remote database

Databases of remote environments are accessible by specifying the environment name at the beginning of the database attribute's name -e.g.- "@wte16:PARAMS:SCALARS.scalar_int32".

The name of the local environment is defined by the RTAPENV environment variable.

Each configuration panel provides a field used to specify the environment name and that name applies to all the DB parameters of the widget.

The fields can have the following values:

· Empty, in this case the DB symbolic addresses are resolved according to the current CWP value.
· Specific Environment, in this case the DB symbolic address is `fixed' and do not change according to the current CWP value. In the example above the `variable' final DB symbolic address will be "@wte67<relative>SCALARS.scalar_int32"
· Indirect addressing, the environment is specified by a global tcl variable.
The string representing the variable name must start with a "$" and if the variable does not exist, the local environment is assigned to the variable.

The value assigned to the variable can also contain the CWP to be set fro the specific environment, for example, if userLcu is the name of the variable.
For example the value lte50:PARAMS defines the environment name to be "lte50" and the CWP for this environment is ":PARAMS".

The value of this variable can be defined:
- In the "GlobalData" procedure: it is recommended to assign a default value to the variable.
- In the command line when calling the panel.
- If this is derived from database values it must be defined in the "InitData" procedure.
-

The table below shows some possible setting of the environment name and what happens when calling the panel. This example assumes that the environment variable RTAPENV is set to wte671

Environment setup
Env. Parameter
Actual Value
The parameters are not defined and the variables take the default value, that is, the name of the local environment wte671


The user defines his own the environment variable REMOTE_WS

setenv REMOTE_ENV wte672

The parameters are defined through the command line invoking the panel

myPanel "remoteEnv=lte50" "env(REMOTE_ENV)=wte672"
$remoteWS
$env(REMOTE_WS)


$env(REMOTE_WS)



$remoteWS
$env(REMOTE_WS)
wte671
wte671


wte672



lte50
wte672

2.3.3 EXAMPLE : Dynamic configuration of env. names

Sometime the name of the environment where to access the data from is not fixed but depends, for example, on some configuration parameters or must be formed from some database values.

As example the `active optics' GUI read the data from the LCU whose name depends on which telescope focus is used -e.g.- Nasmith A, Nasmith B, Cassegrein.

User Action
Parameter
Value/Action
Configure the widgets

Configure the widgets accessing the `remote' LCU with an LCU symbolic name.
Env. Name
$userEnv
Configure the other parameters

This widget is configured to read periodically the database attribute. The database symbolic name is expressed as `relative' addressing.
Length
Variable
DB
Poll
10
SCALARS.scalar_int8
Click on checkButton next to variable
Select "Event" radioButton
Set the panel's CWP
The field on the main panel.

:PARAMS

If you save the panel as it is, the widget will read the value from the `local' environment and taking as Current Working Point the one defined for the panel.

Next step now is to make the widget access the same attribute from another environment: this can be done in two ways

Re-define the value of "userEnv" in the command line

> panelName "userEnv=wte34:PARAMS"

The value specifies both the new environment name and the current working point for that environment.

Define value of "userEnv" in the panel definition.

> panelName "userEnv=wte34:PARAMS"

It is recommended to always define a default value in the <xxx>GlobalData procedure of the panel. While if the true environment name is derived from some database values, the definition must be included in the <xxx>InitData procedure.

2.3.4 Store database values

Values used in input widgets can be stored to the associated database attribute. On the other hand by design we have choose not to have this done automatically as the user modifies the widget value, but with a separate command.

Let's assume to create an input panel containing also the following parameters:

Exposure Parameter
Widget Type
Widget name
Exposure Time
entry
expTime
X Binning
scale
xbinning
Y Binning
scale
ybinning


These values can be selected and stored to the database by addressing the name of the widgets used to set their value using the following statement:

panDbWriteWidget $cv expTime xbinning y binning

panDbWriteWidget all

Sometimes there is the need to update (or refresh) the current value of the `input' widgets of the whole panel, therefore one can use the following procedure:

panUpdateCanvas <panel-canvas>

2.3.5 Update Panel Data

Two mechanisms are provided to keep the data displayed in the panel up to date:

Polling
Output widgets are kept up to date by reading the corresponding database values at the rate specified by variable "pollRate" (By default this value is set to 3 seconds): the polling rate can be specified in the command line giving the following instruction: "pollRate=<sec>"
If an error occurs during the updating of a DB attribute, a message appears on the screen and the polling of such element is disabled.

During the polling the panel check if any of the remote environments are active and polling of database attributes read from a not active environment is stopped.
A message in the Short Help area tells the user if there are not active environments.

Update By Events
Data associated to `output' widgets can be kept up to date by registering to the database event manager. The database reacts by sending to the registering application the database attribute new value.

The definition of an event takes two argument:
· The symbolic address of the database element
· The condition for which the database should react, also called filter. The filter specifies conditions such as "at any write", "the new value is different from the old one", etc..

The panel editor (in EDITING Mode) issues a debugging message each time an event is enabled or disabled.

The panel editor provides a standard routine called "panEvtDbUpdate" which process the incoming events, a typical call of this procedure looks like:

panEvtDbUpdate xxx-wdg1 %A %T %D %Q

where %A, %T, %D and %Q are special specifiers used to pass to the procedure well specific parameters. This routine is automatically set by clicking "Set Default Script".
The user can also define its own event handling procedure with the following rules :
- The procedure must be included in a library
- The first parameter of the procedure is assumed to be the widget name.

The declaration of the event script can contain special characters which will be substituted at execution time to provide the handler procedure standard information.
The table shows the ones related to the database events (more details can be found in the man page of seq_evtAttach procedure)
%A
Name of the attribute causing the event
%D
Event data
This is a list, whose contents depends on the attribute type as follows:

- SCALAR: {<dataType> <oldValue> <newValue>}
- VECTOR: {<startElement> <endElement>}
- TABLE: {<startElement> <endElement> <startField> <endField>}
%P
Name of the process causing the event;
This is list with two elements: {<envName> <processName>}.

However events associated with LCU database attributes do not return this information, and an attempt to use this substitution will result in error.
%Q
Quality Flag (for SCALARS ONLY ). For vectors and tables, this will give an empty list.

It gives a list with 2 values: {<oldQuality> <newQuality>}, each having one of the following values : OK, SUSPECT, ERROR, or DISABLED.
%T
Attribute type : either SCALAR, VECTOR or TABLE



BAD QUALITY : Data having the `bad quality' flag set are shown in the panel with a different background (a darker grey). The background is automatically set to the original value as soon as the data turn to be valid again.

A proper log is also generated whenever a change in the `Data Quality' occurs.

2.3.6 Template of procedure for database events

The panel editor provides a standard routine called "panEvtDbUpdate" which process the incoming database events and takes the following arguments:

- Name of the widget (as specified in the "widget name" fields of the configuration panel)
- Name of the database attribute
- Type of the database attribute
- Data returned by the event.
- Quality flag

Here follows the source code that can be used as template for the user to define his own event handle procedure.

proc panEvtDbUpdate { wdgName attr attrType data { quality "" } } {

global panDbSymbAddr panWidget i_type panDEBUG

if {[info exists panWidget($wdgName)] == 0} { return }

if {[cequal $attrType SCALAR]} {

panUpdateLocalVar $wdgName [lindex $panWidget($wdgName) $i_type] [lindex $data 2]

if { [cequal $quality ""] } { return }

if { ![cequal [lindex $quality 1] "OK"] } {

panSetQualityFlag $wdgName 1

} else {

panSetQualityFlag $wdgName 0

}

} elseif { [cequal $attrType VECTOR] } {

# extract attribute specification in the format :

# vector(r1:r2) r1,r2 element range

if {[regexp {\(([0-9a-zA-Z:,]+)\)} $panDbSymbAddr($wdgName) all rec]} {

if { ![panCheckOnRange $rec [lindex $data 0] [lindex $data 1] ]} {

return

}

}

.... Read the current database value

panUpdateLocalVar $wdgName [lindex $panWidget($wdgName) $i_type] $newValue

} elseif { [cequal $attrType TABLE] } {

# extract attribute specification in the format :

# table(r1:r2,f1:f2) r1,r2 record range f1,f2 field range

.... Read the current database value

panUpdateLocalVar $wdgName [lindex $panWidget($wdgName) $i_type] $newValue

}

}

2.3.7 EXAMPLE : Panel reading database values

This example shows :

· How to configure a widget to access database values
· Use of the Current Working Point

The table below describes what the user should do to create the panel and properly configure the widgets.

User Action
Parameter
Value/Action
Create a new "output" widget


Create a new "barChart" widget


Configure the "output" widget

This widget is configured to read periodically the database -i.e.- in polling mode.

The default update rate is 2 seconds
Length
Variable
DB
Poll
Units
Position
20
:PARAMS:SCALARS.scalar_string20
Click on checkButton next to variable
Select "Poll" radioButton
String
Left
Configure the "barChart" widget

This widget is configured to update its value each time a new value is written on the database attribute.

This means that the updating is performed only when that Event occurs.
Length
Variable
DB
Event
Event Script
200
:PARAMS:SCALARS.scalar_int8
Click on checkButton next to variable
Select "Event" radioButton
Click on "Set Default Script"
In the "Debug" menu :
- Enable DB Polling
- Click on "Start DB Events"

The values in the "working panel" will be updated.


Now you can use the ccseiDb utility to change the values of the database attributes and verify if the widgets are correctly updated.

The database attributes associated to the widgets are now specified by their absolute symbolic address. It is also possible to specify the database attributes through their "relative" symbolic address and set the database searching path with the so called "Current Working Point" (for details see paragraph 2.3 on page 29).

User Action
Parameter
Value/Action
Load panel

example2.pan
Configure the "output" widget
Variable
SCALARS.scalar_string20
Configure the "barChart" widget
Variable
SCALARS.scalar_int8
On the main panel
The current working point is added at the beginning of the attribute's symbolic address to get the whole path to the database element
Current Working Point
:PARAMS

Press RETURN

When saved the panel definition will also record the value of the Current Working Point: this can be set also as run time parameter when the panel is called (see paragraph 2.4.2 on page 40)

2.3.8 EXAMPLE: Panel with user's defined event procedure

This example shows how to use an event procedure different from the default one.

The purpose of the new procedure is to read a database value and display that value in another unit, for example, it converts degree in radians.

First of all we write the procedure, assuming that the database attribute is of type scalar.

proc userEvtDbUpdate { wdgName attr attrType data { quality "" } } {

global panDbSymbAddr panWidget i_type panDEBUG

if {[info exists panWidget($wdgName)] == 0} { return }

# Convert the database value from degree to radians

set degreeValue [lindex $data 2]

set radValue [expr ($degreeValue * 3.14 )/360]

panUpdateLocalVar $wdgName [lindex $panWidget($wdgName) $i_type] $radValue

if { [cequal $quality ""] } { return }

if { ![cequal [lindex $quality 1] "OK"] } {

panSetQualityFlag $wdgName 1

} else {

panSetQualityFlag $wdgName 0

}

}

The table below describes what the user should do to create the panel and properly configure the widgets.

User Action
Parameter
Value/Action
Add the new procedure
"userEvtDbUpdate" to a tcl library.




Link tcl library to the panel




Exit from the dialogue



Library
Select "Register User Library" from the main panel.

<name of the library>
Press RETURN
Press Cancel
Create/configure the "output" widget

This widget is configured to read periodically the database -i.e.- in polling mode.

The default update rate is 2 seconds
Length
Variable
DB
Select Event


Event Script
20
:PARAMS:SCALARS.scalar_int16
Click on checkButton next to variable


Click on "Set default Script"
Replace procedure name with the new one, for example userEvtProc

Now you can use the ccseiDb utility to change the values of the database attributes and verify if the widgets are correctly updated.

2.3.9 EXAMPLE : Panel writing values into the database

The table below describes what the user should do to create the panel and properly configure the widgets.

User Action
Parameter
Value/Action
Create a new "entry" widget


Create a new "scale" widget


Configure the "entry" widget
Length
Label
Variable
DB
20
Enter String
:PARAMS:SCALARS.scalar_string20
Click on checkButton next to variable
Configure the "barChart" widget
Variable
DB
:PARAMS:SCALARS.scalar_int8
Click on checkButton next to variable

The widgets are now configured to access database attributes, but their values are not automatically written into the database: for this the user must explicitly give a command.

These operations are typical for the kind of actions to be added to the "action area" and therefore we must add some "Action Buttons" at the bottom of the panel.

User Action
Parameter
Value/Action
Create a new "action button" widget

The widget appear at the bottom of the panel.
Re-size the panel if required.

Click on "Add Action Button"
Configure the "action button" widget
Length
Label
Select Action
20
Store To Database
Select "Store To database"
Create and configure another "action button"
Length
Label
Select Action
10
Clear Fields
Select "Clear Panel"
Create/Configure another "action button"
Updates all input fields with the value currently stored in the database.

To check the functionality, modify the widget values and press the button: the last database values will appear again.
Length
Label
Select Action
10
Refresh
Select "Clear Panel"

2.4 COMMAND INTERFACE

This section presents the kind of statements that can be assigned to the "TCLCommand" field of the configuration panels, of course the same applies to statement used in a normal tcl procedure.

2.4.1 Syntax for tcl/tk commands

Some widgets can be used to trigger actions: an action is a sequence of tcl/tk statements, being the statements separated by a semicolon (;) such as:

set myCwp ":PARAMS" ; panCallPanel myPanel "cwp=$myCwp"; puts "Action Done"

The followings are examples of specific TCL statements :

Description
Syntax
Example
Execute a TCL procedure
<procedure> <parameters>
dbWriteWidgets all
Execute a UNIX command
exec <UNIX command>
exec date
exec ls [pwd]
exec process
Set a variable
set <varName> <value>
set gvar(myDate) [exec date]
set var1 $gvar(myDate)

2.4.2 Calling Other Panels

The panel editor supports two ways to call another panel.

Use the same Tcl interpreter
In this case the new panel is "sourced" by the calling panel and the two panel share the same Tcl interpreter and the same data space: the procedure panImportPanel supports this functionality.

This means that if the two contain widgets acting on the same variable name, whenever a change is done in one, this is automatically reflected to the other.
The called panel is not destroyed when the user closes it, but it is only iconified

Use an independent Tcl interpreter
In this case the new panel is run as it were invoked by another Tcl shell.
The calling panel and the new one are treated as two different processes with their own data space: the procedure panCallPanel supports this functionality.

Examples of how to call a panel
Call a panel from Tcl shell

fileName "ccdName=newName" "imageDir=cstest:image.imageDirectory"
Call panel through the procedure panCallPanel

panCallPanel filename "ccdName=newName" "imageDir=:ccstest:image.imageDirectory"
Call panel through the procedure panCallPanel and generating the run-time parameters as a list of parameters

lappend parList "ccdName=newName"
lappend parList "imageDir=appl_data:ccstest:image.imageDirectory"

panCallPanel filename $parList

The same apply in the case one wants to use panImportPanel in place of panCallPanel.

2.4.3 Send a Message to a Process

The library of the panel editor provides the procedure panSendCommand to send messages to other processes (see man pages for details).
panSendCommand <env> <proc> <cmd> <flags> <timeout> ?parameter list?

The <parameter list> can contain fixed values and widget names. In the latter case the name of the widget is internally replaced by the value stored in the widget.


The procedure returns "FAILURE" in case the command could not be delivered: an example of use is the following:

if {[cequal [panSendCommand ... ] FAILURE ] } {
set tmp "My Error Message"
tk_dialog .dialogue "Dialogue Box" $tmp info 0 OK
}

The procedure automatically calls a dialogue box to warn the user and stops the execution for the user's acknowledgment when :
· The timeout on message receive expires.
· The procedure sent a command unknown to the process.
· An error reply is returned

2.4.4 Command Feedback Window

This widgets is one of the panel's "standard component" and it is used to convey to the user information on the messages sent to other processes.

Each row contains a reply which contains the following information :

· Time Stamp
· Name of the command and optionally command Id.
· Name of the process (optional )
· Description of the reply

Here is an example of the output produced by invoking panSendCommand to send the command OBJFIX to the process trkwsControl.

The user is notified that the command OBJFIX was invoked.

10:38:16 OBJFIX cmd0 trkwsControl > INVOKED

and this is the reply

10:38:16 OBJFIX cmd0 trkwsControl > REPLY/ L OK

If the command cannot be sent, the following message appears :

10:44:05 INIT > INVOKED Failure sending the command

There is also the possibility to display some text to comment, for example, the purpose of a set of commands such as :

10:34:41 > *** Search Guide Star ***

2.4.5 Interface to The Command Feedback Window

For the user who wants to develop its own procedures (based on the seq_msgSendCommand procedure) to send commands, a set of procedures to interact with the Command Feedback Window is available.

panDisplayCommand

Let the user know that a given command has been sent/invoked.
The user has the possibility to add a comment giving more details of what the current action does , for example :

10:39:11 INIT > INVOKED Send Command to alttrkServer

panDisplayReply

Displays the reply associated to a given command.

panDisplayComment

Let the user display a description of the current action or status. This can be used to give the user high level description on the ongoing activities, for example at the beginning of a group of commands.

This an example of use of these functions in a very simple case :

if {[catch {seq_msgSendCommand $cmdCheck $envName $procName $cmd $parList} ret] } {

seq_errDisplay

panDisplayCommand $cmd $procName "Failure sending the command"

return "FAILURE"

} else {

set cmdId $ret

panDisplayCommand $cmd $procName "text describing the action" $cmdId

}

:

#

# Wait for Replies

#

set ret [catch {seq_msgRecvReply $flags $cmdId errFlag lastReply -${timeout}

# Display Message Reply

panDisplayReply $cmd $cmdId $procName $errFlag $lastReply $idx $ret

Hereafter is reported an example of messages taken from the TCS user interface :

10:35:08 > *** Search Guide Star ***

10:35:08 SRCGS agwsControl > INVOKED

10:35:08 SRCGS agwsControl > REPLY/ L OK

10:37:07 > *** Configuring to Error Minimum: 0.0 frequency: 0.1 ***

10:38:16 OBJFIX trkwsControl > INVOKED

10:38:16 OBJFIX trkwsControl > REPLY/ L OK

10:38:01 OBJFIX trkwsControl > REPLY/ L OK, superseded by valid equivalent command

2.4.6 EXAMPLE : Panel sending command to another process

The panel editor library provides a procedure (panSendCommand) to send commands to a process running either in the local environment or in a remote one : the procedure returns the reply of the message or a FAILURE ( see the corresponding man page for more details).

The panel editor provides a standard widget where all replies returned by a given command are displayed.

The table below describes what the user should do to create the panel and properly configure the widgets.

User Action
Parameter
Value/Action
Add Command Reply Widget

This widget will be placed just on top of the short help.

Select "Cmd. Reply"
Create and configure "button" widget

The button sends a command to the local cmdManager process to know its version number.

The version number is returned in the command reply and will appear in the Command Feedback Window.
Length
Label
Select Action

TCL Command
15
Send Command
Choose Send Command

Replace values within "<>" with :
panSendCommand "" cmdManager VERSION CHECK_ALL 2000

In case of errors the user will be notified with a dialog box reporting the reason of the error.

2.5 USER'S DEFINED PROCEDURES

During the GUI development some widgets can invoke TCL commands - e.g. - button widgets, then the user has two alternatives :

· Specify a sequence of TCL statements directly in the widget definition field, called TCL Command
· Invoke a TCL procedure . This latter solution is advisable when several TCl statements and in particular conditional statements are involved.

User's defined procedures can be :

Part of a library
These procedures are defined as any other TCL procedure and included in a TCL library.
The user has to specify the name of the library where the panel (during execution) can find the procedure. (see paragraph 2.8 for naming conventions on TCL libraries)
The library can be "linked" to the panel by using the selection "Register User Library" under the "Options" menu and the search path for the library follows the normal VLT conventions.


Local to the panel
These procedures are stored together with the panel definition.
Very often there is the need not only to send a command but also to verify the returned state, therefore the characteristic of those procedures are :

· They are very specific to the panel's functionality
· The body of those procedures is simple and small. This help prevent syntax mistakes which can make impossible to load later the panel again.


2.5.1 Standard procedures

Each panel ha assigned three special local procedures which allow the user to customize the GUI and which are executed at specific moments during the creation of the panel : all procedures used in the following procedures must be stored in a library

They are <fileName>GlobalData, <fileName>InitData, <fileName>Init, <fileName>Exit

<filename> GlobalData

This procedure is executed at the very beginning and it is used to define constants or default values. These values can be overwritten during run time by re-defining the new value in the command line during the invocation of the panel.

Example :
proc <filename>GlobalData { } {
global ccdName ccdRoot

# Variable Initialization

set ccdName ccdconCI_$env(CCDNAME)
set ccdRoot ccdtest
}

<filename>InitData

This routine is executed after having registered the panel as CCS application but before defining the widgets. This is the place where to define variables and any other type of data requiring to interact with the CCS environments to be defines, for example read the database or send a command to a process.

Example :
This example determine the name of an LCU environment according to the current focus

proc <filename>InitData { } {
global myLcu env tcsEnv

set attr @${tcsEnv}:Appl_data:TCS:msw:foc.currentFocus

if {[cequal [panDbRead $attr currentFocus] FAILURE]} {

panDisplayComment "Cannot Read Current Focus from $attr"

} else {

switch $currentFocus {

2 { set myLcu lt$env(TCSID)ada}

3 { set myLcu lt$env(TCSID)adb}

4 { set myLcu lt$env(TCSID)adc}

default {

panDisplayComment "WARNING : Undefined Focus"

}

}

}

<filename>Init

This routine is executed as last statement of the initialization procedure, here the user can insert code for specific initialization, for example, to re-configure widgets.

Example :
proc <filename>Init { } {
global ccdRoot imageDir expFile setupDir

# Initialize variables according to the current definition of ccdRoot

set imageDir "${ccdRoot}:image.imageDirectory"
set expFile "${ccdRoot}:exposure.fileNameUnComp"
set setupDir "${ccdRoot}:observation.setupDirectory"
}

The following example is taken from utility wpActivity and

proc wpActivityInit { } {
global cv wpMode wpActName wpText

# Add a text widget into the frame

UifText $wpText -width 80 -height 24
pack $wpText

# Enable/Disable components of the GUI according to the
# to the mode of operation : create or edit.

if {$wpMode == "Edit"} {
$cv.wpNumber configure -state disabled -relief flat
$cv.actName configure -state disabled -relief flat
}

# Load file containing the activity description.

wpLoadActivity $wpActName $wpMode
}


<filename>Exit
This routine is executed when the user `Quits' the panel.

2.5.2 Set Defaults or Constants

Users can define default values for variables or constants which are used in the procedures but these variables must be declared as `global'.

The standard procedure <filename>GlobalData must be used to define those default values, which can be overwritten by passing the new value in the command line (see paragraph 2.4.2 on page 40 ).

To do this :

· Click on "Set Global Var." : the template for the procedure <filename>GlobalData will appear in the text widget, ready to be edited to add the user definitions.
· Click on "Register Proc" when ready, to register the procedure definition. If that procedure has been already defined, it is accessible as any other from the "Edit proc ..." menu.

Example : This example of <filename>GlobalData procedure the user defines some database attributes which will be accessed by other procedure being part of the GUI.


proc <filename>GlobalData { } {
global ccdName ccdRoot

# Variable Initialization

set ccdName "ccdconCI_$env(CCDNAME)"
set ccdRoot "ccdtest"
}

2.5.3 Editing Local Procedures

The panel editor provides the GUI developer with an editing tool to browse through the "local" procedures of a panel.



WARNING !!

Syntax errors found in the procedure definition are detected only at run-time, therefore they can make the panel editor unable to load the panel definition again.

In order to avoid such mistakes it is recommended to :

· "Register" the procedure
· Try to execute the procedure before saving the panel.

Edit a New Procedure

Click on "ClearText" to clear the whole panel.
Edit the new procedure definition, according to the TCL rules : here follows a procedure template :
proc <name> { <parameter list> } {
... procedure body ...
}

When ready click on "Register Proc" and from this moment on :
- The procedure is known by the TCL interpreter and can be executed if assigned to a widget. Any other previous definition is replaced with the new one.
- The procedure is added to the list

Modify a Procedure

Select the procedure to modify from "Edit proc ...".

Edit the procedure definition according to the modifications to be done and when ready click on "Register Proc".

Get List of Local Procedures

Once the panel is loaded, the panel editor keeps track of the procedures included in the panel definition.

The button "Edit proc ..." is a menu listing the procedures included in the current panel definition : the selection of one of those entries will make the procedure definition appear in the text widget and ready to be modified.


Delete a Procedure

Select the procedure to delete from "Edit proc ..." and click on "Delete proc".
The procedure disappears from the list and its definition is cancelled, therefore it is not saved with the panel definition.

Caution : The user must take care of deleting the calls to a `deleted procedure' because the TCL interpreter will not be able to execute it.


2.5.4 Application Defaults

A X resource file can be associated to each panel and it is read before any widget declaration.


The name of this file is "X<filename>" without the .pan extension : for example testAllWidgets.pan looks for the resource file XtestAllWidgets.


2.6 USAGE OF "Mega-Widgets"

The term "Mega-Widget" identifies a group of widgets that can be considered as a single entity.

At higher level GUI application there is the need for widgets implementing `application-specific' functionality and therefore the Panel Editor supports the development of GUI using an "object oriented" approach

The advantages in using `mega-widgets'.

· Re-usability : Mega-Widgets used in early phases or for engineering interface can be also used for real control panels

· Ease GUI Development : Development of large panels can be split up in the creation of smaller panels that can be integrated together.

· Extension of VLT Look & Feel Concept : Telescope and Instruments can use the same components for the development of GUI applications.

The panel editor itself can create special kind of widgets called "uifClass-widget" : in this context we will use the term "class" as a synonym for "Mega-Widget".

2.6.1 Import a "Mega-Widget"

The panel editor allows the user to add a "Mega-Widget" or a "uifClass-widget" to the panel.

The procedure is valid for both kinds of widgets

- Click on "Import Mega-Widget ..." to add an itk widget
- Click on "Import UifClass ..." to add a mega-widget generated by the panel editor.

A class browser allows the user to select a class. On top of the class browser there are radio buttons allowing the user to set the search directory to : Module, INTROOT, VLTROOT, VLTDATA, TCLTK_ROOT or Other.

The class browser is automatically positioned to the corresponding lib directory, when the user selects the VLT standard search paths


2.6.2 Panel Editor "uifClass-Widget"

The panel editor itself can create special kind of Mega-Widgets called "UIF Class" : in this context we will use the term "class" as a synonym for "Mega-Widget".

The uifClass has been introduced to add the concept of re-usable `sub-panel' to be associated to DB classes. These classes have a set of pre-defined methods and public variables and the panel editor does not provide means to add new methods/public variables.

Therefore all DB attributes should be specified with a `relative' symbolic address and in particular the user should identify a `common' root point.

The user can define a point of the database to be used to resolve the DB `relative' addresses : this point is called Current Working Point (CWP) and can be specified in the command line calling the panel (we refer to this to as `panel CWP').

A uif-class is meant to provide a GUI for the data stored under a specific DB sub-tree, therefore each instance of the class has an additional CWP. This additional CWP allows the user to configure the different instances of the class to get the data from different DB sub-trees.

If the class CWP is defined as `relative' address, the class DB attributes will refer to a resulting CWP obtained from the concatenation of the `panel CWP' (:p1:p2:p3) and the `class CWP' (p4:p5) ; in our example this results in ":p1:p2:p3:p4:p5".

Example of uifClass

This example shows how to configure the DB addresses in a class : the example uses the definition of the class showing the CCD clock pattern.



The panel using this class is invoked by specifying the "panel CWP" and possibly the environment where to access the data: some examples are the followings :

fileName "cwp=:Appl_data" To access the local Rtap Environment
fileName "cwp=@wte16:Appl_data" To access a remote Rtap Environment

The table below shows what will be the run-time complete DB symbolic address of one of the above DB attributes with different setting of the panel and class CWP.

Panel CWP
Class CWP
Class DB
Attribute
Complete Symbolic Address
:Appl_data
<alias>ccdtest
readout:clock_1.speed
<alias>ccdtest:readout:clock_1.speed

ccdtest
readout:clock_1.speed
<relative>ccdtest:readout:clock_1.speed
$wte16:Appl_data
<alias>ccdtest
readout:clock_1.speed
$wte16<alias>ccdtest:readout:clock_1.speed

ccdtest
readout:clock_1.speed
@wte16<relative>ccdtest:readout:clock_1.speed

Example of "embedded" uifClass

This is taken from the panels used for testing and shows an example of use of "embedded" classes and how to configure them to access database values ; in particular how panel CWP and class CWP work together.

What follows is the structure of the database used by the above panel .

Create a "uifClass-widget"

uifClass-widgets are generated by the panel editor, as follows :

· Design the class layout as a normal panel : use "relative" DB symbolic addresses common to a single point of the database.

· Save the panel using "Save Class as ..." .
The name of the file is converted into <fileName>_uifClass.tcl , for example, if the user specifies only "ccdClock", this is converted into "ccsClock_uifClass.tcl".
The name of the file is also used to retrieve the name of the class.

NOTE : The menubar and the short help, if present, are automatically taken away when the panel is saved as `class'.

· To make the class ready to be imported into other panels it must be included into a library.Once the class is created and the name added to the Makefile do : make all install.

Import a "uifClass-widget"

To import a class to a panel , push "Import UifClass ...".

Configure a "uifClass-widget"

The configuration of a uifClass is limited to a few parameters. To configure the instance of the "uifClass-widget", move the cursor onto the widget, click <B3> and the one of the following configuration panel will appear.



The configuration of a uifClass is limited to a few parameters.

· The class is created surrounded by a default frame, but the user can select one of the following possibilities : flat, raised, groove and ridge.

· The class "working point" is used to resolve the `relative' DB addresses of the widgets used in the different instances of the class : for details see paragraphs 2.6.2 and .

WARNING !!
Assign to class instances always different names to avoid clashes in the naming space of array gvar(). In particular this is possible when one wants to create two classes which are importing a common class.


Editing a "uifClass-widget"

The layout of an existing uifClass-widget can be edited by loading its definition through the command "Load Class" and the new layout can be saved by using "Save Class" or "Save Class as ...".

2.6.3 Public Domain "Mega-Widget"

These widgets are implemented in straight itcl (incremental Tcl) or itk (incremental Tk) : this allows the user to implement widget with very specific and more flexible functionality.

These widgets must be stored in a directory with a tclIndex file to be able to use them in the panel editor.

Create a "Mega-Widget"

To build a "Mega-Widget" do the following steps:
· Edit the class using a normal editor following the itk/itcl rules.
· Save the class to a file.
(Do not use the word "uifCLass" in the name of this type of classes )
· To make the class ready to be imported into other panels it must be included into a library.Once the class is created and the name added to the Makefile do : make all install.

Import a "Mega-Widget"

To import a class to a panel , push "Import Mega-Widget ...".

Configure a "Mega-Widget

When the panel editor imports the Mega-Widget, it assigns a default names to the instance of the Mega-Widget and the instance is created with the `default' configuration parameters.
To configure the instance of the "Mega-Widget", move the cursor onto the widget, click <B3> and the one of the following configuration panel will appear.

The `Library' entry field is automatically set when the class is included in the panel.

The user has access to all widget's options (public variables) and can configure the widget as follows :
- Select the parameter to configure from the list box : name and current value of the selected parameter will appear in the corresponding entry widgets.
- Modify the `Value'
- The user can change several parameters before clicking on `Apply' to reconfigure the widget.

2.6.4 Panel Editor "Mega-Widgets"

There is a set of itk-implemented mega-widgets provided by the panel editor.

They are stored in the uifCommon library and are available by selecting "Common" in the widgets window of the panel editor ( see paragraph 3.4 on page 73 ).

2.6.5 Link to Widget's Libraries

Sometimes a class library is based on the use of another class library and when the user attempts to `import it', he gets the following message :


Error : cannot inherit from unknown class "<class name>"

The message show that it is not possible to create an instance of the current class because there is no link to the library containing <class name>.


In this case do the following :


· Open the menu "Options" of the panel editor
· Select "Register UserLibrary"
· Add the name of the library containing the missing class. The library is searched using the VLT searching path : Module, INTROOT, VLTROOT.
· Re-import the class

2.7 DEBUGGING COMMANDS

2.7.1 Description of "DEBUG" menu

This section describes the debugging commands available when developing panels.

Panel Debug Levels

· User Level : This is the recommended mode which logs on the screen information such as : Current Working Point, results of event's attach/detach operations, failure on reading DB values, etc ..
· Develop Level : more specific information is logged on the screen, such as : specific logs on uifClass.

Sequencer Debug Levels

The sequencer can also print on the screen, for debugging purposes, some information regarding the parameters a given procedures has been called with and some other completion status.
The panel editor provides an interactive interface to enable/disable the printing of this information for a given subset of these functions.

Enable Polling

This is used to enable/disable the database polling during editing.

Start/Stop Events


Events are automatically activated as soon as a widget is configured. If the debug level is set, a short message is logged also on the screen providing information on : widget name, script associated to the event, event identifier and DB attribute, for example :

USER DEBUG > UifOutput panel-wdg1 script = {panEvtDbUpdate panel-wdg1 %A %T %D %Q}
USER DEBUG > ATTACH EVENT (event0) to attribute >> ....

If an error occurs when the event is defined the following log appear on the screen :

USER DEBUG> DB EVENT ATTACH fAIL for @wte6705:PARAMS:SCALARS:scalar_int5

Show Widget Info

This command pops up a window containing the list of all widgets of the panel under editing. At the top there is a summary of the number and type of widgets in the panel, in particular :

· Total Number of Widgets
· Number of uifClass widgets
· Number of polling or event Driven output widgets

Widgets are described by their main configuration parameters, such as :

Widget Type
Specifies the widget's class, such as : UifOutput, classFrame, etc ..
dbMode
If the widget is associated to a Database Variable , this field specifies the type of update : polling or event based.
Filter
Specifies the type of filter used to trigger the event.
XXX_uifClass
Defines the type of uifClass
uifClass Instance
Name of the uifClass -widget instance
Widget Name
Name of the widget
Label
Shows the widget label when applicable to help the user identify the widget in the panel.
Variable
Variable associated to the widget.

When the user select an entry of the list, the corresponding widget in the panel is highlighted by changing its background color.

· Update Widget List. Updates the list of widgets when a new panel has been loaded or after new widgets have been added to the panel.
· Cancel. Close the panel.

2.7.2 Activate Run-Time DEBUG Flags

The debug information can be obtained also for running panels by specifying the value of variable panDEBUG in the command line as specified in the following table, for example :

> panelName "panDEBUG=on" "seq_debug(seq_ccsInit)=1" &

The sequencer debugging flags can be enabled/disabled by setting the element of the seq_debug global array which corresponds to a given procedure.

For example "seq_debug(seq_dbReadSymbolic)=1" enables to print debugging information for the seq_dbReadSymbolic procedure.

Debug Flag
Comment
panDEBUG=dbgUSR

panDEBUG=on
(kept for backward compatibility)
Activate User Level debug which prints on the screen the following information :
- Prints the values for the DB CWP of the used environments
- Prints the results of the DB event "attach/detach" operations
panDEBUG=dbgDEV
Activate Developer Level debug.which provides additional information with respect of what provided by the "User Level" such as :
- Prints the information generated by database events
- Prints the relevant parameters of panSendCommand.

seq_debug(seq_ccsInit)=1
seq_debug(seq_msgSendCommand)=1
seq_debug(seq_dbReadSymbolic)=1
Enable the printing of DEBUG information for :
- ccsInit routine.
- msgSend Command routine
- dbReadSymbolic routine

2.8 BUILDING PANELS IN THE VLT ENVIRONMENT

2.8.1 Makefile

To develop panel files that are compatible with the VLT Standards:

· Panel
Panels should be developed under the src directory of your module.
In the directory the panels are stored as "fileName.pan" and are installed in the bin directory as any other script without the `.pan' extension.

In the Makefile the variable PANELS or PANELS_L contains the list of panels (without the `.pan' extension )

· Bitmaps
Bitmaps should be stored under the bitmaps subdirectory of the module.
..(mod)../
|-----src/
|-bitmaps/
| |-- shutter.xbm
. |-- .....

In the Makefile add the following lines to correctly install the bitmaps :

install : install_all
cp ../bitmaps/bitmap.xbm $(VLTTOP)/bitmaps
@echo " . . . installation done"

· TCL Libraries
TCL libraries are formed by files with `.tcl' extension and for each library the file tclIndex contains the list of all files belonging to the library. This file is automatically generated.

A TCL library is installed as a directory under the lib sub-directory of the module.
The name of the directory has the following format lib<name of the library>.tcl, for example if the name of the library is `uifClass', the corresponding directory will be libuifClass.tcl.

In the Makefile the variable TCL_LIBRARIES contains the list of TCL libraries :

For each library one has to specify its `objects' or members. Each member is the name of a file without `.tcl' extension, for example :

lib1_OBJECTS = file1 file2 file 3 ...

2.8.2 File naming

To allow portability, the panel editor uses special search rules to locate files (other panels, bitmaps, etc). Each file must be specified using the filename and the subdirectory branch of the VLT structure :where it should be located, e.g., bitmaps/xyz.xbm.

The procedure findVLTFile must be used to locate files in the VLT file system structure : for example if the current directory is ~user/development/mymod/src, and the file to be searched is bitmaps/ntt.xbm, then the procedure will look for the following files :

./ntt.xbm
./bitmaps/ntt.xbm
~user/development/mymod/bitmaps/ntt.xbm
$INTROOT/bitmaps/ntt.xbm
$VLTDATA/bitmaps/ntt.xbm
$VLTROOT/bitmaps/ntt.xbm

2.8.3 Example of Makefile

Here follows an example of Makefile summarizing the rules mentioned in the previous paragraph.

This example of makefile shows only the parts strictly related with TCL.

#
# TCL scripts (public and local)
# ------------------------------
TCL_SCRIPTS = testProcess

testProcess_OBJECTS = testProcess
testProcess_LIBS =

#
# Declare the list of panels
#
PANELS = testButton testInputPanel testMainPanel\
testOutputWidgets
#
# TCL libraries
#
TCL_LIBRARIES = userLib

#
# Define the contents of the TCL library
#
userLib = class1_uidClass class2_uifClass \
tclFile1 tclFile2
:
:
#
# INCLUDE STANDARDS
# -----------------
include $(VLTROOT)/include/vltMakefile

WISH = seqWish -f

2.9 CAVEATS

This section describe some common problems and the possible causes.

2.9.1 LOAD Operation Fails

The load operation is based on the `source' of the panel's definition file , that is, the definition file is interpreted by the Tcl/Tk interprets as it were a `single statement'.

As soon as an error occurs the `source' operation exits, therefore parts of the definition can be lost : this is typically the case of the user's procedures defined at the end of the file.

2.9.2 SAVE Operation Fails

At the beginning of the operation the file is saved in a `backup' copy : the backup copy of the file contains the character "~" after the file names' s extension.

The operation "Save as ..." check if there is already a file having the new name and makes a backup copy.

Possible causes are :

· Typically this fails for a syntax error in a user's defined procedure. To avoid this risk it is better to execute the procedure as soon as it is created.

2.9.3 Widget already exists

A dialog box appears on the screen and wait for user's acknowledgment before proceeding.

Possible causes are :

· When a new widget is created : the panel editor attempts to automatically rename the widget with a new valid name.
· When the user configures a widget with the name of an existing widget.

2.9.4 Set CWP Fails

A dialog box appears on the screen and wait for user's acknowledgment.

Possible causes are :

· Environment not active : Check the value of RTAPENV environment variable and verify if the Rtap environment is running.
· The Database does not contain the point addressed in the CWP.

2.10 HOW TO REPORT A PROBLEM

Tcl/Tk is an interpreter and some time errors are discovered only at run time.

In case of run-time errors Tcl/Tk calls a dialog box containing the error stack.

This information is very important to trace the error back to where it happened and can be "Cut & Paste" into a file : the stack contains all the sequence of all the called Tcl/Tk procedures.

To "Cut & Paste" the stack do the following :

· Open the editor.
· Select the whole stack.
· Move the cursor to the end and press <CTRL> v

WARNING : The stack cannot trace procedures associated to widget binding.

The best way to help solve the problem is :

Check if the problem can be reproduced and send the SPR with the description on how to reproduce it : list of actions and files used to detect the problem.



Quadralay Corporation
http://www.webworks.com
Voice: (512) 719-3399
Fax: (512) 719-3606
sales@webworks.com
TOC PREV NEXT INDEX