6 MAN PAGES
The classCommon is a virtual class containing all methods and public
variables common to classContainer and classFrame
background <color> Color of the border, if the class is visible,
otherwise color of the background.
classSelect <index> Index of the class displayed by the widget.
This ranges from 0 to (N - 1), where N is the
total number of classes.
length <val> Widget length
nameInstance <string> Name of the instance.
show <0/1> Visibility flag
wdgConfig <list> For each class there is a list of configuration
parameters which are invoked when the class is
displayed.
If the class does not need configuration
parameters, the corresponding list must be empty.
wdgLibrary <list> List of library names where the classes to be
be displayed are stored.
At run time the search path follows the VLT
searching rules : module, INTROOT, VLTROOT.
The classContainer is a widget that can be configured to interactively
display a class out of a set of classes.
The widget is formed by :
- A checkButton : used to enable/disable the display of the class.
- A Title : the configuration changes according to whether it should
display a single class or a set of classes.
In the latter case the title is formed by a list of radioButtons
allowing the user to select the class to be displayed.
- A frame containing the class to be displayed.
Length and height are used when no class is visible in order to keep
its dimensions , otherwise the container assumes the size of the
included class.
The class inherits the methods of classCommon and provides :
show
Force the classContainer to display the class or not according
to the current value of the 'show' visibility flag.
(The 'show' visibility flag in inherited from the classCommon)
enableRadioButton <radio button list index>
Enables the radioButtons specified in the list.
The first radio button index start with 0
disableRadioButton <radio button list index>
Disables the radioButtons specified in the list.
The first radio button index start with 0
getRbVariable
Returns the name of the variable associated to the radioButtons.
enableRadioButton <radio button list index>
Enables the radioButtons specified in the list.
The first radio button index start with 0
The class inherits the widget options of classCommon and supports :
height <integer> Widget height
titleFont <font> Font for the labels of the radioButtons.
The following alias are valid:
- normal, big, small
- bold, bigbold, smallbold
titleList <name list> List of labels for the radioButtons
If this list contains a single element
the widget is configured as 'single-class'
container otherwise it is configure as
'multi-class' container.
wdgClassList <name list> List of classes to be displayed.
Create an instance
classContainer .w -background red -titleFont bold \
-wdgLibrary libtestClass \
-titleList {"Class#1" "Class#2 "Class#3"} \
-wdgClassList {xx_uifClass yy_uifClass zz_uifClass}\
-wdgConfig { {-cwp a:b} {-cwp a:c} {-cwp a:d} }
Re-configure the widget
.w configure -classSelect 2 Display class #2
.w configure -show 0 Set visibility OFF
.w configure -background blue Change color
Other operations
.w getClassPath Get full class path name
.w disableRadioButtons 0 2 Disable first and third radioButton
set lib [.w cget -wdgLibrary] Get a widget's resource
The classFrame is a widget that can be configured to display a class
out of a set of classes.
It does not support any interactive operation and the selection of the
class to be displayed is done programmatically.
Length and height are used when no class is visible in order to keep
its dimensions , otherwise the container assumes the size of the
included class.
The class inherits the widget options of classCommon and supports
the followings :
variable <val> Name of the variable used to set the class to
be displayed.
Public variable wdgConfig applies to all instances of the classes,
therefore the same configuration string is executed whenever a class
is created.
Create an instance
classFrame .w -background red -wdgLibrary libtestClass \
-wdgClassList {xx_uifClass yy_uifClass zz_uifClass}\
-wdgConfig { {-cwp a:b} {-cwp a:c} {-cwp a:d} } \
-variable gvar(selectFrame)
Re-configure the widget
.w configure -classSelect 2 Display class #2
.w configure -show 0 Set visibility OFF
.w configure -background blue Change color
Other operations
.w getClassPath Get full class path name
set list [.w cget -wdgClassList] Get a widget's resource
This procedure searches a file in the VLT file structure.
file <IN> - Name of the file in the format <relPath>/<fileName>.
<relPath> is a relative path to the file <fileName>,
for example "app-defaults/XerrEditor"
confirm <IN> - <yes/no> : flag specifying if the a dialog should
appear to the user in case the file does not exists.
Default value "yes"
The serach path is the following :
- Current Directory : using the basename only -e.g.- XerrEditor
- Current Directory : using the basename + relative path.
-e.g.- app-defaults/XerrEditor
- Parent Directory -e.g.- ../app-defaults/XerrEditor
- Integration Area -e.g.- $INTROOT/app-defaults/XerrEditor
- VLTDATA Area -e.g.- $VLTDATA/app-defaults/XerrEditor
- VLTROOT Area -e.g.- $VLTROOT/app-defaults/XerrEditor
The full pathname of the first occurrence is reported as return value.
This procedure should be used instead of the file name:
button .... -bitmap [findVLTFile bitmaps/xyz.xbm] ....
source [findVLTFile bin/bindings.tcl]
This procedure allows the user to call a panel and pass some parameters
in the command line.
<panelName> Name of the panel. The name is the same of the file
produced by the panel editor, without the ".pan"
extension
The panel to be invoked must be present in the "bin"
sub-directory of the following root directories :
current module , INTROOT or VLTROOT.
?parameter_list? List of parameters to be used in the command line.
An item of this list has the following format :
<var>=<value>
Where :
<var> Specifies a global variable
<value> The new value
Simple example :
panCallPanel myPanel "cwp=@wte13:PARAMS" "gvar(ccdName)=ccd"
Sometimes the list of parameters can be long or it is more convenient
to build it up in a list variable :
set myParList {}
lappend myParList "cwp=@wte13:PARAMS"
lappend myParList "gvar(ccdName)=ccd"
lappend myParList "pollRate=2000"
panCallPanel myPanel $myParList
panDbWrite <symbAddress> <value>
panDbWriteWidget <canvas> ?list of widgets?
panDbWriteClass <class_widget_path> ?list of widgets?
panDbWrite
This procedure takes the database <symbAddress> and convert it into
its absolute address, according to the Current Working Point.
In this way relative addresses are properly written according
to the current 'cwp' value.
panDbWriteWidgets
Loops on the widget list and stores in the database the values
of those associated to a database variable.
The procedure requires as first parameter the name of the parent
window containing the group of widgets to take into account.
The keyword "all" is used to address all the input widgets of the panel
panDbWriteClass
Loops on the widgets contained in a uifClass-widget and stores
all values associated to a database input.
The keyword "all" is used to address all the input widgets of the panel
In case of failure an error is logged and also printed on the screen.
If a want to write into the database element :PARAMS:SCALARS.scalar_int8,
there are the following possibilities :
- Using the absolute address :
panDbWrite @wte16:PARAMS:SCALARS.scalar_int8 1
- Using a relative address and cwp :
seq_dbSetCwp @wte16:PARAMS
panDbWrite @wte16<relative>SCALARS.scalar_int8 1
- Using the alias address :
panDbWrite @wte16<alias>SCALARS.scalar_int8 1
Other examples.
panDbWriteWidgets $cv all
panDbWriteWidgets $cv xxx-wdg23 xxx-wdg7
set myClass $cv.wdgClassName
panDbWriteClass $myClass all
panDbWriteClass $myClass wdgClassName-wdg23 wdgClassName-wdg7
panDisplayCommand, panDisplayComment, panDisplayReply - Set of
procedures to interact to the "Command Feedback Window"
panDisplayCommand <cmd> <text>
panDisplayComment <text>
panDisplayReply <cmd> <cmdId> <procName> <errFlag> <lastReply>
<replyIdx> <text>
This is a set of procedures allowing the GUI developer to interact
with the "Command Feedback Window" (CFW) . This is a widget that can
be added at the bottom of a panel by selecting the associated
checkbutton in the "Std. Component" menu of the panel editor.
Parameter description :
<cmd> - String specifying the command
<cmdId> - Command identifier : what returned by seq_msgSendCommand
<procName> - Destination process
<text> - Free text used to describe the command or the reply message
or a comment to the operator
<errFlag> - Indicates if the reply is an error : boolean value 1/0
<replyIdx> - Reply sequence number
panDisplayComment
This procedure allows to display a description of the current action
or status. This can be used to ive the user high level information
on the ongoing activities.
panDisplayCommand
Let the user know that a given command has been sent/invoked.
The user has the possibility to add a comment gving more details
of what the current action does.
This is automatically called by panSendCommand.
panDisplayReply
Displays the reply associated to a given command.
This is automatically called by panSendCommand.
The Panel Editor gives the software developer the possibility to
build interactively a panel: choosing widgets, placing then on the
panel to be build and configuring each widget.
The User Manual provides a complete description of available widgets
and the way to configure them.
To work properly in the VLT Standard Environments:
- develop your panels under the src/ directory of your module
and add each panel in the Makefile as a SCRIPT:
PANELS = panel1 panel2 ....
.
SCRIPTS = .... $(PANELS)
.
The standard treatment of a shell script is good also
for panels.
- if you need bitmaps, create them under a separate directory:
..(mod)../
.
|--bitmaps/
| |-- shutter.xbm
. |-- .....
and in the Makefile add the following lines:
install : install_all
.
cp ../bitmaps/bitmap.xbm $(VLTTOP)/bitmaps
.
@echo " . . . installation done"
This will install the bitmaps.
All these routines take the same parameters
<askFlag> If this is set to 'confirm', the user must aknowledge
before the panel is 'closed'.
?root? Name of the root window : by default it is set to "."
Panels generated with the panel editor have the name of
the file (without extension) as root window.
Example : xyz.pan have ".xyz" as root window.
panClosePanel
This procedure close and destroy a panel and exits the interpreter.
It also executes the exit procedure possibly associated with the panel.
panIconifyPanel
Close and iconify a panel.
(It is internally used to process panels called with panImportPanel)
# Close panel with root window = ".myRoot" and ask user confirmation
# before proceeding.
panClosePanel confirm ".myRoot"
This procedure allows the user to call a panel and pass some parameters
in the command line.
<panelName> Name of the panel. The name is the same of the file
produced by the panel editor, without the ".pan"
extension
The panel to be invoked must be present in the "bin"
sub-directory of the following root directories :
current module , INTROOT or VLTROOT.
?-iconify? If this is defined the imported panel is iconified
when closed.
?parameter_list? List of parameters to be used in the command line.
An item of this list has the following format :
<var>=<value>
Where :
<var> Specifies a global variable
<value> The new value
Simple example :
panImportPanel myPanel "cwp=@wte13:PARAMS" "gvar(ccdName)=ccd"
Sometimes the list of parameters can be long or it is more convenient
to build it up in a list variable :
set myParList {}
lappend myParList "cwp=@wte13:PARAMS"
lappend myParList "gvar(ccdName)=ccd"
lappend myParList "pollRate=2000"
eval panImportPanel myPanel -iconify $myParList
panEnableMenuEntry <mbLabel> <wdgLabel>
panDisableMenuEntry <mbLabel> <wdgLabel>
panQueryMenuEntry <mbLabel> <wdgLabel>
panGetMbPath <mbLabel>
panSetMbState <mbLabel> <state>
These procedures allow the user to get the description of a given menu
entry and to change its state.
The following conventions are used :
<mbLabel> - Identifies the label of a menuButton.
This is one element of the menu bar.
<wdgLabel> - Label of a menu entry.
<state> - New state of the button.
Valid velues are : disabled or normal.
panGetMbPath <mbLabel>
Returns the full widget name of a menubutton with label <mbLabel>
If returns "" if the menubutton does not exits.
panSetMbState :
This procedure set the state of a menuButton
It returns 0 in case of failure, 1 otherwise
panEnableMenuEntry, panDisableMenuEntry :
This procedure enables/disables a menu entry with label <wdgLabel>,
under the menubutton <mbLabel>.
It returns 0 in case of failure, 1 otherwise
panQueryMenuEntry <mbLabel> <wdgLabel>
This procedure searches for a menu entry with label <wdgLabel>,
under the menubutton <mbLabel> and returns a list with the following
elements :
- Full name of the menu containing the entry
- Type of the entry : cascade, command, checkbutton, radiobutton
- Position in the menu.
It returns "" - if the search was not successful
if {[set ret [panQueryMenuEntry MenuButton1 cmd1]] == ""} {
Process failure condition ....
}
if {![panEnableMenuEntry MenuButton1 cmd1]} {
Process failure condition ....
}
if {![panSetMbState MenuButton1 disabled]} {
Process failure condition ....
}
All these routines take as parameter the name of the panel canvas
canvas - <IN> Name of the panel canvas : by default this is '$cv'.
panResetPanel :
This procedure clears all entry fields according to the
type of data specified in the widget definition :
- NUMBER , the entry is set to '0'
- ASCII , the entry is set to ""
panSetDefaults :
This procedure sets all input widgets to their default values.
panUpdateCanvas :
This procedure updates all panel's input widgets to the current
associated database value.
This procedure invokes a File Selection Box to browse the file system.
dir Full path name of the directory where to start.
filter Defines a pattern to select a file from in the <dir> directory.
options Is a list of possible options to control the behaviour
of the file selction box :
-top <widgetName> Defines the toplevel widget name.
Used when several File Selection Boxes are
active at the same time.
-mode <w/r> Default value is "r". When "w" is specified
the procedure issues a dialog to ask the
user to confirm the selection of such a file.
The procedure checks that the file exists and
if the user has proper write permission to
to access the file.
-title <string> Title of the File Selection Box
-subDir <path> Relative directory path. This is automatically
appended to the MODROOT,INTROOT,VLTROOT,VLTDATA
-iconify The File Selection Boxes is iconified after the
selection otherwise it is destroyed.
-cd Forces to take always into account the directory
specified by <dir>
The fileSelectionBox provides the following interactive commands :
OK Select the file and close the dialog.
FILTER Update the list of files according to the current filter
CANCEL Quit the dialog
HELP Not used
The return value depends on which button the user clicked :
OK The full path name of the selected file.
CANCEL An empty string
global env
set myDir $env(HOME)/CCS/panel/src
set filter "*.tcl"
set filePath [panSelectFile $myDir $filter]
if { [cequal $filePath ""] } {
No files selected
return
}
This TCL procedure allows the user to send commands to a process.
<env> CCS Environment name
<proc> Name of the process where to send the message to.
<cmd> String defining the command
<flags> Used to define the checks to be performed before sending
the message, and how to process reply messages
Valid keywords are :
NO_CHECK, CHECK_ALL To check the syntax of the message
when it is sent.
-quiet Replies are not displayed
-noErrDisplay Error dialog is not displayed.
-all Return all replies in one go separated
by a newline
-last Wait for the last reply and returns only that.
If flags is "" the option CHECK_ALL is taken by default
<timeout> Timeout (in mSec) during the receive.
?args? Optional list of parameters to send along with the
command. This list of parameters can also contain widget
names : in this case the name of the widget is replaced
with the value associated to the widget.
The current implementation allows to send 'synchronous command',
therefore the procedure returns only when all replies have been received
or at the first error reply.
The user is informed in case of error reply. The error dialog appears
on the screen with the error description and requires an acknowledge before
continuing.
It is advisable to use the 'position independent' syntax to send
commands to the LCUs, because the arguments are automatically
concatenated with ","
This code to be used to handle the command's reply.
set myReply [panSendCommand ... ]
if {$myReply == "FAILURE"} {
process failure condition
} else {
process reply information
}
Hereafter there are examples on how to send commands to a process.
This example uses the following conventions :
- wdg1, wdg2 are the names of two widgets
- var1, var2 are the names of the variables associated to the widgets
- par1, par2 are the argument names of the parameters accepetd by the
command.
COMMAND with a SINGLE PARAMETER
panSendCommand $env $proc CMD "" 1000 wdg1
panSendCommand $env $proc CMD "" 1000 $gvar(var1)
Several arguments can be bundle together a a single parameter
panSendCommand $env $proc CMD "" 1000 \"dummyVar $gvar(var1) wdg2 \"
NOTE : it is important to place \" at the beginning and
at the end of the parameter list when widget names
appear in the parameter list otherwise there will be no
substitution with the corresponding value.
COMMAND with SEVERAL PARAMETERS
This is 'position dependent' syntax
panSendCommand $env $proc CMD "" 1000 wdg1 wdg2
panSendCommand $env $proc CMD "" 1000 $gvar(var1) $gvar(var2)
Parameters must be separated by "," in order to have rage checking work
but references to widget names must be
panSendCommand $env $proc CMD "" 1000 wdg1 , wdg2
panSendCommand $env $proc CMD "" 1000 $gvar(var1) , $gvar(var2)
'position independent' syntax : arguments can be also specified in
pairs -<name> <value> . In this case it is not important the order
within the parameter list.
panSendCommand $env $proc CMD "" 1000 -par1 wdg1 -par2 wdg2
panSendCommand $env $proc CMD "" 1000 -par2 wdg2 -par1 $gvar(var2)
COMMANDS to LCUs
These commands require the arguments to be separated by ",".
panSendCommand $env $proc CMD "" 1000 "$gvar(var1),$gvar(var2)"
UifActionButton defines a specific class of buttons which are normally
added in the bottom part of the panel.
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifIntercativeWidget classe and supports :
command <string> Tcl statement to be executed.
label <string> String used to label the button
width <integer> Determine the widget length (in characters)
Create an instance
UifActionButton .w -label myAction -stateVar gvar(myVar) -width 10 \
-command {puts "this is an action button"}
Re-configure the widget
.w configure -label "new label"
Other operations
.w disable ; Disable widget
set label [.w cget -label] Get a widget's resource
UifArrowsButton is a widget formed by two buttons showing two
arrows (up/down arrows). The widget can be linked to a variable
and used to increment/decrement the value in steps.
The itk 'component' method returns the component's full name.
upArrow - button with the 'up' arrow
downArrow - button with the 'down' arrow
Inherits options from UifWidget classe and supports
the followings :
variable <string> Name of the variable to control
incrStep <integer> Value used to increase the variable : default +1
decrStep <integer> Value used to decrease the variable : default -1
script <string> Name of the procedure to invoke when either
up/down buttons are clicked.
The value of the variable is modified first and then
the procedure is executed.
Create an instance
UifArrowsButton .w -variable gvar(myVariable) -incrStep +2
-decrStep -3 -script processStep
Re-configure the widget
.w configure -decrStep -5
Other operations
set script [.w cget -script] Get a widget's resource
The itk 'component' method returns the component's full name.
max - Label for the max value
min - Label for the min value
uifBarChart - Bar Chart widget
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
axis <1/0> Enable show axis
barColor <color name> Bar color
length <number> Widget length
minVal <value> Minimum value of the bar : can be real
maxVal <value> Maximum value of the bar : can be real
orient <h/v> BarChart Orientation : horizontal or vertical
ticks <1/0> Enable show ticks
variable <var. name> Name of the variable associated to the widget.
Create an instance
UifBarChart .w -barColor Blue -ticks 1 -axis 1 -dbMode dbPoll\
-label barChart -length 100 -maxVal 150-minVal -20 \
-orient h -ticks 1 -variable gvar(myVar)
Re-configure the widget
.w configure -label "new Label" -barColor Red -minVal -20.5
Other operations
set label [.w cget -label] Get a widget's resource
set minVal [.w cget -minVal]
UifBitmap defines the class for the VLT Bitmap widget.
The bitmap can be also configured as "Hot-Spot" allowing the user
to click on to trigger some actions.
The itk 'component' method returns the component's full name.
title - Label giving a title to the bitmap
uifBitmap - Bitmap widget
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from uifWidget and supports :
bitmap <string> Path where to load the bitmap from.
command <string> Tcl statement to be executed.
frame <string> This sets a frame around the bitmap : all
TK frames are valid.
hotSpot <1/0> Configures a bitmap as "Hot-Spot"
The Hot-Spot feature is enabled only if the
option "command" is not empty.
hotSpotColor <string> Specifies the background color when the
bitmap gets focus.
label <string> Label on top of the bitmap
Create an instance
UifBitmap .w -command {puts "NTT Bitmap"} -frame raised -hotSpot 1 \
-hotSpotColor Green -label {NTT Bitmap}
Re-configure the widget
.w configure -label "new Label" -frame groove -hotSpotColor Red
Other operations
set bitmapPath [findVLTFile bitmaps/ESO.xbm]
.w configure -bitmap $bitmapPath Set New Bitmap
set bitmapPath [.w cget -bitmap] Get a widget's resource
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifIntercativeWidget class and supports :
bitmapFile <string> File to be used as bitmap
label <string> String used to label the button
popup <1/0> If set to 1, the string "..." is added to
to the button label to let the user know that
the button calls a panel.
Create an instance
UifButton .w -command {panCallPanel anotherPanel} -popup 1 \
-label myLabel -stateVar gvar(myVar) -width 10
Re-configure the widget
.w disable ;# Disable the widget
.w configure -label "new label" -width 15 -popup 0
.w configure -command "sendCommand <env> <proc> <cmd> <par list>"
Other operations
set myCmd [.w cget -command] Get a widget's resource
set myLabel [.w cget -label]
Inherits methods of class UifInteractiveWidget and supports
the following :
flash
Flash the check button by re-displaying the widget several times
alternating between active and normal colors.
This command is ignored when the check button is disabled.
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifIntercativeWidget classe and supports :
command <string> Command to execute when the user clicks the
button. The <variable> is updated first and
then the command is executed.
label <string> String used to label the widget
offVal <string> or Configures the widget 'OFF' state.
<integer> It can also be DB symbolic address.
onVal <string> or Configures the widget 'ON' state.
<integer> It can also be DB symbolic address.
variable <string> Variable associated to the widget
width <integer> Widget length.
Create an instance
UifCheckButton .w -label myLabel -variable gvar(myVar) -width 10 \
-onVal 18 -offVal-10 -command {callMyProcedure}
Re-configure the widget
.w configure -onVal 321 -label "new label"
.w disable ;
Other operations
Set OFF value by reading a DB attribute.
.w configure -offVal "@wte16:PARAMS:SCALARS.scalar_int8"
set myLabel [.w cget -label] Get a widget's resource
set myVar [.w cget -variable]
UifEntry defines the class for the VLT entry widget. The entry widget
is formed by a single line and allows the user to type in data.
The itk 'component' method returns the component's full name.
uifEntry - Entry widget
label - Optional label at the left widget side
Inherits the methods of class UifInteractiveWidget and support :
enable
Enable the widget editing functions.
Overloaded from UifInteractiveWidget class.
disable
Disabel the widget : it will appear with 'flat' relief.
Overloaded from UifInteractiveWidget class.
checkType (Not yet implemented )
Returns 1 if the input is of the proper type otherwise 0
valid types are : ASCII or NUMERICAL
checkRange
Returns 1 if the input is on range otherwise 0.
get <from> <to>
Returns the current widget value
setRange (Not yet implemented )
Defines range
insert <pos> <text>
Insert <text> in position <pos>
delete <first> <last>
Delete characters from position <first> to position <last>
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifIntercativeWidget classe and supports
the followings :
asciiFlag <1/0> Not Implemented
label <string> String used to label the widget
labelFont <string> New font for the label
labelWidth <string> Label width : can be used to align several
widgets with different labels in columns
maxVal <value> Not Implemented
minVal <value> Not Implemented
units <string> String attached to the right side
indicating the nature of the value
variable <var. name> Variable associated to the widget
width <integer> Set the length of the entry field
<Delete> Deletes character left to the insertion cursor
<BackSpace> Deletes character left to the insertion cursor
<End> Sets insertion cursor at the end of the field.
It displays the last part of the typed-in data.
<Home> Sets insertion cursor at the beginning of the field.
It displays the beginning of the typed-in data.
<Arrow-Left> Moves the insertion cursor leftwards
<Arrow-Right> Moves the insertion cursor rightwards
Create an instance
UifEntry .w -maxVal 60 -minVal -20 -width 10 -variable gvar(myVar)
Re-configure the widget
.w configure -width 15 -maxVal 10
Other operations
set min [.w cget -min] Get a widget's resource
set myVar [.w cget -variable]
.w disable ;
The itk 'component' method returns the component's full name.
filter - Entry widget : 'filter' specification
selection - Entry widget : 'selection' specification
listDir - List Box : list of sub-directories
listFile - List Box : list of files in the selected sub-directory
The class supports the following methods :
filter <mask>
The File Selection Box is updated with the list of files found
in the current directory whose names match with the <mask>.
For example : <widgetName> filter "*.tcl"
will display all files with '.tcl' extension.
CD <directory>
The File Selection Box is updated with the list of files found
in the new directory and according to the current filter mask.
dirGeometry <w>x<h> Width/Height of the box listing the directories
fileGeometry <w>x<h> Width/Height of the box listing the files
iconify <1/0> Controls the treatment of the 'toplevel'
window after a selection :
'1' , the 'toplevel' window is iconified.
'0' , the 'toplevel' window is destroyed.
mask <string> Defines the extension of the files to be
displayed in the box.
path <dir> If this is defined, the returned file name
is relative to the <path> directory
title <string> Specifies a title for the 'toplevel' window.
topLevel <widget name> Name of the top level window.
The returned value is stored into two global variables :
<widgetName>_fsbReturn contains the selected filename.
<widgetName>_fsbInfo contains a the following list of information
about the file :
- type : Returned values are file, directory, link or socket
- size : File size in bytes
- exist : Boolean flag to indicate if file exists
- writable : Boolean flag to indicate if file is writable
for the user
If the user did not select any file the both returned global variables
are set to "".
Define toplevel window
set wtop .browser
toplevel $wtop
Create instance of UifFileSelBox : the mask is set to look
for Tcl files and after the selection the panel is only iconified.
set fsb $top.fsb
UifFileSelBox $fsb -fileGeometry 30x10 -dirGeometry 15x10 \
-mask "*.tcl" -topLevel $wtop -iconify 1
Configure the file selection box to return filenames relative
to a given directory -e.g.- VLTROOT
$fsb configure -path $VLTROOT
$fsb filter "*.c" Refresh list of files according to the new mask.
$fsb CD [pwd] Change directory
Wait for the user selection : in this case the Tcl interpreter must
wait until the user has selected a file or pressed 'Cancel'.
uplevel #0 vwait ${fsb}_fsbReturn
set filePath [uplevel #0 set ${fsb}_fsbReturn]
UifInteractiveWidget - Virtual class containing common variables
and methods for interactive widgets
UifInteractiveWidget is used to inherit widget options and methods
common to the VLT interactive widgets.
The class supports the following methods :
enable
Configures the widget as 'enabled'
disable
Configures the widget as 'disabled'
stateVar <name> Name of the variable used to control the state
of the widget : enabled or disabled.
default <string> Defines the default value for the widget.
initialState <boolean> Determines the widget's initial state.
Applies to uifButtons and uifActionButtons only.
UifLed defines a widget implementing a LED device and it is
just providing the functionality to change the Led color.
This is used to build other more complex widgets such as
UifOutputLed where the switching happens automatically according
to the value of a variable.
Supports the following options :
colorOn <string> Color to display when the LED is ON.
colorOff <string> Color to display when the LED is OFF.
ledColor <string> Sets the led to a given color.
The two other options do not change
the led color but are used only to
'store' the colors for ON/OFF states.
Create an instance
UifLed .w -colorOn red # Create an instance
Re-configure the widget
.w configure -ledColor Blue
Other operations
.w setColor green
.w configure -ledColor Blue Set Led color
UifListBox defines the class for the VLT List Box widget.
The widget also provides a vertical and horizontal scroll bars
which can be enabled/disabled through the associated widget options.
The itk 'component' method returns the component's full name.
scrollh - Horizontal scroll bar
scrollv - Vertical scroll bar
uifListBox - Listbox widget
General remarks :
- Positions in the list start at element 0.
- keyword "end" identifies the last position of the listBox
addItem <pos> <text>
Adds the string specified in <text> at position <pos>
addItemList <pos> <list>
Adds the specified list of items from position <pos>
clearSelection
Clears all selections
deleteItem <first> <last>
Removes from the list elements from <first> to <last>.
If <last> is omitted, only the element <first> is removed.
getIndex
Returns the index of the currently selected item.
getList <first> <last>
Returns a list of elements, from <first> to <last>.
If <last> is omitted, it returns the element from the <first> on.
If this is called without parameters, it will return the whole
list elements.
getSize
Returns the total number of elements in the list.
getItem <pos>
Returns list elements in position <pos>
If <pos> is a wrong number, it return an empty string ("").
getSelection
Returns the currently selected item.
If no element are selected or the listBox is empty it returns
an empty string ("")
moveto <h/v> <pos>
Shows the <pos> percentage of the listbox along h=horizontal or
v=vertical direction : <pos> must be in the range of 0 and 1,
being 0 the top/left-side and 1 the bottom/right-side.
setBind <key> <action>
Allows the user to define specific binding.
setSelection <pos>
Sets the selection to element <pos> and returns the value of the
selected element(s) : selected elements are highlighted.
If the selection mode is not 'single' more than one element can
be selected : if <POS> = ALL all elements are selected.
updateList <array> <formatting_procedure>
Initializes the content of the listBox with the content of the <array>
Each element of the <array> becomes an entry of the listBox and
it is displayed according to the format returned by
<formatting_procedure> (see example)
updateSortList <order> <type> <array> <formatting_procedure>
Perform the same function described for 'updateList', but the <array>
is first sorted according to the following flags :
<order> Specifies the ordering as : "-decreasing" or"-increasing"
<type> The type of data to be sorted : "-ascii", "-integer" or
"-real"
If <order> <type> are set to "", the following default values
are used : "-increasing", "-ascii"
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifInteractiveWidget class and supports :
font <font name>
geometry <width>x<height>
itemList <list> List of elements.
label <string> Give a title to the listbox
scrollx <1/0> Enables X scrolling : default is 1.
scrolly <1/0> Enables Y scrolling : default is 1.
selectmode Valid values : single/browse/multiple
variable <var. Name> Name of the variable where to store
the selection.
<Button-1> Selects an element of the list.
The selected element is stored into the variable specified
by widget option 'variable'.
Create an instance
UifListBox .w -label myListBox -variable gvar(myItem) \
-geometry 10x5 -scrollx 1
.w setBind <B1-ButtonRelease> "myProcedure" # Set Bindings
Add and Delete Elements
set myList { item1 item2 item3 }
.w addItemList end $myList
Another alternative
foreach item $itemList {
.w addItem end $myList
}
The following table summarizes the widget behaviour when the use
uses the 'setSelection' method to choose elements, for example, when
the widget is configured as follows :
UifListBox .l -itemList { a b "c d" e f g } -variable tmp
selectmode | statement | tmp contains
______________________________________________________________________
single | .w setSelection 2 | "c d"
| .w setSelection 5 | g
| .w setSelection 2 3 5 | g (the last element)
| .w setSelection ALL | g ( tmp does not change)
| |
browse/multiple | .w setSelection 2 | {c d}
| .w setSelection 2 3 5 | {c d} e g
| .w setSelection ALL | a b {c d} e f g
Examples using arrays : In this example each element of the array
contains the information on a country : continent, area.
set array(japan) "Asia 144"
set array(china) "Asia 1247"
set array(Brazil) "{South America} 3286"
set array(France) "Europe 211"
proc myFormat { text } {
set country [lindex $text 0]
set pop [lindex $text 1]
set newText [format "%-20s %5d" $country $pop]
return $newText
}
List items are displayed with no format
.w updateList array ; # List items are displayed with no format
.w deleteItem 0 end ; # Clear the list Box
List elements are displayed according to the format
.w updateList array myFormat
List elements are sorted and displayed according to the format
.w updateSortList "-decreasing" "-ascii" array myFormat
The methods use the following parameters :
<label> String to label the entry
<uline> Character to be used as 'accelerator key' :
- 1 identifies the first character
- 0 No characters are underlined
<command> TCL command to be executed
<var> Variable to associate to the Check/Radio Button
<value> Value assigned to <var>
The class supports the following methods :
getSize
Returns the total number of elements in the Menu.
addSubMenu <name> <label> <uline>
addCommand <label> <uline> <command>
Add an entry allowing the user to invoke a TCL command and behaves
like a button widget.
addRadioButton <label> <uline> <command> <var> <value>
Add an entry configured as RadioButton.
Related entries share the same variable <var>
addCheckButton <label> <uline> <command> <var>
Add an entry configured as CheckButton.
The button assigns values 0/1 to the associated variable <var>
addSeparator
Add an entry configured as separator.
This is used as graphic decoration to group entries together.
The next set of methods implement functions on a generic entry.
General Remark :
- Entries start with index 0
- Keyword "last" always identifies the last entry of the menu
deleteEntry <from> <to>
Delete menu items from position <from> to position <to>
enableEntry <pos>
Enable selection of entry in position <pos>
disableEntry <pos>
Disable selection of entry in position <pos>
getMenuName
Get full name of the menu associated to the widget.
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifWidget class and supports :
label <string> String used to label the button.
width <number> Widget length
tearoff <1/0> Enable/Disable the tearoff capability.
When enabled the menu associated to the menubutton
remains 'opened' until the user selects an item.
UifOptionButton defines the class for the implementation of the
MOTIF option button. The label shows the last selected option.
The itk 'component' method returns the component's full name.
uifOptionButton - Option button widget
Inherits the methods of class UifInteractiveWidget and support the
following :
General Remark :
- Entries start with index 0
- Keyword "last" always identifies the last entry of the menu
addItem <label> ?proc?
Add an entry allowing the user to invoke a TCL command.
- <label> String to label the entry
- ?proc? Optional parameter specifyimg a TCL procedure
to be executed.
This method allows the user to call different
procedures for each selected item.
deleteEntry <from> <to>
Delete menu items from position <from> to position <to>
enableEntry <pos>
Enable selection of entry in position <pos>
disableEntry <pos>
Disable selection of entry in position <pos>
getMenuName
Get full name of the menu associated to the widget.
getSize
Returns the total number of options
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifWidget class and supports :
command <proc. name> Name of a procedure to invoke when the user
selects an option. The value of the selected
option is appended to the list of the other
arguments given to <proc. name>.
BEWARE : The procedure <proc. name> must
have at least one argument.
default <value> Default value when the widget is created
font <font name> Text Font
itemList <list> List of options.
itemValue <list> List of values associated to each option.
If this is empty the position in the list
of the selected option is taken as value.
This is choosen when option -selectMode is set
to 'value'.
length <number> Specifies the widget length.
selectMode label/value Specifies how to set the variable associated
to the option button.
variable <va. name> Name of the variable associated to the widget
Create an instance
UifOptionButton .w -itemList {item1 item3 item5} -default item5
-command puts -variable gvar(a) -length 10
Re-configure the widget
.w configure -command myProcedure
.w configure -variable gvar(b) -itemList { a b c }
Other operations
set myVar [.out cget -variable] Get a widget's resource
set entryList [.out cget -itemList]
Example how to selecet a device to be initialized
.w addItem DEV1 "initDEV1"
.w addItem DEV2 "initDEV2"
Example of procedure : the procedure writes on the screen what type
of number the user has selected.
.w configure -command test -itemList {-3 5 8 0 -35 }
proc test { val } {
if {$val == 0 } {
puts "Null Value"
} elseif {$val < 0 } {
puts "Negative Value"
} else {
puts "Negative Value"
}
}
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifOutputWidget class and supports :
anchor <value> Determine where the value is displayed within
the widget -.e.g.- centered, left or right
justified, all tcl/tk values for 'anchor' are valid.
color <string> Text Color
font <string> Text Font
frame <1/0> Switch on/off the frame around the widget.
label <string> String used to label the widget
labelFont <string> New font for the label
labelWidth <integer> Label width : can be used to align several
widgets with different labels in columns
units <string> Text appended at the right side describing the
nature of the displayed value.
variable <string> Name of the variable associated to the widget
width <integer> Widget length
Create an instance
UifOutput .w -variable gvar(:PARAMS:SCALARS.scalar_string20) \
-color Red -frame 1 -width 21 -font CourR14
Re-configure the widget
.w configure -frame 0 -font helvB24 -color green
Other operations
set myVar [.w cget -variable] Get a widget's resource
set myColor [.w cget -color]
This widgets is able to display the contents of arrays or table
rows/coulumns. The widget is formed by a label and a sequence of
UifOutput elements each showing a single element of the array or table.
The elements can be configured to be horizontally or vertically alligned.
The itk 'component' method returns the component's full name.
topFrame - Frame containing the label and the arrayBox
label - Widget's label.
arrayBox - Frame containing the UifOutput widgets.
getCellVariable <pos>
Return the full name of the UifOutput widget for a given position.
<pos> ranges between 0 and (size - 1).
Supports the following options :
anchor <string> Determine where the value should be displayed
within the cell -.e.g.- centered, left or right
justified, all tcl/tk values for 'anchor' are valid.
color <string> Text Color
font <string> Text Font
format <string> Format to used to display the value.
(printf like syntax).
frame <1/0> Switch on/off the frame around each cell.
label <string> String used to label the widget
labelFont <string> New font for the label
labelWidth <string> Label width : can be used to align several
widgets with different labels, in particular
when the cells layout is horizontal.
orient <h/v> Layout configuration : horizontal/vertical
padding <integer> Determines the distance between cells.
size <integer> Number of cells.
variable <string> Name of the variable associated to the widget
width <integer> Cell length
Create an instance
UifOutputArray .w -anchor w -dbMode dbPoll -frame 1 \
-label {Output Array} -orient h -padding 12 \
-variable gvar(VECTORS.vector_double(0:2)) \
-size 3 -width 10 -format %4.1f
Re-configure the widget
.w configure -frame 0 -font helvB24 -color green
Other operations
set myVar [.w cget -variable] Get a widget's resource
set myColor [.w cget -color]
The widget has two states where the value 0 is associated
with the OFF level and any other value switches the Led to ON.
The widget reacts to the value of the associated variable according
configuration parameters "flashing". See description later.
flash
This method makes turns the LED ON for a time according to the
-flashTime option and after that turns off the LED
turnOff
Turns the LED off with the color according to the current values of
the '-colorOff' option.
turnOn
Turns the LED on with the color according to the current values of
the '-colorOn' option.
Inherits the following options from UifLed :
colorOn <string> Color to display when the LED is ON.
colorOff <string> Color to display when the LED is ON.
ledColor <string> Current led color
and supports the following options :
flashTime <milli-sec> Flashing time for the flash method
This determines how long the led remains
in the ON/OFF states.
flashing <2/1/0> This flag drives the behaviour of the led :
0 - Led is OFF if the variable is ZERO
otherwise is ON.
1 - Led is OFF if the variable is ZERO
and as soon as the variable is NOT ZERO
it 'flash' : that is it goes ON for
flashTime msecs and then OFF again.
when the variable is not zero.
2 - Led is OFF if the variable is ZERO
and as soon as the variable is NOT ZERO
it 'blinks' : that is it goes ON and OFF,
each state lasting flashTime msecs.
label <string> String used to label the widget
labelFont <string> New font for the label
labelWidth <string> Label width : can be used to align several
variable <var. name> Variable associated to the widget
Create an instance
UifOutputLed .w -colorOff Gray90 -colorOn Red \
-flashTime 500 -flashing 0 -label {Output Led} \
-variable gvar(SCALARS.scalar_logical)
Re-configure the widget
.w configure -flashTime 1000 -font helvB24 -colorOff green
Other operations
set myVar [.w cget -variable] Get a widget's resource
set myColor [.w cget -color]
.w flash Make the LED flashing
UifOutputList defines the class for the VLT output widget which allows the
user to display values. The user can also define a set of keywords for which
the value is displayed with a different color.
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifOutputWidget class and supports :
anchor <value> Determine where the value is displayed within
the widget -.e.g.- centered, left or right
justified, all tcl/tk values for 'anchor' are valid.
color <string> Text Color
font <string> Text Font
frame <1/0> Switch on/off the frame around the widget.
label <string> String used to label the widget
labelFont <string> New font for the label
labelWidth <integer> Label width : can be used to align several
widgets with different labels in columns
listKey <string> List of string keywords for which the output
value changes the color.
listColor <string> List of colors associated to the different
keywords. If there are more keywords than colors,
the last keywords will be displayed in the widget's
default color.
units <string> Text appended at the right side describing the
nature of the displayed value.
variable <string> Name of the variable associated to the widget
width <integer> Widget length
Create an instance
UifOutputList .w -variable gvar(deviceStatus) -color Blue -frame 1\
-width 21 -font CourR14 -listKey {normal warning error} \
-listColor { green orange red }
Re-configure the widget
.w configure -frame 0 -font helvB24 -color green
Other operations
set myVar [.w cget -variable] Get a widget's resource
set myColor [.w cget -color]
UifOutputString defines the class for the VLT output widget.
The widget is configured to associate a string to a range of values.
It compares the variable current value with those ranges to detect
in which range the current value falls into and display the proper
string.
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifOutputWidget class and supports :
anchor left ,center Determine where how the value should be displayed
or right within the widget.
font <string> Text Font
frame <1/0> Switch on/off the frame around the widget.
label <string> String used to label the widget
labelFont <string> New font for the label
labelWidth <integer> Label width : can be used to align several
widgets with different labels in columns
listColors <list> List of colors associated to the specific range.
listStrings <list> List of strings associated to the specific range.
listValues <list> List of threshold values. The current value
of the <variable> is compared with these values
to determine the range.
variable <string> Name of the variable associated to the widget
width <integer> Specifies the widget length
Create an instance
UifOutputString .w -variable gvar(myVar) -width 10 \
-listValues {10 15 50 100} \
-listStrings {string1 string2 string3 string4} \
-listColors {Black Blue Red Red} \
-font -Adobe-courier-medium-r-normal--14*
In this example the result would be :
| Output String Color
===========================================
value <= 10 | string1 Black
10 < value <= 15 | string1 Black
15 < value <= 50 | string2 Blue
50 < value <=100 | string3 Red
100 < value | string4 Red
Re-configure the widget
.w configure -frame 0 -font CourB24
Other operations
set myVar [.w cget -variable] Get a widget's resource
set myColor [.w cget -color]
dbMode <string> Defines the updating mode when the output widget
is connected to a database attribute.
The following two values are valid :
dbPoll Set the update mode to 'polling'
dbEvent Set the update mode to 'events'
evtFilter <string> Determine the condition triggering the event, such
as : "<" "<=" "=" ">" "=>" "!=" "w".
evtScript <string> Defines the procedure to be called when the event
is received.
UifPanel is an internal class containing methods an variables commmon
to all classes built with the panel editor -e.g.- xxx_uifClass widgets.
The panel editor can 'import' classes to be used in the current panel.
The class inherits methods from UifWidget class and supports
the followings :
display
Displays the class (similar to the pack command)
unpack
Make the class disappear ( similar to the pack forget command)
getMyCwp
Returns the class Current Working Point.
getClassPath
Returns the full path to the 'canvas' containing the widgets.
refreshInput
Updates all input widgets present in the class according to
the current database values.
cwp <string> Set the class Current Working Point.
library <string> Specifies the name of the library where the
class come from (used only to store the information).
envName <string> Name of the environment where to get the data from.
This applies to all DB attributes which do not have
a specific environment name.
UifPlot is a widget that can be configured to display a static plot.
The widget is formed by:
- A 'blt' graph widget : used to display the static plotting.
Support the following methods:
plot
Makes the static plotting taking the data from a file.
The file is the one specified by the '-fileName' option
draw <X> <Y>
Displays a curve described by a list of X and Y elements.
reset
Resets the plotted data points.
plotConfig
Displays a configuration panel where the user can specify :
- file containing data to be plotted. Each row of the file
represents a point and is made of a (X,Y) pair of reals.
- colour of the line to be drawn;
- symbol which associated to each plotted data point, such as :
square, plus, circle and cross.
setPlotOptions <smoothOption> <symbol> <color> <file> <colX> <colY>
<minX> <maxX> <minY> <maxY>
Implements the programmatic interface of the 'plotConfig' method.
Support the following options:
background <color> Color of the border, if the class is visible,
otherwise color of the background.
colX <val> Column of X-data in input file.
colY <val> Column of Y-data in input file.
graphHeight <val> Graph height.
graphWidth <val> Graph width.
logScale <on/off> Sets on/off logarithmic scale.
minX <val> Minimum limit of the x-axis.
maxX <val> Maximum limit of the x-axis.
minY <val> Minimum limit of the y-axis.
maxY <val> Maximum limit of the y-axis.
smooth <val> This option determines how the points are
connected. valid values are :
- linear : points are connected by segments
- step : points are conncted by 'stairs-like'
diagram.
- natural and quadratic points are connected with
a spline.
title <string>
xlabel,ylabel <string> Add a label on X and Y axis.
Create an instance
UifPlot .x -minY 0 -maxY 500 -fileName ../test/plot1.dat \
-graphWidth 200 -graphHeight 200
.x plot ;# Plot the data contained in the file
.x setPlotOptions circle green ../test/plot1.dat 0 1 Set new plot
.x plot Plot the new data
Plot data specified in tcl/tk variables
set xlist [list 10.0 20.0 30.0 40.0 50.0 60.0 ]
set ylist [list 34.0 45.0 56.0 27.0 50.0 12.0 ]
.x draw $xlist $ylist
Re-configure the widget
.x configure -minX -100 -maxX 150 -scale on
Other operations
set file [.x cget -fileName] Get a widget's resource
UifPlotter is a widget that the user can interactively use to display
static plots. The widget is derived by the UifPlot widget.
At the bottom it contains the following buttons :
- "Plot ..." This is used to call a configuration panel to select
the plotting options, such as : color, symbol and
data file.
- "Reset" Clears the widget of all curves.
Inherits methods from UifIntercativeWidget class and supports
the following :
flash
Flash the check button by re-displaying the widget several times
alternating between active and normal colors.
This command is ignored when the check button is disabled.
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifInteractiveWidget class and supports :
command <string> Command to execute when the user clicks the
button. The <variable> is updated first and
then the command is executed.
label <string> String used to label the widget
onVal <string> or Configures the widget 'ON' state.
<integer> It can also be DB symbolic address.
variable <string> Variable associated to the widget
Several radioButtons are related by having
sharing the same variable.
width <integer> Widget length.
Create an instance
UifRadioButton .w -label myLabel -variable gvar(myVar) \
-onVal 18 -command {callMyProcedure} -width 10
Re-configure the widget
.w -label "new label"
Other operations
.w disable ;
Set OFF value by reading a DB attribute.
.w configure -offVal "@wte16:PARAMS:SCALARS.scalar_int8"
set myLabel [.w cget -label] Get a widget's resource
set myVar [.w cget -variable]
Inherits methods of class UifInteractiveWidget and supports
the following :
setValue <value>
Sets the scale cursor to <value>
This can be used to set the scale to some default values.
get
Returns the current scale value.
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifIntercativeWidget classe and supports :
label <string> String used to label the widget
length <integer> Widget length
maxVal <integer/float> Maximum value of the scale
minVal <integer/float> Minimum vale of the scale
orient <horizontal/vertical > Determine the widget orinetation.
variable <string> Variable associated to the widget
Create an instance
UifScale .w -maxVal 29 -minVal -36 -variable gvar(myScale) \
-orient h -length 100 -label Scale
Re-configure the widget
.w configure -label "new Label" -minVal -20.5 -maxVal 37.4
Other operations
set label [.w cget -label] Get a widget's resource
set orient [.w cget -orient]
The itk 'component' method returns the component's full name.
shortHelp - Label displaying the short help text
heartBeat - Label containing the heart beat bitmap
displayText <text>
Displays a<text> in the short help widget. This can be used to
convey information about specific conditions or results to the user.
getHelpVariable
Returns the name of the variable associated to the short help widget.
The is also a procedure used to add an help text to a given widget
add <shWidget> <widget> <text>
Configures the <widget> to display a short help <text> in the
short help widget <shWidget>
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
showHeartBeat 0/1 Bollean variable enabling the heart-beat
Create an instance of short help widget
set w .top.sh
UifShortHelp $w -showHeartBeat 0
pack $w -side top -fill x
Configure a widget <wdg> to display the short help.
UifShortHelp $w $wdg "Widget short help"
Display a user's message in the short help widget
$w displayText "Hello World"
UifStripChart is a widget that can be configured to display a
strip chart.
The widget is formed by:
- A canvas where to plot the values versus time
- Two arrows that signal when the value goes beyond the lower/upper
limit
Data can be read either from a variable or a data base point.
The plotting can run in polling or event driven.
Before starting a plotting, the option "-datasource" must be configured,
otherwise an error occours.
'Polling' Based Updating
The procedure specified in the option "-updateProc" is recursively called
until methods 'stopPlot' or 'pausePlot' are invoked.
There is a default procedure called 'updateChartPoll' which is able to
update the strip-chart from a value stored in a local tcl variable or
from the database.
The procedure checks if the syntax of the 'datasource' option follows
the RTAP conventions
option and
The user can specify it's own procedure which must follow the following
template :
proc userChartPoll { w type var rate} {
if {[winfo exists $w] == 0} { return }
if {$type == ""} {
set newValue [uplevel #0 set $var]
} else {
set newValue <Read from Database>
}
... here the user can put some additional code
to process the value read from the datasource
$w drawValue $newValue
set plotState [$w getPlotState]
if {$plotState != "PAUSE" && $plotState != "STOP"} {
after $rate userChartPoll $w $type $var $rate
}
}
'Event' Based Updating
The procedure specified in the option "-updateProc" is called
whenever an event from the database is generated : there is a default
procedure called 'updateChartEvent'.
This mode works only with database attributes.
The user can specify it's own procedure which must follow the following
template :
proc updateChartEvent {w attr type data} {
if {![winfo exists $w]} { return }
if {$type != "SCALAR"} { return }
... here the user can put some additional code
to process the value read from the datasource
set plotState [$w getPlotState]
if {$plotState == "PLOT" || $plotState == "IDLE"} {
$w drawValue [lindex $data 2]
}
}
Support the following methods:
plot
Starts the dynamic plotting.
stopPlot
Stops the dynamic plotting and resets plotted data points.
pausePlot
Stops temporarily the dynamic plotting.
continuePlot
Continues the dynamic plotting after a pause.
stripChartConfig
Allows interactive configuration of the widget.
Support the following options:
colorUpperLim <color> Color of the upper limit.
colorLowerLim <color> Color of the lower limit.
valueUpperLim <val> Value of the upper limit.
valueLowerLim <val> Value of the lower limit.
datasource <string> Variable or database point containing the
current value to be plotted.
dataType <DB>/<TCL> Defines the type of variable.
- DB the value is read from the database
- TCL the value is read from a global tcl
variable
samplingTime <msec> Sampling time of the plot.
startTime <hh:mm:ss> Start time of the plot.
updateMode <mode> Mode of plotting : "poll" or "event"
updateProc <proc> Name of the procedure used to generate the
in the plotting for polling or event.
Default values are :
- updateChartPoll when used in polling
- updateChartEvent when used with events
And inherits the following options from uifPlot :
background <color> Color of the border, if the class is
visible otherwise color of the background.
minX <val> Minimum limit of the x-axis.
maxX <val> Maximum limit of the x-axis.
minY <val> Minimum limit of the y-axis.
maxY <val> Maximum limit of the y-axis.
title <string>
graphWidth <val> Graph width.
graphHeight <val> Graph height.
If the plotting is running event driven, the generated event by
datasource must be syncrhonized, otherwise an error occours in
the layout of plotted data.
Create an instance
UifStripChart .x -datasource ":uves:ins.HwState" -dataType DB
-minY 0 -maxY 1000 -graphWidth 200 -graphHeight 200\
-valueUpperLim 950 -valueLowerLim 100\
-colorUpperLim red -colorLowerLim blue
Re-configure the widget
.w configure -colorUpperLim Blue -minY -30
Other operations
set dbAttribute [.x cget -datasource] Get a widget's resource
UifStripChartPlotter is a widget that can be configured to display a
dynamic plotting that can be controlled with some buttons.
The widget is formed by:
- A 'blt' graph widget : used to display the dynamic plotting.
- Four buttons: the first used to start plotting, the second used to
stop plotting and clear graph, the third used to pause plotting and
the last used to continue plotting after a pause.
Inherit all options by UifStripChart class and supports :
configFlag <normal/disabled> Enable the user to configure
the widget directly from the panel
The itk 'component' method returns the component's full name.
scrollh - Horizontal scroll bar
scrollv - Vertical scroll bar
uifText - Text widget
General remarks :
- Positions in the text are specified by two numbers <line>.<char>
<line> starts with 1
<char> starts with 0
Position 2.5 identifies the 2-th line and the 6-th character.
- Keyword "end" identifies the last character in the text widget
Inherits methods from UifIntercativeWidget class and supports
the following methods :
insertText <pos> <text>
Insert text at the specified position
deleteText <from> <to>
Deletes the specified characted range
getText <from> <to>
Returns the text in the specified range
Only the options related to the VLT conventions are listed here.
The complete set can be obtained throught the config function.
Inherits options from UifIntercativeWidget class and supports :
font <font name>
height <integer> Determine the height of the widget expressed
in number of rows.
width <integer> Determine the widget length (in characters)
<Delete> Deletes character left to the insertion cursor.
It also deletes selected part of the text.
<BackSpace> Deletes character left to the insertion cursor
It also deletes selected part of the text.
<Arrow-Left> Moves the insertion cursor leftwards
<Arrow-Right> Moves the insertion cursor rightwards
<Arrow-Up> Moves the insertion cursor one line upwards
<Arrow-Down> Moves the insertion cursor one line downwards
<B1-Motion> Drag the mouse left-button to select part of the text.
<Button-2> Done by clicking the mouse middle-button.
The selected part of the text is inserted in the position
where the cursor is when the user clicks on <Button-2>.
<Control-d> Deletes the character at the left of the cursor current
position.
UifWidget is used to inherit special features for the implementation
of the UIF Common Conventions.
The user creates a widget by defining an instance of the widget class,
for example :
UifOutput .out -variable dummyVar -color Red -frame 1
Widget resources can be set using :
<name-of-instance> configure <resource-name> <value>
The current value of the widget resources is returned by :
<name-of-instance> cget <resource-name>
The class supports the following methods :
queryState
Returns 1 if the widget is 'enabled' or 0 if 'disabled'.
getComponentPath (OBSOLETE .. use tk statement 'component')
Returns the full name of a widget's component.
Mega-widgets are formed by a number of elementary 'components' and
sometimes it is necessary to directly access one of them -e.g.- when
defining specific binding setup.
Quadralay Corporation http://www.webworks.com Voice: (512) 719-3399 Fax: (512) 719-3606 sales@webworks.com |