ERDAS Macro Language: On-Line Manual
ERDAS Macro Language: On-Line Manual
ERDAS Macro Language: On-Line Manual
O N - L I N E M A N U A L
Copyright 1982 - 1999 by ERDAS, Inc. All rights reserved.
ERDAS, Inc.
2801 Buford Highway, N.E.
Atlanta, Georgia 30329-2137 USA
Phone: 404/248-9000
Fax: 404/248-9400
User Support: 404/248-9777
Warning
All information in this document, as well as the software to which it pertains, is proprietary material of ERDAS, Inc., and is
subject to an ERDAS license and non-disclosure agreement. Neither the software nor the documentation may be reproduced in
any manner without the prior written permission of ERDAS, Inc.
Trademarks
ERDAS is a trade name of ERDAS, Inc. ERDAS and ERDAS IMAGINE are registered trademarks of ERDAS, Inc. Model
Maker, CellArray, ERDAS Field Guide, and ERDAS Tour Guides are trademarks of ERDAS, Inc. Other brands and product
names are trademarks of their respective owners.
ERDAS Macro Language On-Line Manual
Introduction to EML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
EML Graphical User Interface Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
BUTTON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
CHECKBOX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
EDITTEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
FILENAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
GROUP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
LABEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
LINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
METERNUMBER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
POPUPLIST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
RADIOBUTTON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
SCROLLIST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
TEXTNUMBER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Document Frames. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Modal Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Modeless Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Tool Palettes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Menu Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Job Setup Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
iii
ERDAS Macro Language On-Line Manual
Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Variable References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
List-Construction Operator 34
Addition Operator 34
Array Operator 35
Boolean-And Operator 35
Boolean-Or Operator 35
Concatenation Operator 36
Division Operator 36
Equals Operator 36
Exponentiation Operator 37
Greater-Than Operator 37
Greater-Than-Or-Equal Operator 38
Inequality Operator 38
Less-Than Operator 38
Less-Than-Or-Equal Operator 39
Logical-And Operator 39
Logical-Or Operator 40
Modulus Operator 40
Multiplication Operator 40
Negation Operator 41
Part Message Operator 41
Subtraction Operator 41
Value-Of Operator 41
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Built-In Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
iv
ERDAS Macro Language On-Line Manual
BANDLIST Function 43
BOTTOM Function 44
CDMOUNTUTIL Function 44
CEIL Function 44
COS Function 45
ERROR Function 45
EXP Function 45
FEXIST Function 45
FEXT Function 46
FLOOR Function 46
FMT Function 46
FNAME Function 47
FPATH Function 47
FROOT Function 48
GETAOI Function 48
GETCFG Function 49
GETDEVICELIST Function 49
GETENV Function 50
GETFEATUREFIELDS Function 50
GETFILELIST Function 51
GETFILESINPATH Function 51
GETMAPPANELCOUNT Function 52
GETPREF Function 53
GETRECODETABLEFILE Function 53
GETSCREENNUMBER Function 54
GETSTRINGHEIGHT Function 55
GETSTRINGWIDTH Function 55
GETTAGGEDDATA Function 55
GETTEXT Function 56
HEIGHT Function 56
ISBATCHON Function 57
ISEMPTY Function 57
ISLICENSED Function 57
ISNUMBER Function 58
ISSTRING Function 58
LEFT Function 58
v
ERDAS Macro Language On-Line Manual
LOG Function 59
LOG10 Function 59
LOWERCASE Function 59
MAPCREATE Function 59
MAPPRINT Function 60
MAPPRINTDELETE Function 61
MEMBERCOUNT Function 61
MESSAGE Function 62
QUOTE Function 62
REMOVECHARS Function 62
RIGHT Function 63
RPCSEND Function 63
SCREENNUMBER Function 63
SIN Function 63
SORT Function 64
SORTBYFILENAME Function 64
SPLITSTRING Function 64
SYSTEM Function 65
TAN Function 65
TOP Function 65
UPPERCASE Function 66
VERIFYSAVE Function 66
WARNING Function 66
WIDTH Function 66
WMBORDERWIDTH Function 67
WMTITLEHEIGHT Function 67
YESNO Function 67
YESNOCANCEL Function 68
Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Compound Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Variable Definition Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Flow Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
EXIT Statement 71
vi
ERDAS Macro Language On-Line Manual
FOREACH Statement 71
IF Statement 72
LOOP Statement 72
RETURN Statement 73
SWITCH Statement 73
WHILE Statement 74
Command Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Built-In Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
BATCHJOBNAME Command 75
CLOSE Command 75
COMLOG Command 76
CONFIGURATIONEDITOR Command 76
DISABLE Command 77
DISPLAY Command 78
ECHO Command 78
ENABLE Command 79
HELPOUTLINE Command 79
HIDE Command 79
INSERTTEXT Command 80
JOB Command 81
LOAD Command 82
LOGMESSAGE Command 82
MOVE Command 82
PLAY Command (Sun Systems Only) 83
PREFERENCEEDITOR Command 83
QUIT Command 84
REFLOW Command 85
REFRESHLIST Command 85
RESIZE Command 85
SEND Command 85
SET Command 86
SHOW Command 87
SHOWHELP Command 88
SHOWVERSION Command 89
SPAWN Command 89
vii
ERDAS Macro Language On-Line Manual
STARTBATCH Command 90
STARTBATCHSINGLE Command 90
STATUSLOG Command 91
STOPBATCH Command 91
SYNCJOB Command 91
SYSTEM Command 92
UNDISPLAY Command 93
UNLOAD Command 93
VIEWBATCHLIST Command 93
Application Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Function Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Menu Item Titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Frameparts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
BUTTON Framepart 106
Color Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
CANVASPART Framepart 108
CELLARRAYPART Framepart 108
CHECK BOX Framepart 109
EDITTEXT Framepart 110
FILENAME Framepart 112
GENERIC Framepart 114
GROUP Framepart 115
LABEL Framepart 116
LINE Framepart 117
METERNUMBER Framepart 118
POPUPLIST Framepart 119
RADIOBUTTON Framepart 121
viii
ERDAS Macro Language On-Line Manual
ix
ERDAS Macro Language On-Line Manual
x
ERDAS Macro Language On-Line Manual
xi
ERDAS Macro Language On-Line Manual
xii
ERDAS Macro Language On-Line Manual
Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Interpreter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Application Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Application Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Linked Part Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Global Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
xiii
ERDAS Macro Language On-Line Manual
Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
xiv
ERDAS Macro Language On-Line Manual
xv
Introduction to EML
Introduction to EML
When the designing of ERDAS IMAGINE began, it was clear that a traditional, static GUI would
not meet the needs of the variety of users and applications of the ERDAS products. Users
wanted to be able to customize the interface and to create scripts which could be used to execute
frequently used functions. The ERDAS Macro Language (EML) is the result of this design.
EML is designed to serve as a scripting language as well as a user interface language. Unlike
simple user interface description tools (such as UIL in Motif), EML is able to define the actions
which are to be taken when a user interacts with a dialog. It provides a complete syntax for
defining a typical dialog box, as well as constructs for defining scripts which contain branching
and control logic.
In addition to the macro language itself, EML provides a C level toolkit of functions which allows
the programmer to build the EML language into an application, and to extend the language
through application specific variables, functions, and commands.
How to Write an EML - This set of learn-by-doing exercises, takes you through the steps to
create a utility dialog that provides graphical access to several UNIX file-handling commands. It
is intended for the novice EML programmer.
EML Syntax Reference - This section gives a detailed definition of the syntax used to construct
an EML script.
EML User Interface Standards - This document explains the standards for writing EML scripts
that are used by ERDAS, Inc.
EML Appendixes - This section consists of tables filled with formatting and configuration
information.
Cross Index - A cross index of keywords and symbols arranged both alphabetically and
categorically.
1
Description
Description
The ERDAS Macro Language is a script language that is designed for generating a graphical
user interface. EML allows you to design the same graphical user interface tools (e.g., dialog
boxes, menus, and control panels) that are used in ERDAS IMAGINE.
♦ customize the IMAGINE graphical user interface for your own use, or
♦ incorporate your C Programmers’ Toolkit programs into the IMAGINE graphical user
interface.
➲ How to Write an EML gives a brief tutorial for creating and loading a custom EML script. For
complete details of the syntax of EML see EML Syntax Reference.
BUTTON
A button is a simple framepart whose main purpose is to initiate an action. A button may be a
rectangle with the title centered in the button or a rectangle filled with an icon. Both forms behave
the same.
CHECKBOX
The checkbox provides a toggle mechanism for on/off, yes/no, true/false types of responses.
2
Description
EDITTEXT
The edittext is used to implement a simple input text field. It also provides the capabilities of a
multi-line text editor.
FILENAME
GROUP
The group framepart is used to group other frameparts together for emphasis.
3
Description
LABEL
The label framepart is used to place a label in a frame. The label can be a simple text string or it
may be a small image provided by an icon file. There is no user interaction with a label.
LINE
The line framepart creates simple line in a frame which can be used to separate items or call
attention to others.
METERNUMBER
POPUPLIST
The popup list provides a means of selecting one value from a list of several fixed choices.
4
Description
RADIOBUTTON
The radiobutton provides a means of selecting one value from a set of several fixed choices.
SCROLLIST
The scrollist provides a means of selecting a single value from a long list of choices.
TEXTNUMBER
These basic items are called frameparts and are combined with frames to create the GUI
elements described on the following pages.
5
Description
Document Frames
Document frames are used to view or display some information which is saved in one or more
files. This is characteristic of an interactive document viewer/editor. IMAGINE applications which
have document frames are viewer, modelmaker, dataview, hfaview, imageinfo, editor, dsceditor,
and mosaic. Modal Dialogs, Modeless Dialogs, and ToolPalettes are used in support of the
editing operations performed in a document frame.
Title Bar
Menu Bar
Tool Bar
Document
Area
Status Bar
6
Description
Modal Dialogs
A Modal Dialog is used to display or query information in a serial fashion. Until the modal dialog
is dismissed (through selection of the OK or Cancel button) the rest of the application is non-
responsive.
Modeless Dialogs
A modeless dialog exchanges information that is used to interact with a document window in a
continuing fashion. All other parts of the application are available while the modeless dialog is
displayed.
7
Description
Tool Palettes
A tool palette is a modeless frame which is used to display a series of icons which control the
behavior of the pointer while it is within a document window. The top portion of the tool palette
consists of a series of icons which represent the function to be performed, with Help, Keep Tool,
and Close buttons at the bottom of the palette. A tool palette should be as small as possible since
it is occupying screen space which is at a premium.
Keep Tool
Help
Menu Dialogs
Several of the top level applications started from the IMAGINE icon panel are menus of functions.
These menus are simple dialogs which present a menu of buttons like the following:
8
Description
9
How to Write an EML
If you learn best through experience and prefer to roll up your sleeves and get your feet wet then
let’s go ...
In this set of learn-by-doing exercises, we are going to create a utility dialog that provides
graphical access to several UNIX file-handling commands.
You may make mistakes as you perform these exercises. DON’T PANIC! The EML parser will
provide you with helpful error messages. If you have made a spelling or syntax error, simply edit
the EML script to correct the problem and try to load it again. Usually the line number on which
the error occurs is given by the warning message.
frame first_frame {
title "Simple Modeless Dialog";
geometry 0,0,260,70;
button stopit {
title "Quit";
geometry 0,0,82,25;
on mousedown unload;
} /* end of button stopit */
} /* end of first_frame */
} /* end of component */
☞ You may also use vi, textedit, or any other text editor capable of creating an ASCII file.
10
How to Write an EML
Every EML should begin with a line containing the component keyword. The name you give the
component (simple in our example) must be the same as the root name of the .eml file.
The brace ({) at the end of the component statement indicates that more than one statement
follows which belongs to the component. All statements within a set of braces ({}) are grouped
together.
Every EML should have at least one frame or dialog. In our example the keyword frame is
followed by the name of the frame (first_frame). This provides a way of addressing a particular
frame as we do in the "on startup" line.
Every frame should have a title so that when the dialog is displayed, it is easy to tell what it is
supposed to do. The title attribute is followed by a quoted string that is displayed in the banner
portion of the dialog.
Notice the semicolon (;) at the end of this line. Each statement that does not begin a group of
statements must be terminated with a semicolon.
The geometry attribute in our example specifies the x and y screen coordinates (in pixels) for the
location of the upper left corner of the dialog box. It also specifies the x and y dimensions (in
screen pixels) of the dialog box. The location of the dialog box is relative to the upper left corner
of the screen.
A frame without something to click on would be rather uneventful so the next element is a button
framepart. Just as with frame, the button keyword takes a name (stopit) and a title (Quit).
The geometry attribute is again used to specify the x and y coordinates (in pixels) for the location
of the upper left corner of the button and the x and y dimensions (in pixels) of the button. In this
case, the location of the button (or other frameparts) is relative to the upper left corner of the
dialog box.
At last we come to an action statement. The on attribute statement is called a message handler.
The basic syntax is on <message> <action>. In the case of our example, when the Quit button
is clicked, it receives the mousedown message. The message handler then tells EML to unload the
current script.
☞ The unload command is most important because without it, there is no means with which to
remove the dialog without quitting IMAGINE.
OK. So where does the mousedown message come from? Well, when the GUI Manager portion
of EML detects a mouse button click, it sends the message ‘mousedown’ to the framepart that
was active when the event occurred.
11
How to Write an EML
Block Statements
The next couple of lines in the example script contain close braces (}) to conclude block
statements. Each of these lines is commented to make script maintenance easier. Commenting
is good programming practice regardless of the language. A comment begins with ‘/*’ and ends
with ‘*/’. Anything appearing between these symbol pairs is ignored.
The last statement is another on attribute; this time it is for the component. You can tell this
because it is not contained within the statement blocks for either the button or the frame. This
message handler takes care of the startup message that is automatically sent by the EML
Parser when the EML script is first loaded.
When the component receives the startup message, it instructs EML to display the frame
first_frame.
The last line concludes the block of statements that make up the entire component.
12
How to Write an EML
The Session Log displays the loading and unloading of the script file.
3. Select Session | Command History.
4. Click in the Command: window of the Command History dialog. The text cursor will
change from gray to black and begin to blink.
5. Type the following command then press RETURN:
load "simple.eml"
Our Simple Modeless Dialog is displayed in the upper left corner of the screen. The message
‘Loading [simple.eml]...’ is displayed in the Session Log window.
You now see how easy it is to create a dialog and to display it from IMAGINE using the ERDAS
Macro Language.
13
How to Write an EML
Add Functionality
Now let’s add a little functionality. In this exercise, we are going to add a couple of frameparts to
first_frame and show how one framepart can affect another. We will also learn that frameparts
can hold a value and we will see how we can access that value.
frame first_frame {
title "Simple Modeless Dialog";
geometry 0,0,363,188;
button okay2;
filename filein {
title "Source File:";
geometry 0,0,187,188;
on filenamechoosen enable okay2;
} /* end filein */
button okay2 {
title "OK";
geometry 193,0,82,25;
on mousedown echo "File" $filein " selected.";
} /* end okay2 */
button stopit {
title "Quit";
geometry 281,0,82,25;
on mousedown unload;
} /* end stopit */
} /* end frame */
14
How to Write an EML
} /* end of component */
The first thing you may notice is that the geometry attribute of the frame has been edited to
increase the size of the dialog. This is because we are going to add some frameparts.
The first new line added to the file may seem a little odd. It simply declares a button named
okay2. No attributes have been given to the button. The reason for this is that no framepart may
be referenced before it is declared.
When a framepart is declared, it is simply given a name and acknowledged by the EML Parser
as existing. Only after it has been defined by attributes can it be displayed.
If the okay2 button was not first declared, the EML Parser would give an error when it
encountered the reference to it in the last line of the filename part. If okay2 was defined before
the filename part, no error would have occurred.
The next change is the addition of the filename framepart named filein. This is a fairly complex
framepart that is easy to use because of built-in features. All we have to do is provide title and
geometry attributes.
By default, the filename part automatically displays the names of all subdirectories and files in
the current directory. To make this part do something, however, we must add a message
handler. A message handler is simply a statement that tells a part what to do when it receives a
particular message from the system.
In the case of the filename framepart, a special message is sent from the GUI Manager when it
sees that a file name has been selected. When a file name is selected, the filenamechoosen
message is sent to the filename framepart. When a subdirectory is selected, the subdirectories
and files of that directory are then displayed.
The next new part is the okay2 button. This button is given the title OK and located 6 pixels to
the right of the filename framepart (0 + 187 + 6 = 193). The basic formula for starting location is
the sum of the starting location and width of the part to the left of the current part plus a gap value.
(See the following illustration.)
Sp + Width + Gap = Sc
15
How to Write an EML
Sp Sc
width gap
new part
existing part
For this exercise, the OK button simply echoes the statement ‘File filename selected.’ to the
Session Log. The name of the file is supplied by the GUI Manager. In addition to sending the
filenamechoosen message, the value of the selected file is assigned to the framepart. We access
the contents of the filein framepart (its value) by prefixing its name with the $ character. Notice
that this portion of the echo statement is not quoted.
The geometry of the Quit button is altered to position it to the right of the OK button (193 + 82 +
6 = 281).
The last change to the file is the addition of one more message handler. This time we want
something to happen when the frame is displayed. Again, when the GUI Manager senses that a
frame has been displayed, it sends the message framedisplay to the frame. The ‘on
framedisplay disable okay2;’ statement is what makes the OK button initially gray.
16
How to Write an EML
Test It
Everything else is the same as before so lets take another look at our new dialog.
1. Type the following command in the Command: window of the Command History
dialog and press RETURN:
load "simple.eml"
The dialog is displayed in the upper left corner of the screen. Initially it contains no file names,
but in a few seconds (depending on the size of the current directory) the subdirectories and files
are displayed. Also note that the title of the OK button is displayed in gray text.
2. Double click on a subdirectory name. The contents of that directory are displayed but
the OK button is still disabled because a directory is not a valid file name.
3. Click on a file name. The selected file name is copied to the text input area, the filein
framepart is assigned the value of the selected file (current path/filename), and the OK
button is enabled.
We have now successfully demonstrated how one framepart can affect or alter another. We have
also seen how the value of a framepart can be accessed and used.
4. When you are finished admiring and exploring your handiwork, click the Quit button to
unload the dialog.
In the next exercise, we are going to do something with the filename we select.
17
How to Write an EML
frame first_frame {
title "Copy / Rename / Delete";
geometry 600,150,468,188;
filename filein;
button copyit;
button renameit;
button deleteit;
button stopit;
filename fileout;
filename filein {
title "Source File:";
geometry 0,0,187,188;
on filenamechoosen enable deleteit;
} /* end filein */
button copyit {
title "Copy";
geometry 193,0,82,25;
on mousedown {
echo "File " $filein " copied to " $fileout ".";
system cp $filein $fileout;
disable copyit;
disable renameit;
disable deleteit;
}
} /* end copyit */
button renameit {
title "Rename";
18
How to Write an EML
geometry 193,31,82,25;
on mousedown {
echo "File " $filein " renamed to " $fileout
".";
system mv $filein $fileout;
disable copyit;
disable renameit;
disable deleteit;
}
} /* end renameit */
button deleteit {
title "Delete";
geometry 193,62,82,25;
on mousedown {
echo "File " $filein " deleted.";
system rm $filein;
disable copyit;
disable renameit;
disable deleteit;
}
} /* end deleteit */
button stopit {
title "Quit";
geometry 193,93,82,25;
on mousedown unload;
} /* end stopit */
filename fileout {
title "Destination File:";
geometry 281,0,187,188;
newfile;
on filenamechoosen {
enable copyit;
enable renameit;
19
How to Write an EML
}
} /* end fileout */
on framedisplay {
disable copyit;
disable renameit;
disable deleteit;
}
} /* end frame */
} /* end of component */
First, it’s time to give our dialog a new title. After all, it has a real purpose now. Remember to use
titles that help explain or define the purpose of the dialog. For this exercise, let’s use "Copy /
Rename / Delete" since that is what it will do.
Then edit the geometry attribute of first_frame so that it will be positioned in a more convenient
location. The former coordinates are 0,0 (upper left corner of the screen). The new coordinates
600,150 will position the upper left corner of the dialog box 600 pixels to the right of the left edge
of the screen and 150 pixels below the top edge.
Next are added declarations for each framepart in this dialog. It is good programming practice to
declare all frameparts used in each frame. This allows you to see at a glance the content of each
frame. It also prevents parse errors when a part is referenced before it is defined.
☞ Frames and frameparts must be declared or defined before they are referenced!
In the filein framepart, enable the deleteit button instead of the okay2 button. The other two
buttons (copyit and renameit) are not enabled at this time because copying or renaming a file
requires two arguments: a source file name and a destination file name.
Next, we are going to replace the OK button with three new buttons, each of which will initiate a
different action. Remove the block of statements that define the okay2 button.
Now define the three new buttons. First is the Copy button. As with the fileout framepart above,
it takes advantage of the block statement to perform five actions. It first executes the UNIX
system command ‘cp’ to copy a file.
20
How to Write an EML
This is accomplished by using the system keyword. The system command causes the
Interpreter to evaluate all variables and expressions in the argument list and pass the list to the
UNIX shell for execution.
In the case of the Copy button, the variables $filein (the name of the source file) and $fileout (the
name of the destination file) are first evaluated. Then the entire argument list is passed to the
UNIX operating system. For example, the resulting argument list might be:
cp /tmp_mnt/home/bob/simple1.eml /tmp_mnt/home/bob/simple2.eml
Next, the Copy button echoes a message to the Session Log stating that the source file has been
copied to the destination file. Finally, it issues three short commands to disable itself and the
Rename and Delete buttons. This lets you know that there are no pending operations.
The definitions of the Rename and Delete buttons are virtually identical to the Copy button
except that the Rename button uses the UNIX mv (move) command and the Delete button uses
the rm (remove) command.
Now edit the Quit button geometry so that it is located below the Delete button.
The destination filename framepart is the next thing to add. This one we will name fileout and
give it the title Destination file:. This is the part that will handle the filenamechoosen message
and enable the Copy and Rename buttons.
Until now, we have relied upon selecting a file name from a displayed list of available files. What
about a new file name? If you have tried typing a new filename in the source file text input area,
you have already seen the File ... does not exist. message. How do we enable access to this
area?
The answer is the newfile keyword. This keyword does two things. First, it allows you to enter a
new file name into the text input area. Second, it checks to see if the file name you entered
already exists. If it does, it gives you a warning and asks if you wish to replace it. If you select
No, the text input area is blanked and you may enter a new file name. If you select Yes, the
existing file is deleted so that it can be replaced by the new file of the same name.
One final thing to notice about the fileout framepart is the use of multiple statements with the
message handler. Any message handler may initiate any number of actions by using a block
statement.
The last thing to do is to modify the framedisplay message handler to disable the three new
buttons so they cannot be used until files are selected.
21
How to Write an EML
Test It Again
Let’s take another look at our dialog.
1. Type the following command in the Command: window of the Command History
dialog and press RETURN:
load "simple.eml"
Initially the titles of the three new buttons are displayed in gray text.
☞ If you click the Delete button now, the selected file is deleted from the file system
without further approval.
3. Click in the text input area of the Destination File window and enter a new file name.
If no file exists in the current directory with this name, the Copy and the Rename buttons are
enabled.
4. Click the Copy button.
The selected source file is copied to the specified new file and the three file manager buttons are
disabled.
5. In the Source File window, select the new file created with the Copy button in the
previous step.
6. Click the Delete button.
Each time you perform one of the file management functions, the file name display is updated to
reflect the change.
7. Click the Quit button.
22
How to Write an EML
cp /vol/imagine/830/scripts/imagine.eml /home/smith/.imagine830/
imagine.eml
chmod +w /home/smith/.imagine830/imagine.eml
3. Open your local copy of imagine.eml for editing. Find the line that contains:
{ erdas; }
You must re-start IMAGINE from your home directory so that your local copy of imagine.eml is
read.
7. Select File Management... from the Utility menu.
23
How to Write an EML
The set command allows you to change the value of any variable (frameparts included) to
something else. In the case of our dialog, we will add a new button called Clear that will remove
the contents of the text input area and disable the Copy, Rename, and Delete buttons.
This same command can also be used with the other buttons to clear the text input field following
execution.
frame first_frame {
title "Copy / Rename / Delete";
geometry 600,150,468,188;
filename filein;
button copyit;
button renameit;
button deleteit;
button clearit;
button quitit;
filename fileout;
filename filein {
title "Source File:";
geometry 0,0,187,188;
on filenamechoosen enable deleteit;
} /* end filein */
button copyit {
title "Copy";
geometry 193,0,82,25;
on mousedown {
echo "File " $filein " copied to " $fileout ".";
system cp $filein $fileout;
set filein = "";
24
How to Write an EML
button renameit {
title "Rename";
geometry 193,31,82,25;
on mousedown {
echo "File " $filein " renamed to " $fileout
".";
system mv $filein $fileout;
set filein = "";
set fileout = "";
disable copyit;
disable renameit;
disable deleteit;
}
} /* end renameit */
button deleteit {
title "Delete";
geometry 193,62,82,25;
on mousedown {
echo "File " $filein " deleted.";
system rm $filein;
set filein = "";
set fileout = "";
disable copyit;
disable renameit;
disable deleteit;
}
} /* end deleteit */
25
How to Write an EML
button clearit {
title "Clear";
geometry 193,93,82,25;
on mousedown {
set filein = "";
set fileout = "";
disable copyit;
disable renameit;
disable deleteit;
}
} /* end clearit */
button stopit {
title "Quit";
geometry 193,124,82,25;
on mousedown unload;
} /* end stopit */
filename fileout {
title "Destination File:";
geometry 281,0,187,188;
newfile;
on filenamechoosen {
enable copyit;
enable renameit;
}
} /* end fileout */
on framedisplay {
disable copyit;
disable renameit;
disable deleteit;
}
} /* end frame */
26
How to Write an EML
} /* end of component */
Next you will see the addition of the following two lines to the Copy, Rename, and Delete buttons:
set filein = "";
set fileout = "";
These lines change the value of the filein and fileout filename frameparts to nothing ("" - an empty
string). Note that these lines are placed following the system commands which rely upon the
value of these frameparts.
Add the clearit button after the deleteit button and give it a geometry that will place it below the
deleteit button (formerly that of the Quit button). Edit the geometry of the Quit button so that it is
positioned below the new Clear button (93 + 25 + 6 = 124). The Clear button simply resets the
values of the filein and fileout filenames and disables the Copy, Rename, and Delete buttons.
We leave it to you to experiment with further improvements such as view and edit features.
➲ The EML Syntax Reference provides a complete syntax reference of EML operators,
functions, commands and parts.
27
EML Syntax Reference
This section gives a detailed definition of the syntax used to construct an EML script. It begins
with the most basic part of a script, expressions, then moves to procedures and finally defines
the GUI elements used to create a complete application.
Expressions
Names
Constants
Variables
Operators
Functions
Procedures
Statements
Command Statements
Application Commands
Function Commands
Components
Menus
Frames
Frameparts
Attributes
Framepart Attributes
28
EML Syntax Reference
Number Attributes
Framepart Functions
29
Expressions
Expressions
An expression is a combination of constants, variables, operators, and functions which is used
to provide a value for some operation. The most common use of expressions is in assignment
statements that are used to create the values stored in variables. Throughout EML, an
expression is typically used when a simple number or string is required.
30
Names
Names
Throughout an EML file many things are given names. Names in EML are strings of characters
up to 256 characters long. The first character must come from the set a...z (upper and lower case
are treated the same) and all following characters in the name must come from the set a...z, 0...9,
and "_".
31
Constants
Constants
A constant is either a number or string. A number has the form:
[+/-]dddd[.ddddd][E[+/-]ddddd]
A string constant is either a simple name or a text string enclosed in double quotes. Examples
of valid string constants are: Avogadro, "This string has spaces", "/data/filename.txt". It is
necessary to enclose filenames in quotes when they contain the special characters "/" and "."
which are defined as operators in EML.
32
Variables
Variables
A variable may be either local (variable) or global (global). Local variables defined at the
component level are available to all procedures, menus and frames defined in the component.
Global variables are available across applications. Any variable used in an EML script should
be declared as either global or variable.
variable name ;
global name ;
In either case a variable is a named container which may hold one or more values which can be
either numbers, characters, or strings of characters. All of the values stored in one variable must
be of the same type. For example, a variable cannot contain numbers and strings.
The value of a variable may be established with the set command. The $ operator is used to get
the value of a variable. Both of these are described in following sections.
Variable References
A variable reference has the form:
$name
33
Operators
Operators
Operators are used to combine one or more values to produce a new one. Typical examples of
operators are addition (+), subtraction(-), multiplication (*), division(/), etc. For most operations
the operands must be of the same type.
Most operators handle variables with multiple values by operating on each of the individual
elements. The array operator ([]) can be used to get individual elements from such a variable.
☞ The operator examples in this section use the following variable definitions:
Variable Name Value
scale 1.0
inputfile "data/atlanta.img"
path "data/"
name "atlanta.img"
x 3.04
y -4
List-Construction Operator
Addition Operator
34
Operators
Examples: Result
1+1 2
$x+1 4.04
$path+$name "data/atlanta.img"
$path+x <Error>
Array Operator
$name[expression]
The [ ] (array) operator evaluates expression to use as the index to the nth element of name.
Assume that the variable x is a list of values created by set x = {"Layer_1", "Layer_2", "Layer_3"
}; .
Example Result
$x[1] "Layer_1"
$x[3] "Layer_3"
Boolean-And Operator
Boolean-Or Operator
35
Operators
The or (boolean-or) operator first converts each expression to a 0 (if the expression evaluates
to 0) or to a 1 (if the expression evaluates to anything but zero) then if either argument is 1(true)
the result is true(1), otherwise the result is false (0). The boolean-or operator is valid only for
numeric expressions. An error is produced if a string is used in either expression.
Example Result
$x==3.04 or $x < 10 1(true)
0 or 1 1(true)
$name or $x <Error>
Concatenation Operator
The // (concatenation) operator first converts each expression to a string and then joins the two
strings to produce a new string. The // operator is valid for both string and numeric expressions
but the output is always a string.
Example Result
$name//$x "atlanta.img3.04"
$path//$name "data/atlanta.img"
$x//1 "3.041"
Division Operator
Equals Operator
36
Operators
The == (equals) operator returns true (1) if both expressions are the same, otherwise it returns
false (0). The == operator is valid for numeric and string expressions. An error is produced only
if a string and a numeric expression are compared with each other.
Example Results
$x == 2 0 (false)
$x == 3.04 1 (true)
$name == "atlanta.img" 1 (true)
$name == $x <Error>
Exponentiation Operator
The ^ or power (exponentiation) operator returns the result of raising the left-hand expression
to the value of the right-hand expression. The ^ or power operator is valid only for numeric
expressions. An error is produced if either expression is not a number.
Example Result
$x^2 9.2416
2 power $x 8.22491061325
$x^$name <Error>
Greater-Than Operator
☞ Strings are compared based upon the ASCII value of the individual characters, where:
A<Z<a<z.
Example Results
$x > 2 1(true)
$x > 3.04 0(false)
$name > "atlanta.img" 0(false)
"abc" > "def" 0(false)
37
Operators
Greater-Than-Or-Equal Operator
Inequality Operator
Less-Than Operator
38
Operators
The < (less-than) operator returns true (1) is the left-hand expression is less than the right hand
expression, otherwise it returns false (0). The < operator is valid for numeric or string
expressions. An error is produced if a string and a numeric expression are compared with each
other.
Example Results
$x < 2 0(false)
$x > 3.04 0(false)
$name < "atlanta.img" 0(false)
"abc" < "def" 1(true)
$x < $name <Error>
Less-Than-Or-Equal Operator
Logical-And Operator
39
Operators
$path&255 <Error>
Logical-Or Operator
expression | expression
The | (logical-or) operator first truncates each of is arguments to an integer value then it returns
the bitwise logical-or of the two integers. This is commonly used for bit setting operations. The |
operator is valid only for numeric expressions. An error is produced if either expression is not a
number.
Example Result
$x|255 255
$x|2 3
$path|255 <Error>
Modulus Operator
Multiplication Operator
40
Operators
2*$path <Error>
$x*$path <Error>
Negation Operator
- expression
The - (negation) operator multiplies the expression by -1. The negation operator is valid only for
numeric expressions. An error is produced if a string expression is used.
Example Results
-$x -3.04
-$name <Error>
Subtraction Operator
Value-Of Operator
41
Operators
$variablename
42
Functions
Functions
In addition to operands EML expressions may contain function calls. A function operates on zero
or more arguments and returns a result which may be either numeric or string. The type of
arguments and the type of the result depends upon the individual function. The syntax for a
function is:
functionname ( [expression [,expression...]])
When EML encounters functionname it first checks to see if the name is the name of a built-in
function. If it is then the function is called with the arguments and the result is returned. If the
name is not the name of a built-in function then EML checks to see if it is an application function.
If it is an application function then the application function is called. If the function is not a built-
in function or an application function then the message "functionname" is delivered to the source
of the script with the function arguments. If the message cannot be delivered then an error is
returned.
EML provides a set of functions which are available across all applications, these are called built-
in functions. The following sections list the built-in functions and describes the operation of each
one.
The ApplicationFunctions DLL Class provides additional application functions and the ability
to create new application functions that are available to all applications.
Application functions that are provided by an application program are available only to that
application. This type of application function is described in Translation Tables and
Application Functions.
Built-In Functions
BANDLIST Function
bandlist ( expression )
The bandlist function attempts to open the IMAGINE image file named by the argument and to
return the list of names of the layers in the file. If the file does not exist, is not an image file, or if
the expression is numeric, then an error is returned.
Example Result
bandlist("mobbay.img") ":Layer_1",":Layer_2",
":Layer_3",":Layer_4"
bandlist($x) <Error>
43
Functions
BOTTOM Function
bottom ( framepart )
The bottom function assumes that the argument names either a frame or a framepart. It returns
the bottom most coordinate of the named part. If the argument is not a framepart then an error
is returned.
Example Result
bottom(okbutton) 21.0
bottom(dialogframe) 200
bottom($x) <Error>
CDMOUNTUTIL Function
cdmountutil ( )
The cdmountutil function is used to display the CDROM Mounting utility which is used to mount
and unmount CDROMs which are configured in IMAGINE. If the function completes successfully
then the name of the mount point is returned as a string. If it fails or if the user cancels the dialog
an EMPTY value is returned.
CEIL Function
ceil ( expression )
The ceil function computes the mathematical ceiling of a floating-point number. The ceiling is
the next integer that is greater than (or equal to) the number. The argument must be a numeric
expression; if a string is used then an error is produced. The argument is assumed to be in
degrees.
Example Result
ceil(3.14159) 4
ceil(-1.5) -1
ceil(2.0) 2
ceil($name) <Error>
44
Functions
COS Function
cos ( expression )
The cos function computes the mathematical cosine of its argument. The argument must be a
numeric expression; if a string is used then an error is produced. The argument is assumed to
be in degrees.
Example Result
cos($x) .998529
cos(45) .70710678
cos($name) <Error>
ERROR Function
error( expression )
The error function is used to display an error message. The argument is the message that will
be displayed in the error dialog. The error dialog will remain up until the user dismisses it. See
the warning and message functions for other types of dialogs that can be displayed.
EXP Function
exp ( number )
The exp function computes the exponentiation of a specified number. The exponentiation is the
result of raising the constant "e" to the power of the specified number. It is the inverse of the log
function.
FEXIST Function
fexist ( expression )
The fexist function tests to see if the file named expression exists. The argument must be a
string. If the argument is numeric then an error is returned. If the named file exists then a 1(true)
is returned, otherwise a 0 (false) is returned.
45
Functions
Examples Result
fexist($name) 1(true)
fexist($x) <Error>
FEXT Function
fext ( expression )
The fext function extracts the extension portion from a filename string. The extension is the very
last characters of the filename which follow the period (.) character. The extension is typically
used to indicate file type. If the argument is numeric then an error is returned.
Example Result
fext("/data/atlanta.img") ".img"
fext("atlanta.img") ".img"
fext($inputfile) ".img"
fext($x) <Error>
FLOOR Function
floor ( expression )
The floor function computes the mathematical floor of a floating-point number. The floor is the
closest integer that is less than (or equal to) the number. The argument must be a numeric
expression; if a string is used then an error is produced.
Example Result
floor(3.14159) 3
floor(-1.5) -2
floor(2.0) 2
floor($name) <Error>
FMT Function
46
Functions
The fmt function is used to format numbers. It converts the number argument (which must be a
number) into a string using the format control string. The format control string must contain a
valid formatting string as described in Number Formatting . The result of the function is a string.
Example Result
fmt(3.04, "0%") "304%"
fmt($x, "0.000") "3.040"
fmt($name, "0") <Error>
fmt($name, $x) <Error>
FNAME Function
FPATH Function
fpath ( expression )
The fpath function extracts the path component of a filename from a string. The path component
of a filename is the part of a filename which identifies where a file is located. This is typically a
directory name. An error is returned if the argument is numeric.
Example Result
fpath("/data/atlanta.img") "/data/"
fpath("atlanta.img") ""
fpath($inputfile) "data/"
fpath($x) <Error>
47
Functions
FROOT Function
froot ( expression )
The froot function extracts the root portion from a filename string. The root is the filename minus
any path and extension. If the argument is numeric, then an error is returned.
Example Result
froot("/data/atlanta.img") "atlanta"
froot("atlanta.img") "atlanta"
froot($inputfile) "atlanta"
froot($x) <Error>
GETAOI Function
getaoi ( )
The g e t a o i function displays a dialog which allows the user to select an Area Of Interest (AOI)
from an existing AOI file or from the viewer.
48
Functions
The user interacts with this dialog to select an AOI. If None is selected, then the string "none" is
returned when the user presses OK. It is up to the EML application to check for this special case.
If File is selected, then the filelist displays a list of available .aoi files. The name of the selected
file is returned when the user presses OK. If Viewer is selected, then the Viewer is queried for
an AOI. If there is an AOI in the Viewer, then a temporary file is created and the name of the
temporary file is returned when the user presses OK.
Example Result
getaoi() "county.aoi"
getaoi() "none"
GETCFG Function
Result
400
GETDEVICELIST Function
getdevicelist ( deviceclass )
The getdevicelist function is used to get the list of devices available in the system for the named
device class. For example, it may be used to get the list of tape drives configured in the system.
If the name of the device class is invalid or if there are no devices configured, then the function
returns an empty list. The device classes are those supported by the configuration editor, such
as "tapes," "cdroms," "hosts," and "printers."
49
Functions
Example Result
getdevicelist("tapes") "host1:/dev/rmt0" "host2:/dev/
rmt1"
GETENV Function
getenv ( "environment_variable" )
The getenv command returns the value of the environment variable specified as the argument
Example:
GETFEATUREFIELDS Function
This g e t f e a t u refield s function can be used to inquire for the names of attributes available in
a given raster, vector, or annotation. Note: this does not return the values of these attributes. It
supplies the names of the attributes that are available. Only a C program can get the attribute
values.
argument value
50
Functions
argument value
GETFILELIST Function
getfilelist ( expression )
The getfilelist function uses the single argument as an expression which contains a wildcard to
be used to search for filenames. All of the names which match the list are returned as a single
set. The wildcard should include the full path of the files you are looking for, unless you know
IMAGINE is running in the directory you wish to search. In a wildcard, asterisk (*) matches any
number of characters, while question mark (?) matches exactly one character.
Example Result
getfilelist("*.img") a.img b.img zone4.img
getfilelist("?.img") a.img b.img
GETFILESINPATH Function
The getfilesinpath function searches directories for files that match a wildcard. The search path
is a colon-separated list of directories. The expression contains a wildcard to be used to search
for filenames. All of the names which match the list are returned as a single set. The wildcard
should not include the full path of the files you are looking for. In a wildcard, asterisk (*) matches
any number of characters, while question mark (?) matches exactly one character
Example
getfilesinpath("/data1:/data2", "*.img")
Result
/data1/a.img /data2/zone4.img
51
Functions
GETMAPPANELCOUNT Function
This g e t ma pp a n elc o u n t function is used to determine the number of panels which would be
required to produce a given map on a given device.
argument value
Example
getmappanelcount("test.map","file",1.0, 0.0, "rgb", "inches",
300, 8192, 8192)
Result
4
52
Functions
GETPREF Function
The getpref function provides an interface to IMAGINE Preference Database. The database
contains a series of named preferences grouped into various categories. Refer to Preference
Database for a comprehensive listing of category and preference names. The getpref function
returns the value for a given preferencename in a given category.
Example Result
getpref("eml","log_startup") "no"
getpref("eml","printer_command") "lpr"
getpref($x) <Error>
getpref($name, $x) <Error>
GETRECODETABLEFILE Function
getrecodetablefile ( filename )
The getrecodetablefile function displays a dialog which allows the user to create a recode table.
The dialog looks like the following:
53
Functions
This is used in many Raster GIS operations which need to recode class values. If the Cancel
button is pressed then an empty value is returned. This can be checked using the isempty()
function. When OK is pressed the recode table is written to a simple ASCII file with one new class
value per line. The file is created in the /tmp directory and is prefixed with the letters RCOD. The
complete path is returned as the value of the function.
Example Result
getrecodetablefile("lnsoils.img") "/tmp/RCOD006820"
getrecodetablefile("notfound") <Empty>
GETSCREENNUMBER Function
getscreennumber ( )
The getscreennumber function will return the number of the screen in which the EML script is
running. This is zero for all single-screen displays.
54
Functions
GETSTRINGHEIGHT Function
getstringheight ( expression )
The getstringheight function will compute the height (in screen pixels) of a string. The
argument is the string to be measured.
GETSTRINGWIDTH Function
getstringwidth ( expression )
The getstringwidth function will compute the width (in screen pixels) of a string. The argument
is the string to be measured.
GETTAGGEDDATA Function
name: data;
The name may be any character string excluding spaces, tabs, and colons. The data is all of the
information past the colon and up to but not including the semi-colon. If the semi-colon is
excluded then the data includes all of the characters up to but not including the end of the line.
Additionally characters included in the comment delimiters ‘/*’ and ‘*/’ are ignored.
The function works by scanning the file named filename for a line beginning with the tagname. If
a match is found then the data is returned. If no match is found or if the file cannot be located the
default value is returned.
For the following example, assume there exists a file named "importtif.tag’ which looks like:
55
Functions
/*
** This file contains information about the tiff import
** program which is used by the import scripts.
*/
extension: "*.TIF";
source: "file";
Example
gettaggeddata("importtif.tag", "extension", ".XYZ")
Result
"*.TIF"
GETTEXT Function
gettext ( expression )
The gettext function displays a dialog that prompts the user to enter a text string. The argument
is the prompt string that will be presented to be user. If a string is entered and OK is pressed
then the contents are returned. If cancel is pressed then an empty value will be returned.
HEIGHT Function
height ( part )
The height function assumes that the argument names either a frame or a framepart. It returns
the height of the named part. If the argument is not a part then an error is returned.
Example Result
height(okbutton) 20.0
height(dialogframe) 100
height($x) <Error>
56
Functions
ISBATCHON Function
isbatchon ( )
The isbatchon function returns a value of true if the system is currently in batch mode. Batch
mode is entered by using the Start Batch menu option under the Session menu on the
IMAGINE icon panel. When batch mode is on, commands which actually perform processing
must be placed into the batch queue. This function would be used in an EML file to determine
whether to perform an action now or to defer it until later.
Example Result
isbatchon() true
ISEMPTY Function
isempty ( expression )
The isempty function tests to see if the argument is empty. If the argument is empty (has no
value) then a 1(true) is returned, otherwise a 0 (false) is returned. Any variable which has not
been assigned a value is empty.
Example Result
isempty($x) 0(false)
isempty($name) 0(false)
isempty("") 1(true)
ISLICENSED Function
islicensed ( modulename )
The islicensed function checks to see if there is a license available for the named module. The
module name must be a string. This should be used with caution since it does consume a
license.
Example Result
islicensed("imvista") 1(true)
57
Functions
ISNUMBER Function
isnumber ( expression )
The isnumber function tests to see if the argument is a number. If the argument is a number
then a 1(true) is returned, otherwise a 0 (false) is returned. Until a variable has been assigned a
value, it is neither a string nor numeric—it is empty.
Example Result
isnumber($x) 1(true)
isnumber($name) 0(false)
ISSTRING Function
isstring ( expression )
The isstring function tests to see if the argument is a string. If the argument is a string then a
1(true) is returned; otherwise a 0 (false) is returned. Until a variable has been assigned a value,
it is neither a string nor numeric—it is empty.
Example Result
isstring($x) 0(false)
isstring($name) 1(true)
LEFT Function
left ( part )
The left function assumes that the argument names either a frame or a framepart. It returns the
left most coordinate of the named part. If the argument is not a part then an error is returned.
Example Result
left(okbutton) 10.0
left(dialogframe) 100
left($x) <Error>
58
Functions
LOG Function
log ( number )
The log function computes the natural logarithm of the specified number. The natural logarithm
is the number "x", such that the constant "e" raised to the power of "x" yields the specified
number. It is the inverse of the exp function.
LOG10 Function
log10 ( number )
The log10 function computes the base-10 logarithm of the specified number. The base-10
logarithm is the number "x" such that 10 raised to the power "x" equals the specified number.
LOWERCASE Function
lowercase ( string )
The lowercase function returns a value by converting all of the characters in the string argument
to lowercase.
Example Result
lowercase("aBcD") "abcd"
MAPCREATE Function
mapcreate ( )
The mapcreate function displays a dialog which allows the user to describe the basic
parameters of a Map Composition that the user wishes to create. If the user selects OK, then a
Map Composer window is opened for further editing.
59
Functions
MAPPRINT Function
mapprint ( [expression] )
The mapprint function displays a dialog which allows the user to control various options for
printing a Map Composition. If the user selects OK, then the Map Composer will be printed. The
expression, which is optional, specifies the full path of the Map Composition to be printed. If the
name is omitted, the user will be prompted for the Map Composition to be printed. The mapprint
function is identical to the mapprintdelete function, only mapprint does not delete the map
composition after printing.
60
Functions
MAPPRINTDELETE Function
mapprintdelete ( [expression] )
The mapprintdelete function displays the same dialog as mapprint. The mapprintdelete
function is identical to the mapprint function, only mapprintdelete will set the option to delete
the map composition after printing. This option can be overridden with the Delete Map File after
Printing toggle button on the Options tab.
MEMBERCOUNT Function
membercount ( expression )
The me m b e r c o u n t function returns the number of members in the given set. An expression
typically has just one value, but several of the functions return expressions with multiple values.
For example, b an d lis t returns a list of the names of the bands in a file.
61
Functions
Example Result
membercount(bandlist("mobbay.img") 4
membercount($x) 1
MESSAGE Function
message ( expression )
The message function is used to display an informational message. The argument is the
message that will be displayed in the message dialog. The message dialog will remain up until
the user dismisses it. See the warning and error functions for other types of dialogs that can be
displayed
QUOTE Function
quote ( expression )
The quote function adds double quotes ("") around its argument. If the argument is not a string,
then an error occurs. This is used to place quotes around strings like filenames which contain
characters such as / which may be delimiter characters to other parts of the system.
Example Result
quote($name) ""atlanta.img""
quote($x) <Error>
REMOVECHARS Function
62
Functions
RIGHT Function
right ( part )
The right function assumes that the argument names either a frame or a framepart. It returns
the right most coordinate of the named part. If the argument is not a part then an error is returned.
Example Result
right(okbutton) 20.0
right(dialogframe) 100
right($x) <Error>
RPCSEND Function
rpcsend(process, message)
The rpcsend function uses the RPC mechanism to send a single text message to an rpc
application. The result (which must be a text string) is returned as the value of the function.
SCREENNUMBER Function
screennumber ( )
The s c re e n nu mb er function returns the number of the screen from which the script was
executed. This number is usually 0. However, on systems with multiple heads, EML supports
multiple screens. EML numbers the screen 0, 1, 2, etc.
Example Result
screennumber() 0
SIN Function
sin ( expression )
63
Functions
The sin function computes the mathematical sine of its argument. The argument is interpreted
as degrees. The argument must be numeric. If the argument is not numeric then an error is
produced.
Example Result
sin($x) 5.30331E-2
sin(45) .70710678
sin($name) <Error>
SORT Function
The sort function returns a sorted version of the list which is given to it. The list may consist of
numeric or character elements. The sorting is in ascending order.
Example Result
sort({1, 5, 3}) 1 3 5
sort({"B", "C" ,"A"}) "A" "B" "C"
sort({"C", 2 ,"A"}) 2 "A" "C"
SORTBYFILENAME Function
sortbyfilename ( list )
The sortbyfilename function returns a sorted version of the list of file names which is given to
it. The sorting is in ascending order, and it is based upon the file name part of each item, not the
path in which the file exists. For instance, "/tmp/B.img" would appear after "/vol/A.img", and
"Z.img" would appear last.
SPLITSTRING Function
The splitstring function splits the input string into a list, using any of the characters in token as
delimiters.
64
Functions
Example Result
splitstring(":", "/tmp:/data1:xx") "/tmp" "/data1" "xx"
splitstring(":a", "/tmp:/data1:xx")"/tmp" "/d" "t" "1" "xx"
SYSTEM Function
TAN Function
tan ( expression )
The tan function computes the mathematical tangent of its argument. The argument is assumed
to be in degrees. The argument must be a numeric expression. If a string is used then an error
is produced.
Example Result
tan($x) 5.3107
tan(45) 1
tan($name) <Error>
TOP Function
top ( part )
The top function assumes that the argument names either a frame or a framepart. It returns the
topmost coordinate of the named part. If the argument is not a part then an error is returned.
65
Functions
Example Result
top(okbutton) 20.0
top(dialogframe) 100
top($x) <Error>
UPPERCASE Function
The uppercase function returns a value which is made by converting all of the characters in the
string argument to uppercase.
Example Result
uppercase("aBcDe") "ABCDE"
VERIFYSAVE Function
verifysave ( expression )
The verifysave function displays a dialog which asks the user if they wish to save changes
before closing an object. The argument is a prompt string that typically identifies the unsaved
object that is about to be closed. The user makes their choice, and verifysave returns "yes",
"no", "cancel" or an empty string if some unexpected condition occurs
WARNING Function
warning ( expression )
The warning function is used to display a warning message. The argument is the message that
will be displayed in the warning dialog. The warning dialog will remain up until the user dismisses
it. See the error and message functions for other types of dialogs that can be displayed.
WIDTH Function
66
Functions
width ( part )
The width function assumes that the argument names either a frame or a framepart. It returns
the width of the named part. If the argument is not a part then an error is returned.
Example Result
width(okbutton) 20.0
width(dialogframe) 100
width($x) <Error>
WMBORDERWIDTH Function
The wmborderwidth function returns the width of the borders which the window manager places
around frames. This is used to align frames on the screen. If an argument is given, an error is
returned.
Example Result
wmborderwidth() 5
wmborderwidth($x) <Error>
wmborderwidth("frame") <Error>
WMTITLEHEIGHT Function
wmtitleheight ( )
The wmtitleheight function returns the height of the title areas which the window manager
places at the top of frames. This is used to align frames on the screen. If an argument is given,
an error is returned.
Example Result
wmtitleheight() 5
wmtitleheight($x) <Error>
wmtitleheight("frame") <Error>
YESNO Function
67
Functions
yesno ( expression )
The yesno function displays a dialog which asks the user a yes or no question. The argument
is a string containing the question being asked. The user makes their choice, and yesno returns
"yes" or "no". yesnocancel is similar to yesno, only yesnocancel also provides an option to
cancel the operation that the question relates to.
YESNOCANCEL Function
yesnocancel ( expression )
The yesnocancel function displays a dialog which asks the user a yes or no question, with the
option to cancel the operation to which the question pertains. The argument is a string containing
the question being asked. The user makes their choice, and yesnocancel returns "yes", "no",
"cancel", or an empty string is an unexpected error occurs. yesno is similar to yesnocancel,
but yesno does not let supply a cancel button.
68
Procedures
Procedures
A procedure is a list of one or more statements which is used to initiate, modify, or control an
operation. A script may consist of only a procedure, though an EML script typically consists of
frame definitions with imbedded procedures. When a procedure is imbedded in a frame
definition, it is as a message handler or a menu action specification.
69
Statements
Statements
There are four types of statements from which procedures are constructed:
♦ Compound Statements
♦ Variable Definition Statements
♦ Flow Control Statements
♦ Command Statements
Compound Statements
A compound statement is one or more statements contained in a pair of braces "{}". A compound
statement can be used wherever a single statement may be used.
variable name ;
Variables defined in a procedure may only be accessed in that procedure. Plus, if the name is
the same as that of a containing procedure then the current definition hides the external one.
Example:
component xyz {
variable bob;
/* this variable is available to any procedure within this
component, except to those that contain their own declarations of
bob */
on startup {
variable bob;
/* this variable is available only to this procedure and the other
bob is unavailable */
70
Statements
EXIT Statement
The exit statement is used to exit from a loop. If the exit statement occurs outside of a loop it has
no effect.
Example:
set x = 0;
loop {
echo "x is " $x;
if ( x > 10 ) exit;
set x = x + 1;
}
FOREACH Statement
The foreach statement provides a looping mechanism that allows the statement to be executed
once for each member which results from the evaluation of the expression. During each iteration
of the statement the current value from the expression is assigned to the temporary variable
name.
Example:
71
Statements
IF Statement
if ( expression ) statement
[ elsif ( expression ) statement ]
.
.
[ else statement ]
The if statement allows control to pass through one of several paths in a script based on the
result of one or more logical expressions.
Any of the statements may be a compound statement. That is, it may be a series of statements
enclosed in braces "{}".
{statement;
.;
.;
statement;}
Each statement may contain any number of elsif clauses but there may be, at most, one else
clause. If the first expression is true, then the first statement is executed and control continues
with the first statement after the else clause (if present). If the second expression is true, then
the second statement is executed and control continues with the first statement after the else
clause (if present). If none of the expressions are true, then the statement in the else clause is
executed if the else clause is present.
Example:
LOOP Statement
loop statement
The loop statement is a very simple type of looping control which requires that the user provide
a means of exit from the loop with the exit statement.
72
Statements
The statement is executed continuously. The statement should be a compound statement which
contains a test that conditionally executes the exit statement.
Example:
set x = 0;
loop {
echo "x is " $x;
if ( x > 10 ) exit;
set x = x + 1;
}
RETURN Statement
return expression ;
The expression is evaluated and the result is returned as the value of the procedure. No further
statements from the procedure are executed.
SWITCH Statement
The syntax is :
switch ( controlexpression ) {
case testexpression1: statement
case testexpression2 : statement
:
case testexpressionN : statement
else : statement
}
The switch statement provides an easy means of selecting one set of operations from many
based on a single expression. First the controlexpression is evaluated and then its value is
compared against each of the testexpressions. If the value of the controlexpression matches
the testexpression then the associated statement is executed. If none of the testexpressions
match, then the optional else statement will be executed. If there is no else then no statement
will be executed.
73
Statements
Example:
switch ( $choice ) {
case "file": echo "He chose file";
case "map" : echo "He chose map";
}
WHILE Statement
The syntax is :
The expression is evaluated and if the result is true then the statement is executed. This
continues until the expression returns a false value.
Example:
variable x;
set x = 0;
while ( $x ) {
echo "x is " $x;
set x = $x + 1;
}
74
Command Statements
Command Statements
A command is a statement of the form:
Built-In Commands
This section describes the built-in commands supported by EML.
BATCHJOBNAME Command
batchjobname name ;
The batchjobname command is used to specify the name for the current batch job. The batch
manager uses this name as the default job name when job submit dialog is brought up. If a batch
job name is not specified using this command, then the batch manager uses "batch_job_1,"
"batch_job_2," etc.
CLOSE Command
close comlog ;
close statuslog ;
The close command closes one of the two output log files.
If the argument is comlog then the command history file is closed and a new one is created using
the default name. If the argument is statuslog then the Session Log file is closed and a new one
is created using the default name derived from the Preference Data Base.
75
Command Statements
Example:
on mousedown {
close comlog;
close statuslog;
}
COMLOG Command
comlog logname ;
The comlog command renames the Session Log file. The Session Log is written to an output
file whose name is initially derived from the Preference Data Base. This command renames the
output file to logname.
Example:
on mousedown {
comlog "/home/myname/session.log";
}
CONFIGURATIONEDITOR Command
configurationeditor ;
The configurationeditor command invokes the configuration editor which is used to display and
edit the currently configured devices in the system.
76
Command Statements
DISABLE Command
The disable command disables a framepart so that the user may not interact with it. The part
must be a string constant which names an existing framepart. This is often used to disable the
OK button until valid inputs are present. When a framepart is disabled, the user cannot interact
with it and it is displayed in a "grayed out" fashion to provide visual indication that the part is
inactive.
Example:
on framedisplay {
disable okbutton;
}
77
Command Statements
DISPLAY Command
display framename ;
The display command is used to display a frame if it is not currently displayed. This also sends
the message "framedisplay" to the frame so that any message handlers for "on framedisplay" are
executed. The framename argument must be the name of a frame or one of the two keywords
described below. It cannot be an expression.
If the framename is statuswindow then the Session Log is displayed. The Session Log displays
the list of all commands, messages and errors with a time stamp on each line. The status log is
an information log which simply provides a history of a user’s session.
If the framename is commandwindow then the command history is displayed. The command
history is a log of all commands which have been issued since the start of the current session.
The command window also contains a text input box where commands may be entered. This is
useful for learning the commands and for debugging scripts.
Examples:
on mousedown {
display inputrasterframe ;
}
on mousedown {
display commandwindow ;
}
ECHO Command
The echo command prints its arguments to the Session Log. There may be any number of
arguments of either string or numeric type. A newline is printed after all of the arguments. This
command is typically used to debug scripts.
Example:
78
Command Statements
ENABLE Command
The enable command enables a framepart. If a framepart is disabled the user cannot interact
with it and it is displayed in a "grayed out" fashion to provide visual indication that the part is
inactive. This command enables the part so that the user may interact with it. The part must be
a string constant which names an existing framepart. This is often used to enable the OK button
when valid inputs are present.
Example:
on input {
if ( fexist ($filename) ) enable okbutton;
}
HELPOUTLINE Command
HIDE Command
The hide command makes a frame or a framepart invisible. In this state it is still an active entity,
but it is not visible and the user may not interact with it. This is most often used to allow one or
more groups of frameparts to occupy a single position in a frame so that only the appropriate one
is shown at any one time. The part must be a string constant which names an existing framepart.
79
Command Statements
Example:
on input {
if ( $type == "A" ) {
show agroup;
hide bgroup;
hide cgroup;
}
elsif ( $type == "B" ) {
hide agroup;
show bgroup;
hide cgroup;
}
else {
hide agroup;
hide bgroup;
show cgroup;
}
}
INSERTTEXT Command
The inserttext command allows text to be inserted into the text of an edittext framepart. In an
edittext part there is always a current insertion point. It is typically indicated by a flashing cursor.
This function allows text to be inserted at the current insertion point. The command does more
than a simple insertion though. It first scans to the left and right of the insertion point looking for
bounding angle brackets, "<>". If it finds that the current insertion point is bracketed by a pair of
angle brackets, it then replaces the text between the brackets (including the brackets) with the
text of the expression. If no angle brackets are found, then it simply inserts the expression at the
cursor position. If a primary selection is made on a portion of text in the edittext part, this function
replaces the text in the primary selection with the text in the expression.
The following illustrations show the edittext framepart before and after an insertion made by the
example code. The insertion point is indicated by a vertical bar.
Example:
on mousedown {
inserttext formulapart "$Histogram" ;
}
80
Command Statements
before abs(<a>)
Insertion
point
after abs($Histogram)
JOB Command
81
Command Statements
This box is displayed as soon as the application is started. The name of the application appears
as the title of the box. Since each job may have several phases, Job State is used to indicate
the current state of the application. The Percent Done bar indicates the percent completion of
the current state. The user may click on the Cancel button at any time to terminate the job. When
the job completes, either due to termination or due to normal completion, the Done button is
enabled to signal that the job is complete. Clicking on the Done button at this time removes the
Job Status Box.
Example:
on mousedown {
job resample $inputfile $outputfile -s $scalefactor ;
}
LOAD Command
load macroname ;
The l o a d command loads an EML Macro. When the macro has been loaded into memory EML
sends it the "startup" message. The macro should have a "startup" message handler which
displays the initial frame. If it does not have a "startup" message handler then nothing happens.
The macro must use the u n lo a d command to remove the macro from memory. If the macro is
still in memory, then the load command simply sends the "startup" message to the macro; it does
not load a duplicate copy of the macro.
LOGMESSAGE Command
MOVE Command
move frame x y ;
82
Command Statements
The move command repositions a frame on the screen. The frame is repositioned to the location
specified by x and y expressions. The frame argument must be the name of a frame and may
not be an expression. The x and y arguments may be any numeric expression. The x and y
values are interpreted as pixel position with 0 0 as the upper left most pixel on the display.
Example:
on mousedown {
move iconpanel 100 0;
}
The play command sends a Sun Audio file to the audio device. This can be used to add sound
to applications on the Sun Workstation. It simply sends the named file to the audio device (/dev/
audio).
PREFERENCEEDITOR Command
preferenceeditor ;
The preferenceeditor command displays the Preference Editor. The Preference Editor is used
to display and edit the values of the system preferences. The dialog is shown on the following
page.
The Menu Bar is used to save the preferences and to quit the editor. The Status Bar shows a
short explanation of each preference. category is a popup list of all the categories which are
available. The preference values are displayed in a scrollable area so that they may be viewed
and edited.
Example:
on mousedown {
preferenceeditor;
}
83
Command Statements
Menu bar
Left-click to
see popup list
Status Bar
QUIT Command
quit ;
The quit command causes the termination of the EML interpreter. This command takes no
arguments and causes immediate termination of the EML application.
Example:
on mousedown {
quit;
}
84
Command Statements
REFLOW Command
REFRESHLIST Command
The refreshlist command updates the list of files displayed in a filename framepart. One or more
filename parts may be named. Each named filename framepart is updated.
RESIZE Command
on mousedown {
resize iconpanel 50 200 ;
}
☞ The part MUST be inside the non-resizable dialog frame. If the part is in a resizable dialog
the results will be unpredictable
SEND Command
85
Command Statements
The message argument must be a string. There are standard messages which are created and
delivered by the system in response to user input and other actions, these are detailed in Event
Messages. However, any string may be used as a message.
The to clause specifies the destination frame or framepart. The message is delivered to the
named destination. If no destination is given then the message is delivered to the source of the
script. This is usually the framepart to which the script belongs. If the destination is of the form
name then the message is sent to a part of the given name at the current level. That is, if the
command occurs in a script in a frame then the message will be sent to a part in the current
frame. If the destination is of the form component:frame:name then the message will be sent to
the part named in the given component and frame. This mechanism will not work across
processes.
The with clause specifies a list of one or more arguments which are to be sent along with the
message. The arguments may be string or numeric expressions. It is up to the message handler
to use these arguments.
Example:
SET Command
The set command is used to assign a value to a variable or to a framepart. Before a variable is
assigned a value, it is empty. An assignment statement determines the type of variable
dynamically. The second form can be used to assign values to specific locations, treating the
variable or part like an array. If the variable or part is not currently big enough to accommodate
the given index it will be extended with empty values before the assignment takes place. The
index expression must evaluate to a positive number. The first location in the array is 1.
86
Command Statements
If the destination refers to a variable then value of the expression is placed into the named
variable. If the destination refers to a framepart, the value of the expression is placed into the
framepart, the framepart is updated on the screen (if it is visible), and the message
valuechanged is sent to the framepart. If the destination is of the form name then the value is
assigned to a part or variable of the given name at the current level. That is, if the assignment
occurs in a script in a frame then the value will be assigned to a part or variable in the current
frame. If the destination is of the form component:frame:name then the value will be assigned to
the part or variable named in the given component and frame. This mechanism will not work
across processes.
If there is an message handler for "valuechanged" attached to that part, it is executed upon
receipt of the message.
Examples: Results:
set x = 4; The value of the variable x
is set to 4.
SHOW Command
87
Command Statements
The show command makes a frame or a framepart visible. Frames and framepart may be made
invisible. In this state it is still an active entity but the user may not interact with it and it is not
visible. This is most often used to allow one or more groups of frameparts to occupy a single
position in a frame so that only the appropriate one is shown at any one time. The part must be
a string constant which names an existing framepart.
Example:
on input {
if ( $type == "A" ) {
show agroup;
hide bgroup;
hide cgroup;
}
elsif ( $type == "B" ) {
hide agroup;
show bgroup;
hide cgroup;
}
else {
hide agroup;
hide bgroup;
show cgroup;
}
}
SHOWHELP Command
The showhelp command displays help from the On-Line Help data base. It requires two
arguments, a component and a frame, both of which must be strings. The On-Line Help system
is organized into application manuals.
The component and frame are used to construct the name of a hypertext link which is used to
locate and display the appropriate page of on-line help text.
If no arguments are given, the current (calling) component and frame are used. This is how the
Help button on a dialog is usually connected to On-Line Help. If you wanted to connect to the
help file of another dialog, you must use a command as in the example below.
88
Command Statements
Example:
on mousedown {
showhelp "viewer" "openrasterlayer";
}
SHOWVERSION Command
showversion ;
The showversion command displays a frame which gives the current version of IMAGINE. The
version dialog looks like:
SPAWN Command
The s p a w n command starts a separate copy of an application, shell script, or other executable.
Refer to Starting Processes for descriptions of this and other commands.
89
Command Statements
Example:
STARTBATCH Command
startbatch ;
The startbatch command begins multiple job batch mode. When multiple job batchmode is in
effect, all jobs specified by the job command are placed into a queue. When batch mode is
terminated, a dialog is displayed which allows the user to defer execution of the list of commands
to a later time. The list of batch jobs may be displayed and edited using the viewbatchlist
command. On UNIX systems, this is accomplished by using the cron utility.
Example:
on mousedown {
startbatch ;
}
STARTBATCHSINGLE Command
startbatchsingle ;
The startbatchsingle command begins single job batch mode. When single job batch mode is
in effect, the next job specified by the job command is placed into the batch queue and the user
is queried for the time at which the job is to start. The batch queue may be viewed and edited
using the viewbatchlist command. On UNIX systems, the batch queue is implemented using the
cron utility.
Example:
on mousedown {
startbatchsingle;
}
90
Command Statements
STATUSLOG Command
statuslog name ;
The statuslog command renames the command history file. The Session Manager writes all
commands to a log file called the command history. The name of this file is initially derived from
the Preference Data Base, but this command can be used to change the name of the command
history file to name.
Example:
on mousedown {
statuslog $outfilename ;
}
STOPBATCH Command
stopbatch ;
The stopbatch command terminates the batch job mode. When batch job mode is terminated
all of the job commands in the job queue are submitted to the batch queue. A dialog is displayed
which lets the user pick the time at which the jobs are executed. The batch queue may be viewed
and edited with the viewbatchlist command.On UNIX systems the batch queue is implemented
using the cron utility.
Example:
on mousedown {
stopbatch ;
}
SYNCJOB Command
91
Command Statements
The syncjob command is used to execute an application synchronously as a job. Unlike the job
command which does not wait for the completion of the job this command places the script into
a suspended state which will resume when the task completes. Each arg may be a string or
number expression which is evaluated and then used as an argument for the application
specified by name. The name argument must be a string. If Batch Mode is in effect, the command
and its arguments are placed into the batchlist to be executed at a later time. If Batch Mode is
not in effect, the application is executed immediately and a Job Status Box is displayed to track
the progress of the job.
This box is displayed as soon as the application is started. The name of the application appears
as the title of the box. Since each job may have several phases, Job State is used to indicate
the current state of the application. The Percent Done bar indicates the percent completion of
the current state. The user may click on the Cancel button at any time to terminate the job. When
the job completes, either due to termination or due to normal completion, the Done button is
enabled to signal that the job is complete. Clicking on the Done button at this time removes the
Job Status Box.
Example:
on mousedown {
syncjob resample $inputfile $outputfile -s $scalefactor ;
Message("The resample is done");
}
SYSTEM Command
92
Command Statements
The system command indicates that the arguments following it are to be passed to the UNIX
shell for execution. The Script Interpreter evaluates the contents of any variables or expressions
and passes all arguments to a new shell and waits for the command to terminate before
continuing. There is an equivalent system() function which runs the command and returns the
completion status as the value of the function.
on mousedown {
system rm $infilename ;
}
UNDISPLAY Command
undisplay frame ;
The undisplay command removes a frame from the display. The frame must be a string constant
which names an existing frame. When the command is executed the name frame is undisplayed.
on mousedown {
undisplay statuswindow;
}
UNLOAD Command
unload ;
The u n l o a d command removes a macro from memory. This should always be part of a macro
which is to be loaded with the lo a d command.
VIEWBATCHLIST Command
93
Command Statements
viewbatchlist ;
The viewbatchlist command displays the Batch Editor. The Batch Editor allows the user to
view and edit the list of batch files which are currently in the system batch queue.
Example:
on mousedown {
viewbatchlist ;
}
94
Application Commands
Application Commands
The EML script interpreter can send application commands to the currently running applications.
When the script interpreter encounters a command name, it first checks to see if that command
is a built-in EML command. If the command name is not one of those listed in the command
names table, it then looks up the application commands list supplied by the calling application. If
the above fails, it assumes the command name is the name of an IMAGINE application. If the
application is already running, it sends any arguments to the application. If the application is not
running, it tries to start the application with the arguments.
The following EML script code starts the IMAGINE Viewer and opens a Viewer window.
on mousedown {
viewer create at 10 10 size 200 300;
}
The description and syntax of all IMAGINE application commands are provided in the IMAGINE
Command and Function Syntax help file.
95
Function Commands
Function Commands
An application function may be used like a command when it is not embedded in an expression.
apfunc (a b c);
For example:
96
Components
Components
All GUI elements in an EML script are contained in a Component. The component is simply a
means of collecting one or more GUI objects into a single named group. Components may
contain one or more of the following elements:
♦ Variable Definitions
♦ Menu Definitions
♦ TextString Definitions
♦ Message Handlers
♦ Attribute Definitions
♦ Frame Definitions
The syntax is:
component name {
[ font fontname ; ]
[ titleplacement titleposition ; ]
[ foreground color ; ]
[ background color ; ]
[ variable name ; ]
[ global name ; ]
[ menu ]
[ textstring name string ; ]
[ on message with arg [ arg ... ] do procedure ]
[ on message ( arg [, arg... ] ) procedure ]
[ frame ]
}
The font, titleplacement, foreground and background attributes of the component apply to each
of the frames defined within the component. This gives a simple way of setting, e.g. the
background color for all of the frames defined in one component. Each of these attributes may
be overridden by a similar one given at either the frame or framepart level.
Variables defined at the component level are available to all procedures, menus and frames
defined in the component. Global variables are available across applications.
Menus defined at the component level do not automatically appear anywhere. They can only be
accessed within an application using C Toolkit functions. These are typically used to define
popup menus which are used in an application.
97
Components
The textstring keyword allows a name to be associated with a text string. This is also a feature
which is used only at the C Toolkit level. This allows an application to have access to text strings
which can be modified by the user. An application can query the EML script for the value of a
string by its name. These are used for status messages in many cases.
The message handlers defined at the component level with the on attribute are available to all of
the menus and frames in the component.
98
Menus
Menus
The menu system in EML allows both pulldown and popup menus to be created. Pulldown menu
definitions may appear as attributes in frames and popup menu definitions may appear as stand-
alone items in a component.
Every menu has a name which is expressed by the menuname argument. The menuname
argument is a simple character constant. The menutitle argument is the string which is displayed
to the user when the menu is displayed. The menu then consists of a series of zero or more menu
items enclosed between a pair of braces {}. Each menu item can be one of the five types
described below.
The first type of item is a separator. This simply produces an entry in the menu which is
displayed as a horizontal line. The separator is used to provide a visual separation between
different parts of a menu. There is no user interaction with this item in a menu.
The second type of menu item executes an EML procedure when the menu item is chosen. The
itemname argument is used to assign a name to the menu item, while the itemtitle argument
determines the title string that the user sees. The procedure may be any number and type of EML
statements.
The third type of menu item has a checkbox on the left-hand side. This is used to create a menu
item which has a state that can be toggled by selecting the item. The itemname is used to assign
a name to the menu item, while the itemtitle is used to determine what the user sees. The
procedure is any sequence of EML commands which is executed along with the current value of
the item when the menu item is selected. The initial state of the item is determined from the value
expression.
99
Menus
The fourth type of menu item creates a radiogroup which consists of one or more menu entries
each with a radio button displayed to the left of it. Within this group of items only one may be
checked at a time. This allows a menu to be used to select between one of a number of choices.
The itemname is used to assign a name to the set of menu items. Each one of the items in the
radiogroup has its own name, radioname and its own title, radiotitle. Whenever one of the
members of the radiogroup is selected, the specified procedure is executed with the current
value of the group (the value of radioname) contained in the variable menuvalue. The initial
value of the radiogroup menu item is determined by the optional value expression. If no value
expression is given, the first item in the group is selected.
EML provides a pseudo-variable called menuvalue which may be used in any procedure within
a menu definition. The value of the variable depends upon the type of menu item in which the
procedure was defined. For checkbox menu items the value is 0 or 1. For radiobutton menu items
the value is the radioname of the selected radiomenu item. For other menu items, the value is
undefined. Therefore $menuvalue should only be used in checkbox and radiogroup menu items.
The fifth type is simply a nested menu definition consisting of a menu declaration and any of the
four types of menu items described above. This creates a submenu which is called a pull-right
menu, because when the user selects this item, a child menu is displayed to the right of the
parent. Menus may be nested to any level, though it is not a good idea from a user interface
design point of view to exceed two levels.
A keyboard mnemonic is a single key on the keyboard which can be used to select the menu
item if the menu is displayed. The mnemonic is usually one of the letters in the title itself. The
mnemonic character is indicated by surrounding it in square brackets []. For example:
filesave "Save|Ctrl<Key>S|Ctl+S"
100
Menus
Notice that the acceleratordefinition and the acceleratorlabel are separated from the main string
by the vertical bar character. The accelerator label is displayed to the right of the menu item title
as given. The acceleratordefinition is built of the following components:
Example:
101
Menus
102
Frames
Frames
The syntax is:
frame name {
[ Attribute s... ]
[ variable ... ]
[ menu ... ]
[ framepart ... ]
[ mo d a l ;]
[ nomap; ]
[ re s i z a b l e; ]
[ m i n i mu m size number , number ; ]
[ t o o l b a r { toolpart [toolpart...] } ]
[ statusbar; ]
}
A frame is a rectangular region which contains one or more GUI elements called frameparts.
Frames are used in one of two major ways in IMAGINE, they may be used as document frames
or as dialog frames. A document frame displays some sort of information (an image, a model,
etc) which the user is editing, while a dialog frame provides a form with which the user interacts.
The components of a typical document frame are shown in the following illustration:
103
Frames
The frame is has a titlebar across the top which indicates the document being edited. Under the
titlebar is the menubar which contains the menus of commands used to edit/view the document.
After the menubar is the toolbar. The toolbar contains buttons which give quick access to
commonly used commands. The area below the toolbar is the document area. Below the
document area is the statusbar. The statusbar displays information about each of the frameparts
as the cursor passes over each part. The statusbar also displays information about the current
state of the application.
104
Frames
A dialog frame always has a titlebar which gives an indication of the purpose of the dialog. The
rest of the frame is filled with the various frameparts as defined in the following section.
Messages
mousedown (sent to the button When the quit option is selected from the frame
in the frame called cancel or menu or when the pushpin is removed.
quit).
105
Frameparts
Frameparts
Every frame is populated with one or more user interface elements such as buttons, meters, text
areas, etc. Each of these has specific attributes and behaviors as described below.
BUTTON Framepart
button name {
[ Attribute s...]
[ c o l o rb u t t o n ;]
[ i c o n iconfile ; ]
}
A button is a very simple framepart. Its main purpose is to initiate an action. A button has a value
which is always 0. Simple buttons appear in one of two forms. In the first form the button is a
rectangle with the title centered in the button. In the second form the button is rectangle filled with
an icon. Both forms have the same behavior.
origin origin
Color Button
A button may also take the form of a color button. A color button is used to provide a means of
selecting and displaying a color. The color button looks like:
106
Frameparts
Color Button
Right-hold on the color button to display a popup menu of colors shown above. You can choose
one of the colors in the menu or select the Other... option to display the color selection dialog
(ColorWheel). When the color is selected, the color of the button changes and the application is
notified that the change has taken place. The color button can only interact with code in a C
Toolkit application.
Messages
The following are the standard messages that may be delivered to buttons:
107
Frameparts
CANVASPART Framepart
canvaspart name {
[ Attribute s...]
[ h o ri z o n t als c ro llb a r ; ]
[ o f f s c re e n ; ]
[ v e rt i c a l s cro llb a r ; ]
[ v i s u a l string ; ]
}
The canvaspart part supplies access to onscreen graphics. A canvas is an area into which
arbitrary graphics may be drawn. The canvas can only interact with code in a C Toolkit
application
CELLARRAYPART Framepart
cellarraypart name {
[ Attribute s...]
[ h o ri z o n t als c ro llb a r ; ]
[ ro w c o u n t number ; ]
[ ro w t i t l e string ; ]
[ s h o w ro w c o lu mn ; ]
[ v e rt i c a l s cro llb a r ; ]
[ Column Definitions ... ]
}
column name {
[ Attribute s...]
[ c h a n g e a ble ; ]
[ c o l u m n a lig n men t alignment ; ]
[ c o l u m n d atatyp e string ; ]
[ c o l u m n l i n ewid th number ; ]
[ c o l u m n w id th number ; ]
[ editable ; ]
[ f o rm a t string ; ]
}
108
Frameparts
The cellarraypart framepart allows the user to view and edit a large (virtual) arrays of rows and
columns. In earlier releases of IMAGINE, this capability was (and still is) available by installing
a cellarray into a generic framepart. The cellarraypart allows the cellarray to be created directly
in the EML script.
Cell Array
checkbox name {
[ Attribute s...]
[ i c o n iconfile ; ]
[ i c o n s unarmediconfile , armediconfile ; ]
}
The check box framepart is used to provide user input of a boolean value. A check box is either
on (armed, value 1) or off (unarmed, value 0). Like a button, a check box can have two forms.
The first is the simple label form with the title displayed (by default) to the right of the check box.
109
Frameparts
Armed
origin
Unarmed
Messages
valuechanged User clicks on the check box and changes its value
mousedown
input
EDITTEXT Framepart
edittext name {
[ Attributes... ]
[ h s c ro l l ; ]
[ re a d o n l y ; ]
[ v s c ro l l ; ]
}
The edittext framepart is a moderately complex framepart which can be used to implement a
simple input text field or it can provide the capabilities of a multiline text editor. The value of the
edittext is the text which it contains.
110
Frameparts
If the height of the part is one or less than one, a single line edittext is created. If the height is
greater than one, then a multiline edittext is created. The multiline edittext always displays a
vertical scrollbar to the right which is used to scroll up and down through the text. The text value
can be set with the assignment commands and it may be modified using the inserttext command.
Messages
111
Frameparts
FILENAME Framepart
filename name {
[ Attribute... ]
[ f i l e t y p e d ef filterspec ; ]
[ fullpath ; ]
[ newfile ; ]
[ nocheck ; ]
[ s e l e c t wildcard ; ]
[ s h o rt f o rm; ]
}
The filename framepart provides a tool for interactively selecting a file. The user may simply
enter the filename or he may navigate through the file system and use file selection filters to
select files.
text input
Filename Framepart
area title
file
chooser
go up one button
directory
subdirectories
files scrollbar
The filename framepart consists of four main areas: the title, the text input area, the scrolling file
list and the directory popup. These areas work together to provide a range of means for selecting
files.
112
Frameparts
The title is the title defined by the title attribute, plus the current file filter in parenthesis. In the
example above the *.img in parenthesis indicates that this file list is currently displaying only
those files which end with the .img extension. The filter may be changed at any time by typing a
wildcard name into the text input area. Refer to your operating system documentation for a
discussion of the use of wildcard characters in file selection.
The text input area is used to enter a name by hand. The name may be a complete path name,
a simple filename or a directory name. The text input area is also used to change the file selection
filter. To the right of the text input area is the "Chooser Button", which will launch the File
Chooser, which provides more options in the selection of files.
The scrolling file list displays a list of all subdirectories and all files which match the current filter.
Clicking on a filename places that filename into the text input area. This makes the filename plus
the path given by the directory popup the value for the filename part. Double clicking on a
subdirectory makes that the current directory and the scrolling file list is updated to display the
contents of the new directory. The filename framepart checks about every 10 seconds to see if
the directory contents has changed, if so it automatically updates the contents of the scrolling file
list.
The directory popup contains a list of each of the directories above the current one. Clicking on
this with the left mouse button displays the list of parent directories. To move to any of the parent
directories simply select that one from the list.
file
chooser
button
113
Frameparts
Messages
The following standard messages may be delivered to the filename part. Note that these events
are not delivered for the File Chooser, until the user hits OK to approve the selected file name..
GENERIC Framepart
generic name {
[ Attribute... ]
}
The generic framepart is a simple placeholder used by C Toolkit applications to provide a means
of plugging parts such as the CellArray or ColorWheel into a frame. The C application looks for
the framepart by name and uses the title, position and size attributes of the part. The generic
framepart has no visible characteristics of its own so it is displayed as an empty area in the frame,
unless a C Toolkit application overloads the behavior of the generic framepart with new methods.
114
Frameparts
Refer to Custom Parts for more information on the use of the generic framepart.
Note: There are now specific frameparts which used a generic framepart in earlier releases of
Imagine. See the documentation of the canvaspart, cellarraypart, and colorwheel frameparts.
GROUP Framepart
group name {
[ Attribute... ]
[ framepart ... ;]
}
The group framepart is used to group other frameparts together for emphasis. The group is
indicated by a rectangular box drawn around the frameparts contained in the group.
115
Frameparts
LABEL Framepart
label name {
[ Attribute... ]
[ a l i g n [ left | center | right ] ; ]
[ f o rm a t formatstring ; ]
[ i c o n iconfile ; ]
}
The label framepart is used to place a label in a frame. The label can be a simple text string or
it may be a small image (bitmap or pixmap) provided by an icon file. There is no user interaction
with a label.
116
Frameparts
LINE Framepart
line name {
[ Attribute... ]
[ l a y o u t [ vertical | horizontal ]] ;
[ s i z e width, height ];
}
The line framepart creates simple line in a frame which can be used to separate items or call
attention to others. The lines look like:
117
Frameparts
The line framepart accepts only the layout and size framepart attributes.
METERNUMBER Framepart
meternumber name {
[ Attribute... ]
[ d e l t a expression ; ]
[ f o rm a t string ; ]
[ ma x expression ; ]
[ m i n expression ; ]
[ re a d o n l y ; ]
[ ra n g e s p ec [min, max]
}
The increment and decrement buttons (nudgers) attached to the text input area are used to
increase or decrease the number by a delta value. The delta value can be changed by middle-
holding on the increment or decrement buttons and selecting a new delta.
The meternumber has a minimum and maximum value which it may assume. The default is 0.0
to 100.0. The slider is used to change the value continuously from the minimum value to the
maximum value.
Interactive Meternumber
increment nudger
origin slider
title
118
Frameparts
If the readonly attribute is given, then the meter is read only and the user may not interact with it.
title
Messages
mousedown The user clicks in the trough to the left or right of the
valuechanged slider.
input
POPUPLIST Framepart
119
Frameparts
popuplist name {
[ Attribute...]
[ editable ; ]
[ i c o n l i s t { iconfile [, iconfile ...] } ; ]
[ n a me s stringlist ; ]
[ staticlist ; ]
[ t i t l e l i s t stringlist ; ]
}
The popuplist framepart provides a means of selecting one value from a list of several fixed
choices. The popup list appears as a button which displays the current value of the part. Left-
click on the button to display the list of choices. Selecting a choice makes that the current value
of the popup. Each item in the list has a title and a value. By default the titles and the values are
the same, however, the titlelist attribute may be used to change the label for each item to a more
readable form.
Popuplist
list option
button
title
Messages
valuechanged The user selects a new item using the popup list.
input
120
Frameparts
RADIOBUTTON Framepart
radiobutton name {
[ Attribute... ]
[ c o l u m n count ; ]
[ i c o n l i s t { iconfile [ , iconfile ... ] } ; ]
[ o p t i o n s stringlist ; ]
[ ro w count ; ]
[ t i t l e l i s t stringlist ; ]
}
The radiobutton framepart provides a means of selecting one value from a set of several fixed
choices. The radiobutton appears as a group of buttons, in which only one may be selected at
any one time. Clicking on one of the options enables it and disables the others. Each item in the
set has a title and a value. Initially the titles and the values are the same, however, the titlelist or
iconlist attribute may be used to change the label for each item to a more readable form or to an
icon.
disabled
radiotbutton
121
Frameparts
Messages
SCROLLLIST Framepart
scrolllist name {
[ Attribute... ]
[ n a me s stringlist ; ]
[ p i c t u re l i st ; ]
}
The scrolllist framepart provides a means of selecting a single value from a long list of choices.
The highlighted value in the list is the current value for the part.
Scrolllist
origin
selected
name
122
Frameparts
Messages
SPLITPANEL Framepart
splitpanel name {
[ Attribute...]
[ layout [vertical|horizonal ] ]
}
The splitpanel framepart is a container part which manages a set of children as a vertical or
horizontal tiling. The geometry of each part is managed by the splitpanel. If the panel is split
vertically then each part will span the full width of the panel, overriding any width given for the
part. The part height and locks will be used to determine the height of the part in the panel. At
least on of the parts must have its width unlocked.
TABSHEET Framepart
tabsheet name {
[ Attribute... ]
}
The tabsheet framepart is a container part which manages a set of children as a stack of cards
with index tabs. Each of the children of the tabsheet framepart must be a group. The title of the
group is used as the title of the tab on the index card. The group is positioned in the upper left
corner of the card. The "value" of the tabsheet is the name (not title) of the currently selected
group.
123
Frameparts
TEXTNUMBER Framepart
textnumber name {
[ Attribute... ]
[ d e l t a expression ; ]
[ f o rm a t string ; ]
[ ma x expression ; ]
[ m i n expression ; ]
[ ra n g e s p ec [min, max]
}
The textnumber framepart provides a means of entering or displaying a numeric value. The
textnumber provides a text input area to the left which can be used to enter a number by typing
it in. Either a numeric constant or an expression may be entered. Refer to Number Input for the
syntax of valid expressions.
The increment and decrement buttons attached to the text input area can be used to increase or
decrease the value by delta. To change the delta, right-hold on one of the nudgers and select a
new value. If the delta attribute is not given, a default value of 1.0 is used.
124
Frameparts
The textnumber has a minimum and maximum value which it may assume. If the min and max
attributes are not given, the default range is 0.0 to 100.0.
Textnumber
origin
increment button
"nudgers"
title
decrement button
text input area
Messages
125
Core Attributes
Core Attributes
All EML GUI elements share a set of common attributes including value, position, size, color, and
message handlers. The value of each part is either a number or a string and may be used just
like a variable. The position specifies the part’s placement in the frame. The size specifies the
part’s size. The color specifies the part’s color. The message handler specifies the list of actions
to be taken for given messages.
All attributes are described below. Attributes which are applicable to only a few frameparts are
so noted. Attributes that are applicable to frames only are so noted.
BACKGROUND Attribute
background "cyan" ;
background "#81b4c1" ;
FONT Attribute
font fontname ;
The f o n t attribute is used to specify the font which is used for displaying text in the part. The
font names are system specific. The list of names which may be used in an X-Window system
are found by using the xlsfonts command. The fontname is a string constant and may not be an
expression.
FOREGROUND Attribute
126
Core Attributes
The foreground attribute specifies the color to be used as the foreground for the part. The color
may be a name or it may be a triplet of numbers specifying the red, green, and blue components
of the color. The name is system specific. On an X-Window system it represents any one of the
names represented in the X color database. The name may also be a hexadecimal constant of
the form "#rrggbb" where rr, gg, and bb are two-digit hexadecimal numbers which range from 00
to FF. If the color triplet is used then the numbers range 0.0 to 1.0.
Examples:
foreground "cyan" ;
foreground "#81b4c1" ;
ON Attribute
The o n attribute is used to define a message handler. Every part may have one or more
message handlers associated with it. The message handler specifies a procedure which is to be
executed when a particular message is received. There are standard messages which are
created and delivered by the system in response to user input and other actions, these are
detailed in Event Messages. For example when a button part is selected with a mouse click, a
"mousedown" message is sent to the button part, so the button part can do something (i.e.,
display other frames, quit, or execute a procedure).
A message handler may accept arguments like a function call in a traditional language. There
are two forms which can be used to specify the argument list (either form may be used). The first
form uses the with keyword to denote the beginning of the argument list and the do keyword to
denote the end of the argument list (beginning of the procedure). The second form simply uses
parentheses to delimit the argument list.
Each of the arguments may be referenced as a local variable in the body of the procedure. None
of the default messages sent to frameparts have any arguments.
Placing message handlers at the component level of a script can be used to create functions
which can be used in all of the other procedures within the script.
127
Core Attributes
Example:
button closeb {
title "Close;
size 4,1.5;
on mousedown {
echo "Close button Selected"; /* Script code */
echo "Exiting application...";
if ($oktoquit == "Yes") /* Flow control statements */
quit; /* EML quit command *
}
}
➲ See also the receive attribute and the send command.
RECEIVE Attribute
receive message ;
The re c e i v e attribute places a part on the receiver list for a particular message. When a
message is delivered to a part, the system checks to see if the part has a message handler. If
not, then the system attempts to deliver the message to the parent of the part. Message delivery
continues from child to parent until a message handler is found or until all parents are exhausted.
When this happens, the message system checks the receiver list for parts in other components
that have used the receive attribute for the current message. The current message is delivered
to all parts in the receiver list whose message matches the current message. This can be used
to send messages between parts in different components. Refer to Message Manager for more
detail.
TITLEFONT Attribute
titlefont fontname ;
The t i t l e f o n t attribute specifies the font to be used for the title string. The fontname is system
specific. On X-Window systems the available names can be seen by using the xlsfonts
command.
128
Core Attributes
TITLEPLACEMENT Attribute
titleplacement [ titleposition ] ;
The t i t l e p l a ceme n t attribute is used to specify the default position for the titles of all parts
contained in a frame. See the title attribute description for the meanings of the different
positions.
129
Framepart Attributes
Framepart Attributes
All frameparts share a set of common attributes including value, position, size, color, and
message handlers. The value of each part is either a number or a string and may be used just
like a variable. The position specifies the part’s placement in the frame. The size specifies the
part’s size. The color specifies the part’s color. The message handler specifies the list of actions
to be taken for given messages.
All attributes are described below. Attributes which are applicable to only a few frameparts are
so noted. Attributes that are applicable to frames only are so noted.
ABOVE Attribute
☞ For compatibility reasons this attribute is still supported, but the result of using it in future
versions is unpredictable.
If the c e n t e r modifier is used the part is positioned centered above the named part.
If the ri g h t modifier is given the part is positioned above but aligned with the right side of the
named part.
If the n o g a p modifier is given then there is no space between the part and the named part.
ALIGN Attribute
The a l i g n attribute controls the alignment of the label text in the area defined for the label.
The ri g h t modifier causes the label to be right aligned. A label is left aligned by default.
130
Framepart Attributes
AT Attribute
☞ For compatibility reasons this attribute is still supported, but the result of using it in future
versions is unpredictable.
at xnumber , ynumber ;
The a t attribute is used to specify a position for the part. The numbers are constants and are
given in character positions for all frameparts. The posit ion attribute may be used to specify a
position using an expression for the x and y positions.
ATTACH Attribute
☞ This attribute is supported only in the sense that it will not cause failure of the eml script. The
result of using it in the current version is unpredictable.
BELOW Attribute
☞ For compatibility reasons this attribute is still supported, but the result of using it in future
versions is unpredictable.
If the c e n t e r modifier is used, the part is positioned centered below the named part.
If the ri g h t modifier is given, the part is positioned below but aligned with the right side of the
named part.
If the n o g a p keyword is given, then there is no space between the part and the named part.
131
Framepart Attributes
CHANGEABLE Attribute
changeable ;
The c h a n g e a b le attribute controls whether the user can change the width of a column in a
cellarray. If not specified, the width of the column is unchangeable.
CHOOSERBUTTON Attribute
chooserbutton ;
The c h o o s e rb u tto n attribute indicates that the button will be attached to a chooser. This
special type of button has a canvas representing the currently chosen item and a button that
brings up a popup window with other common choices.
COLORBUTTON Attribute
The c o l o rb u tto n attribute indicates that the button is a color button. The optional red, green,
blue are numbers ranging from (0-1) can be used to specify the default color for the button. The
other optional opacity number can be used in conjunction with red,green, blue values to enable
colorbutton opacity feature.
COLUMN Attribute
132
Framepart Attributes
column count ;
The c o l u m n attribute specifies the number of columns to be used when displaying the
radiobutton. The default is 1 for the vertical layout. The count is a constant.
COLUMNALIGNMENT Attribute
The c o l u mn alig n men t attribute controls the alignment of text within a column in a cellarray.
If not specified, the cell contents are aligned according to the default alignment of the column’s
datatype.
If the left modifier is used, the text is aligned with the left side of the column.
If the c e n t e r modifier is used, the cell contents are centered within the column.
If the ri g h t modifier is given, the cell contents are aligned with the right side of the column.
COLUMNDATATYPE Attribute
If not specified, the text modifier is used by default. The contents of the cell are treated as a
normal text string, which is aligned to the left of the cell by default.
If the b o o l e a n modifier is used, the cell is displayed as a space or an "x". "x" indicates a true
value, while empty space indicates false.
If the e x c l u s iv e modifier is given, then a ">" appears in one and only one row of the column.
The other rows are blank. This provides a way to let the user select exactly one item.
If the double modifier is used, the contents of the cell are treated as numeric text, which is right-
justified by default.
133
Framepart Attributes
If the color modifier is used, the contents of the cell are displayed as a block of the given color.
The value is three or four values (red, green, blue, and perhaps opacity) between 0.0 and 1.0.
COLUMNLINEWIDTH Attribute
columnlinewidth number ;
The c o l u m n lin e wid th attribute controls the width, in pixels, of the line that appears to the
right of a column in a cellarray. If not specified, the default line width is 1.
COLUMNWIDTH Attribute
columnwidth number ;
The c o l u m n w id th attribute controls the width, in pixels, of a column in a cellarray. Since the
font is proportional, this does not directly control how many characters will fit in a given column.
DIMENSION Attribute
EDITABLE Attribute
editable ;
The e d i t a b l e attribute, in a cellarray column definition, controls whether the user can change
the value of a cell in that column. In a popuplist, it allows the user to type their own value for the
popuplist. Without this attribute, the user can only use the predefined values made available by
the popuplist.
134
Framepart Attributes
☞ This attribute is used ONLY by the popuplist framepart or by column(s) in the cellarray
framepart.
FILETYPEDEF Attribute
filetypedef filterspec ;
The filetypedef attribute(s) specify the file filter types to be allowed by a filename part. The
filterspec specifies which FileFilter DLL should be referenced and has the following syntax:
filtertitle identifies the FileFormat DLL (without the .dll extension). The template list, if present,
specifies which templates to use from that FileFormat DLL. If no template list is present, all
applicable types from that DLL are used.
Alternatively, filtertitle may be a descriptive pseudotitle. A pseudotitle does not refer to any DLL,
and the template list must contain exactly one item, which is the wildcard for the data type.
Pseudotypes have reasonable default behavior based upon the template.
Examples: File Types Allowed
filetypedef "coverage"; All types in coverage.dll
filetypedef "raster(*.img,*.jpg)"; IMAGINE and JPEG from ras-
ter.dll
filetypedef "Map Composition(*.map)";
Any files with a .map exten-
sion
You can specify as many filetypedef attributes as necessary to identify all of the data types to
be allowed by the filename part. If no filetypedef attributes are specified, then the select attribute
will determine what the filtering (however limited) will be used.
FORMAT Attribute
format xlformatstring ;
The format attribute, when specified for a cellarray column, controls how values in that column
will be displayed. Consult the documentation for Number Formatting for a discussion of the
format strings.
135
Framepart Attributes
☞ This form of the format attribute is used ONLY by columns in a cellarray framepart. Consult
the format (Number) attribute under "Number Attributes" for the formats supported by the
label, textnumber, and meternumber frameparts.
FULLPATH Attribute
fullpath ;
The fullpath attribute specifies that a filename part shall display the full path of the current file,
rather than just the name of the file. This can be useful for shortform filenames where the
directory is not immediately apparent.
GAP Attribute
gap gapvalue ;
The g a p attribute specifies the amount of space to be left between parts when they are
positioned automatically. When parts are positioned automatically there is a gap left between
them. The initial gap is 0.5 character space, however, this may be changed by using the gap
attribute.
GEOMETRY Attribute
The g e o m e t ry attribute is new in Rev 8.2, it replaces the at /size attributes which are obsolete
in this version. For compatibility reasons, EML tries to translate the at /size attributes to the
closest possible g eo metry attributes. Always use the geomet ry attributes since, the
translation of a t/size to g eo metry may not provide the expected results. This is due to the
fact that the units in g e o metry are pixels as opposed to character units in at /size.
HORIZONTALSCROLLBAR Attribute
136
Framepart Attributes
horizontalscrollbar ;
HSCROLL Attribute
hscroll ;
The h s c ro l l attribute specifies that the edittext is to have a horizontal scroll bar if it is a multiline
text. If the hscroll attribute is not present then the text automatically wraps.
ICON Attribute
icon iconfile ;
The icon attribute is used to specify an iconfile which may be used instead of the title. The icon
file may be in either the xbitmap or xpixmap formats. The xbitmap is a one bit image which is
created by either the Sun iconeditor or the X bitmap editor. The xpixmap format is a color format
with 8 bits per pixel. When an xpixmap (xpm) is used, EML takes the value of the upper left most
pixel to be the "background" color. That is, it substitutes the current background color for all
pixels in the pixmap which match the upper left most pixel. This is done because the X pixmap
format does not support a transparent color. This could be done by using an associated mask
file, but that would double the number of files used.
☞ This attribute is used ONLY by the button, checkbox, and label frameparts.
ICONS Attribute
The i c o n s attribute specifies the icons to be used for both the armed and unarmed states of the
check box. See the ico n attribute for a description of the icon files.
137
Framepart Attributes
ICONLIST Attribute
The i c o n l i s t attribute is used to specify a list of iconfiles which may be used instead of the title.
The icon files may be in either the xbitmap or xpixmap formats. The xbitmap is a one bit image
which is created by either the Sun iconeditor or the X bitmap editor. The xpixmap format is a color
format with 8 bits per pixel. When an xpixmap (xpm) is used, EML takes the value of the upper
left most pixel to be the "background" color. That is, it substitutes the current background color
for all pixels in the pixmap which match the upper left most pixel. This is done because the X
pixmap format does not support a transparent color. This could be done by using an associated
mask file, but that would double the number of files used.
☞ This attribute is used ONLY by the popuplist, scrolllist, and radiobutton frameparts.
INFO Attribute
info string ;
The i n f o attribute specifies the string which is to be displayed in the Status Bar when the cursor
is on top of this part. This provides a means of providing the user with constant feedback about
the function of each of the parts in the system.
LAYOUT Attribute
The l a y o u t attribute is used to specify whether the part is to be laid out in a vertical or
horizontal direction.
138
Framepart Attributes
LEFT Attribute
The l e f t attribute is used to position one part relative to another. It is followed by one of the
modifiers t o p , c e n te r, or b o tto m.
If t o p is used (the default) then the part is positioned to the left of the named part with their tops
aligned.
If c e n t e r is used then the part is positioned to the left of the named part with their centers
aligned.
If b o t t o m is used then the part is positioned to the left of the named part with their bottoms
aligned.
LEFTOF Attribute
☞ For compatibility reasons this attribute is still supported, but the result of using it in future
versions is unpredictable.
The l e f t o f attribute is used to position one part to the left of another part. It has the same effect
as the l e f t attribute with the to p modifier.
LOCK Attribute
The l o c k syntax is new in Rev 8.2, it replaces the at t ach which is obsolete in this version. The
lock attribute is used to specify how a change in frame size will be distributed among the
frameparts within the frame. For compatibility reasons, EML tries to translate the at t ach syntax
to the closest possible lo ck syntax. The lock mechanism is very simple when compared to
a t t a c h . Due to this fact, the translation of at t ach to lock may not always provide the expected
results. The following is the description on how to use lock
139
Framepart Attributes
l e f t - Left side of part is locked to frame (i.e. The left side always has the same offset to the
frame)
r ig h t - Right side of part is locked to frame (i.e. The right side always has the same offset to the
frame)
to p - Top side of part is locked to frame (i.e. The top side always has the same offset to the
frame)
bo t t o m - Bottom side of part is locked to frame (i.e. The bottom side always has the same offset
to the frame)
In order to work correctly, the the lo ck mechanism requires the frame parts to be laid out with
absolute geometry (i.e. Use the geometry attribute to specify absolute geomet ry, DO NOT
use s i z e / a t ). By default, the locks in all the parts in a resizable frame will be set to be
proportional to their geometry (i.e. width,height,left,right,top and bottom are unlocked -- during
the resize, the increment in frame size is proportionally divided among all the frame parts). lo ck
can be used to specify how to distribute the change in frame size. See the example lock.eml
below for reference.
Example:
component lock_test {
frame geom_frame {
title "Geometry Test";
geometry 100,100,200,250;
resizable;
edittext text_entry {
title above center "Text Entry:";
geometry 0,0,200,220;
lock left, right, top,bottom;
}
button quitit {
title "Quit";
geometry 67,222,65,25;
lock width,height,bottom;
on mousedown quit;
}
}
on startup display geom_frame;
}
140
Framepart Attributes
MAX Attribute
max value ;
The ma x attribute sets the maximum value which the meternumber may assume. The default
for this value is 100.0. The value is an expression which is evaluated at the time the framepart
is created.
MIN Attribute
min value ;
The m i n attribute sets the minimum value which the meternumber may assume. The default for
this value is 0.0. The value is an expression which is evaluated at the time the framepart is
created.
MINIMUMSIZE Attribute
☞ This attribute is used ONLY by the frame. It is NOT applicable to any framepart.
MODAL Attribute
modal ;
141
Framepart Attributes
A frame may be modal or non-modal. A modal frame receives all input to the exclusion of all
others. This means that while a modal frame is displayed no other dialogs in the application are
active. This is used when the user must enter some information before proceeding. Frames are
non-modal by default.
☞ This attribute is used ONLY by the frame. It is NOT applicable to any framepart.
NAMES Attribute
names stringlist ;
The n a m e s attribute specifies the list of values which the popuplist may assume or the list of
names which is placed in the scrolllist. The stringlist is an expression which is evaluated when
the framepart is created.
NEWFILE Attribute
newfile ;
The n e w f i l e attribute indicates that the selected filename must represent a new file. If the user
enters the name of an existing file the following dialog is displayed:
If "Yes" is selected then the selected file is deleted. If "No" is selected then the text input area of
the filename framepart is cleared.
142
Framepart Attributes
NOCHECK Attribute
nocheck ;
The n o c h e c k attribute indicates that no checking on the validity of the filename is to be done.
This is used for applications which may create new files or overwrite existing ones.
NOMAP Attribute
nomap ;
The nomap attribute causes a frame to be invisible after it is invoked by the display command.
It is made visible only when the show command is used. This was implemented to allow some
frames to be displayed at startup time, but to remain invisible until they were needed. This
improves the perceived performance, but at the expense of more memory.
☞ This attribute is used ONLY by the frame. It is NOT applicable to any framepart.
OFFSCREEN Attribute
offscreen ;
The offscreen attribute causes a canvaspart to be an offscreen memory canvas. It can be
drawn to, like any other canvas, but it is not displayed. The contents of the memory canvas can
be copied to and from other canvases. An offscreen canvas may not always be useful for
canvases displayed on other screens.
OPTIONS Attribute
options stringlist ;
143
Framepart Attributes
The o p t i o n s attribute specifies the list of values which the radiobutton may assume. The
stringlist is an expression which is evaluated when the framepart is created.
PICTURELIST Attribute
picturelist ;
The p i c t u re list attribute indicates that the scrolling list contains pixmaps instead of text
strings. This feature is only useful to C Toolkit programmers since the actual pixmaps have to be
provided by C Toolkit Functions.
POSITION Attribute
RANGESPEC Attribute
The ra n g e s pec attribute sets the minimum and maximum values for the number to be entered
in the part. If used without any arguments this attribute sets a maximum and minimum values to
the highest/lowest values possible for a double precision number. You can also substitute the
keyword nolimit, for either the min or max number specifications to set the lowest/highest
number.
Examples:
rangespec;
rangespec 0, 100;
rangespec nolimit, 100;
rangespec 100, nolimit;
144
Framepart Attributes
READONLY Attribute
readonly ;
The readonly attribute indicates that the framepart is for display purposes only and the user
cannot interact with it.
For a single line edittext, the text area does not appear inset.
RESIZABLE Attribute
resizable ;
The resizable attribute is given to a frame to make it resizeable. A resizeable frame is indicated
by the presence of "grab handles" on the corners of the frame. These can be used to enlarge or
reduce the size of the frame. Most document frames are resizeable so that the user can change
the area of the document being viewed or edited. Most dialog frames are not resizeable since
the information content of the frame is fixed. Frames are fixed (not resizeable) by default. If a
frame is resizeable a minimum size for the frame must be given.
☞ This attribute is used ONLY by the frame. It is NOT applicable to any framepart.
RIGHT Attribute
The ri g h t attribute is used to position one part relative to another. It is followed by one of the
modifiers t o p , c e n te r, or b o tto m.
If t o p is used (the default) then the part is positioned to the right of the named part with their tops
aligned.
If c e n t e r is used then the part is positioned to the right of the named part with their centers
aligned.
If b o t t o m is used then the part is positioned to the right of the named part with their bottoms
aligned.
145
Framepart Attributes
RIGHTOF Attribute
☞ For compatibility reasons this attribute is still supported, but the result of using it in future
versions is unpredictable.
ROW Attribute
row count ;
The ro w attribute specifies the number of rows to be used when displaying the radiobutton. The
default is 1 for the horizontal layout. The count is a constant.
ROWCOUNT Attribute
rowcount count ;
ROWTITLE Attribute
rowtitle string ;
146
Framepart Attributes
The ro w t i t l e attribute specifies the title of the column of a cellarray which is used to number
the rows. This column is the left-most column in the cellarray, but will only appear if enabled by
the showrowcolumn attribute. The default title is "Row".
SELECT Attribute
select wildcard ;
The select attribute is used to specify the initial file filter for the filename list. The wildcard is a
string expression which contains a path and wildcard.
Example:
select "/data/*.img";
SHORTFORM Attribute
shortform ;
The s h o rt f o r m attribute creates a short version of the filename part with only a text input area
and an open icon at the right end. Clicking the icon will bring a full form filename list. The behavior
of shortform filename will be exactly the same.
SHOWROWCOLUMN Attribute
showrowcolumn ;
147
Framepart Attributes
SIZE Attribute
☞ For compatibility reasons this attribute is still supported, but the result of using it in future
versions is unpredictable.
STATICLIST Attribute
staticlist ;
The s t a t i c l i st attribute is used to indicate that the list of choices for a popuplist framepart will
always be displayed. By default, only the current choice is displayed, and the user must left-click
on the arrow button to see the list of choices.
STATUSBAR Attribute
The s t a t u s b a r attribute is used to indicate that the frame should have a status bar. The
statusbar is placed at the bottom of the frame.
☞ This attribute is used ONLY by the frame. It is NOT applicable to any framepart.
TITLE Attribute
148
Framepart Attributes
The title attribute of a part displays titlestring near the part to identify the purpose of the part.
The value of titleposition may be set to any one of 12 different locations relative to the part as
shown below.
See the titlefont and titlegap attributes described below for more information about part titles.
TITLEGAP Attribute
titlegap number ;
The t i t l e g a p attribute specifies the spacing between the part and the title. A value of zero
places the title adjacent to the part with no intervening space. See the diagram on the previous
page with the title attribute.
TITLELIST Attribute
titlelist stringlist ;
When used with the popuplist framepart, the t it lelist attribute specifies the list of values which
are displayed in the popuplist. This list must have the same number of items as the list given in
the n a me s attribute. These strings are displayed in the popuplist though the actual values of
the popuplist are obtained from the names list.
149
Framepart Attributes
When used with the radiobutton framepart, the t it lelist attribute specifies the list of values
which are displayed in the radiobutton. This list must have the same number of items as the list
given in the o ptio n s attribute. These strings are displayed in the radiobutton though the actual
values of the radiobutton are obtained from the options list.
TITLEOFFSET Attribute
150
Framepart Attributes
The titleoffset attributes is used to control the spacing of the area provided for the title associated
with each part. The area set aside for each frame part is divided into two areas, one is the
titlearea and the other is the control area. The diagram below illustrates the four possible
divisions and shows how the titleoffset is used in each case.
Bottom Bottom
TitleOffset TitleOffset
Left Right
Part Height
Part Height
Above Below
TOOLBAR Attribute
151
Framepart Attributes
The t o o l b a r attribute is used to specify the list of frameparts to display in the toolbar. The list
may consist of any mix of buttons, labels, radiobuttons, checkboxes, edittexts, textnumbers,
meternumbers and popuplists. The toolbar is always positioned immediately below the menubar
if present. Any function available through the toolbar should also be accessible from the menu
bar of the frame.
☞ This attribute is used ONLY by the frame. It is NOT applicable to any framepart.
VALUE Attribute
The syntax is
value expression ;
An assignment statement has the form "set partname = expression". If the name of the part
appears on the left-hand side of an assignment statement, then the value of the part is changed
and the appearance of the part on the screen is updated to reflect the change.
The value attribute may be specified for a framepart to define its initial value. If the expression
used to give the value contains a reference to another framepart then the value is updated
whenever the value of the part in the expression changes. This allows a spreadsheet-like
automatic calculation of framepart values.
See Also:
VERTICALSCROLLBAR Attribute
verticalscrollbar ;
The v e rt i c a lsc ro llb a r attribute specifies that the cellarray or canvas is to have a vertical
scroll bar.
152
Framepart Attributes
VISUAL Attribute
The visual attribute controls the display type to be used by the drawing area within a canvaspart
framepart. This can affect how much memory is used by the canvas.
VSCROLL Attribute
vscroll ;
The v s c ro l l attribute specifies that the edittext is to have a vertical scroll bar if it is a multiline
text. If the vscroll attribute is not present, some lines may not be accessible to the user.
153
Number Attributes
Number Attributes
The textnumber and meternumber parts have a number of attributes in common. These are
described below.
DELTA Attribute
delta value ;
The d e l t a attribute sets the value by which the number is incremented or decremented when
the "nudgers" are used. If the delta attribute is not given, a default value of 1.0 is assumed. The
value is an expression which is evaluated at the time the framepart is created.
format string ;
The format attribute sets the display format to be used if the value of the label is a number. It
describes how to convert the numeric value of a label into a string. This is not the same formatting
as discussed in Number Formatting. This is a much simpler format which specifies the total
number of digits (T) and the number of decimal places (D) to be displayed in the form "T.D".
Example: Result:
format "6.3" ; 123.456
format "10.0" ; 1234567890
☞ This form of the format attribute is used ONLY by the label, meternumber, and textnumber
frameparts. Consult the format attribute under "Framepart Attributes" for the format strings
supported by columns in a cellarray framepart.
154
Framepart Functions
Framepart Functions
The following functions are used with all frameparts.
GEOMETRYSET Function
Syn t a x $part.GeometrySet(x, y, width, height)
Ret u rn None
Arg u me n t s All arguments are integers.
Des c ri p t i o n The geometryset part function is used to set the position and size of a part
in a single statement. This function takes four numeric parameters: x, y, width,
height.
TITLEGET Function
Syn t a x $part.TitleGet()
Ret u rn This function returns a string which contains the title of the part.
Arg u me n t s None
Des c ri p t i o n The titleget part function is used to get the title of a part. Every part in EML
may have a title. The title is typically used to label the part when it is displayed.
TITLESET Function
Sy n t a x $part.TitleSet(<title>)
Re t u rn None
Arg u m e n t s <title> is a string to be used as the new title for the part.
De s c ri p t i o n The titleset function sets the title of a part. It should be used before the
part is displayed. One exception is in the case of frames. A frame’s title may be
changed at any time and the change will be reflected on the screen.
COLUMNSELECT Function
Syn t a x $cellarray.ColumnSelect( selectstring )
155
Framepart Functions
Ret u rn None
Arg u me n t s The selectstring is "all", "none", or "invert". "all" causes all columns to be
selected. "none" deselects every column. "invert" selects everything that was
not selected, and deselects everything that was selected.
Des c ri p t i o n The columnselect part function changes which columns (if any) are currently
selected in the cellarray.
COPY Function
Syn t a x $cellarray.Copy( )
Ret u rn None
Arg u me n t s None
Des c ri p t i o n The copy part function causes the currently selected rows and/or columns to
be duplicated to the clipboard, which can be pasted into other cells in the array.
DELETE Function
Syn t a x $cellarray.Delete( )
Ret u rn None
Arg u me n t s None
Des c ri p t i o n The delete part function removes the currently selected columns from the
cellarray. This operation cannot be undone.
EXPORT Function
Syn t a x $cellarray.Export( )
Ret u rn None
Arg u me n t s None
Des c ri p t i o n The export part function causes the cellarray export dialog to be displayed,
giving the user an opportunity to export the contents of the selected rows and
columns to a file.
FORMAT Function
Syn t a x $cellarray.Format( [ formatstring ] )
Ret u rn None
156
Framepart Functions
Arg u me n t s An optional string that represents the new format for the selected columns. If
no value is supplied, a dialog will allow the user to select a new format.
Des c ri p t i o n The format part function allows the user to change the display format
(numeric, date, etc.) of the selected columns.
IMPORT Function
Syn t a x $cellarray.Import( )
Ret u rn None
Arg u me n t s None
Des c ri p t i o n The import part function causes the cellarray import dialog to be displayed,
giving the user an opportunity to import the contents of a file into the selected
rows and columns.
PASTE Function
Syn t a x $cellarray.Paste( )
Ret u rn None
Arg u me n t s None
Des c ri p t i o n The paste part function causes the contents of the clipboard to be inserted
into the currently selected rows and/or columns. The clipboard must be
previously populated by a copy operation.
REPORT Function
Syn t a x $cellarray.Report( )
Ret u rn None
Arg u me n t s None
Des c ri p t i o n The report part function causes the cellarray report dialog to be displayed,
giving the user an opportunity to format a report file based upon the cellarray.
The report will cover the entire cellarray, or upon any rows or columns that are
selected.
ROWINSERT Function
Syn t a x $cellarray.RowInsert( where )
Ret u rn None
157
Framepart Functions
Arg u me n t s The argument states where the row should be inserted. "before" means that
the new row should be inserted before the selected row. "after" means that the
new row should be inserted after the selected row. The value must be "before"
or "after" or nothing will happen.
Des c ri p t i o n The rowinsert part function will cause an empty row to be inserted before or
after the first selected row in the cellarray.
ROWSELECT Function
Syn t a x $cellarray.RowSelect( [ selectstring ] )
Ret u rn None
Arg u me n t s The optional selectstring is "all", "none", "invert", or a query string. "all" causes
all rows to be selected. "none" deselects every row. "invert" selects every row
that was not selected, and deselects every row that was selected. An empty
string will cause the row criteria dialog to be brought up, allowing the user to
form their own query that controls what rows will be selected.
A query string causes rows that match that criteria to be selected, deselecting
all others.
Des c ri p t i o n The rowselect part function changes which rows (if any) are currently
selected in the cellarray. This function is identical to the other rowselect part
functions, except when a query string is supplied. In that case, this function
acts as if performing the "Select" function from the row criteria dialog.
ROWSELECTADD Function
Syn t a x $cellarray.RowSelectAdd( [ selectstring ] )
Ret u rn None
Arg u me n t s The optional selectstring is "all", "none", "invert", or a query string. "all" causes
all rows to be selected. "none" deselects every row. "invert" selects every row
that was not selected, and deselects every row that was selected. An empty
string will cause the row criteria dialog to be brought up, allowing the user to
form their own query that controls what rows will be selected.
A query string selects those rows that match the criteria, without disturbing
any others.
Des c ri p t i o n The rowselectadd part function changes which rows (if any) are currently
selected in the cellarray. This function is identical to the other rowselect part
functions, except when a query string is supplied. In that case, this function
acts as if performing the "Add" function from the row criteria dialog.
158
Framepart Functions
ROWSELECTREMOVE Function
Syn t a x $cellarray.RowSelectRemove( [ selectstring ] )
Ret u rn None
Arg u me n t s The optional selectstring is "all", "none", "invert", or a query string. "all" causes
all rows to be selected. "none" deselects every row. "invert" selects every row
that was not selected, and deselects every row that was selected. An empty
string will cause the row criteria dialog to be brought up, allowing the user to
form their own query that controls what rows will be selected.
A query string deselects those rows that match that criteria, without disturbing
any others.
Des c ri p t i o n The rowselectremove part function changes which rows (if any) are currently
selected in the cellarray. This function is identical to the other rowselect part
functions, except when a query string is supplied. In that case, this function
acts as if performing the "Remove" function from the row criteria dialog.
ROWSELECTRESELECT Function
Syn t a x $cellarray.RowSelectReselect( [ selectstring ] )
Ret u rn None
Arg u me n t s The optional selectstring is "all", "none", "invert", or a query string. "all" causes
all rows to be selected. "none" deselects every row. "invert" selects every row
that was not selected, and deselects every row that was selected. An empty
string will cause the row criteria dialog to be brought up, allowing the user to
form their own query that controls what rows will be selected.
A query string selects only those rows that meet the criteria and are already
selected. All others are deselected.
Des c ri p t i o n The rowselectreselect part function changes which rows (if any) are currently
selected in the cellarray. This function is identical to the other rowselect part
functions, except when a query string is supplied. In that case, this function
acts as if performing the "Subset" function from the row criteria dialog.
STATS Function
Syn t a x $cellarray.Stats()
Ret u rn None
Arg u me n t s None
159
Framepart Functions
Des c ri p t i o n The stats part function causes column statistics to be computed and displayed
as another cellarray. This function is equivalent to selecting "Compute Stats..."
item from the column options menu
ADDTYPEDEF Function
Syn t a x $filename.AddTypeDef( filterspec )
Ret u rn None
Arg u me n t s The filterspec argument specifies the types that should be added to the list
allowed by the given filename part. In conjunction with the cleartypedefs part
function, you can completely control the set of types allowed by the filename.
Consult the documentation of the filetypedef attribute for the syntax of
filterspec.
De s c ri p t i o n The addtypedef part function adds one or more types from a FileFilter DLL to
the list of types supported by a filename part. You can call addtypedef as
many times as is necessary to completely enumerate the types that should be
allowed.
AUTOEXTEND Function
Syn t a x $filename.AutoExtend( filenamebase )
Ret u rn This function returns the full filename, after adding the default extension (if any
apply) to filenamebase. The result should be the same as what would happen
if the user typed filenamebase in the filename part.
Arg u me n t s The base part of a file name.
Des c ri p t i o n The autoextend part function, will add an extension to a filename, according
to the filename part’s autoextension rules. If the file already has an extension,
or is enclosed in double quotes, no extension is added. Otherwise, if the
current file type has a well-known extension (i.e. ".img"), then that extension is
added.
BOUNDARIESKNOWN Function
Sy n t a x $filename.BoundariesKnown()
160
Framepart Functions
Ret u rn This returns a Boolean value which is 1 if the map boundaries of the named
file are known, or 0 otherwise. This function can be helpful in determining if
the values returned by the ulx, uly, lrx, and lry part functions will be of any
use.
Arg u me n t s None
Des c ri p t i o n The boundariesknown part function is used to determine whether or not the
file named by the filename part has map boundaries. This includes raster
images that have been calibrated. If you would rather exclude calibrated raster
images, the flag part function can be used instead.
Exa m p l e In this example the filename part input has the value "$IMAGINE_HOME/
examples/lanier.img"
on mousedown {
if ( $input.BoundariesKnown() ) {
echo "The map boundaries are known";
}
}
CATEGORYTEST Function
Syn t a x $filename.CategoryTest( candidatefilename )
Ret u rn This function tries to determine the category of candidatefilename, using the
list of categories allowed by the filename part. Possible values include the
name of the FileFilter DLL (e.g. "raster", "vector", "Annotation") or pseudotitles
for types that do not have a DLL (e.g. "Map Composition")
Arg u me n t s None
Des c ri p t i o n Each filenamepart may name a list of valid file categories by using the
filetypedef keyword. The categorytest function checks to see which category
a given filename would fall under. In other words, categorytest("foo") returns
what getcategory() would return, if "foo" were selected in the filename part.
Exa m p l e In this example the filename part has the following list of filetypedef keywords
and the named file is "$IMAGINE_HOME/examples/lanier.img".
filetypedef "raster";
filetypedef "Annotation (*.ovr)"
filetypedef "coverage(*.arcinfo)"
on input {
echo "This would be "
$input.CategoryTest("lnanno.ovr");
}
161
Framepart Functions
CLEARTYPEDEFS Function
Syn t a x $filename.ClearTypeDefs()
Ret u rn None
Arg u me n t s None.
Des c ri p t i o n The cleartypedefs part function will restore the filename part to a state where
it does not recognize any specific file types. In conjunction with the
addtypedef part function, you can completely control the set of types allowed
by the filename part. After calling cleartypedefs, it is recommended that you
call addtypedef or templateset, so that the filename part has some basis for
filtering.
DATATYPE Function
Syn t a x $filename.DataType()
Ret u rn The pixel type of the raster file currently named by filename. The values
specify a datatype (e.g. "U8", "S16", "F32", "C128"). If the named file is not a
raster, an empty string is returned.
Arg u me n t s None
Des c ri p t i o n The datatype part function is used to determine the data type of the image
named by the filename part.
Exa m p l e In this example the filename part input has the value "$IMAGINE_HOME/
examples/lanier.img"
on mousedown {
echo "File Data Type is " $input.DataType();
}
File Data Type is U8
FILETYPE Function
Syn t a x $filename.FileType()
162
Framepart Functions
Ret u rn The filetype of the file currently named by the filename part is returned. The
return values depend upon the FileFilter DLL involved. The raster.dll returns
"truecolor", "greyscale", or "pseudocolor", Annotation.dll returns "Annotation",
coverage.dll returns "coverage". If the DLL does not supply layer information,
the return value is "unknown".
Arg u me n t s None
Des c ri p t i o n The filetype part function is used to obtain the type of image named by the
filename part.
Exa m p l e In this example the filename part input has the value "$IMAGINE_HOME/
examples/lanier.img"
on mousedown {
echo "The File Type is " $input.FileType();
}
The file type is truecolor
FLAG Function
Syn t a x $filename.Flag()
Ret u rn This returns a Boolean value which is 1 if the named file is:
(a) a raster image with non-calibrated Map Information,
(b) an annotation with Map Boundaries, or
(c) a coverage with Map Boundaries.
If none of the above are true, flag returns 0.
Arg u me n t s None
Des c ri p t i o n The flag part function is used to determine whether or not the file named by
the filename part has map boundaries other than through calibration. The
boundariesknown function is a more general way to determine if values are
known for the map boundaries of the image, as returned by the ulx, uly, lrx,
and lry part functions.
Exa m p l e In this example the filename part input has the value "$IMAGINE_HOME/
examples/lanier.img"
on mousedown {
if ( $input.Flag() ) {
echo "The map boundaries are known for this non-
calibrated image";
}
}
163
Framepart Functions
GETCATEGORY Function
Syn t a x $filename.GetCategory()
Ret u rn This function returns the category of the file named by the current filename
part. The category is determined by comparing against the list of file
categories defined by the filetypedef keywords in the named filename part.
Possible values include the name of the FileFilter DLL (e.g. "raster", "vector",
"Annotation") or pseudotitles for types that do not have a DLL (e.g. "Map
Composition")
Arg u me n t s None
Des c ri p t i o n Each filenamepart may name a list of valid file categories by using the
filetypedef keyword. The getcategory function checks against the named
categories and determines which is the category of the file currently named by
the filename part.
Exa m p l e In this example the filename part has the following list of filetypedef keywords
and the named file is "$IMAGINE_HOME/examples/lanier.img".
filetypedef "raster";
filetypedef "Annotation (*.ovr)"
filetypedef "coverage(*.arcinfo)"
on input {
echo "The category is " $input.GetCategory();
}
HEIGHT Function
Syn t a x $filename.Height()
Ret u rn This function returns the height of the image as the number of rows, if the
filename is a raster image, or 0 otherwise.
Arg u me n t s None
Des c ri p t i o n The height function supplies the height of a raster image.
LAYERCOUNT Function
Syn t a x $filename.layercount()
Ret u rn This function returns the number of layers, if the file named by the filename
part is a raster image, or 0 otherwise.
164
Framepart Functions
Arg u me n t s None
Des c ri p t i o n The layercount function supplies the number of layers in a raster image.
OBSOLETE in 8.3.
LONGNAME Function
Syn t a x $filename.LongName()
Ret u rn A "long" descriptive name of the kind of file currently named by the filename
part is returned. The return values depend upon the FileFilter DLL involved.
Some example values are "JFIF", "Arc Coverage", or "Terramodel Layer". If no
DLL is involved, the name will be descriptive as possible. If no filetypedef is
specified at all, the values could be "input", "output", "unknown" , or "default".
Arg u me n t s None
Des c ri p t i o n The longname part function is used to describe the type of file named by the
filename part.
Exa m p l e In this example the filename part input has the value "$IMAGINE_HOME/
examples/lanier.img"
on mousedown {
echo "The long name for type is " $input.LongName();
}
The long name for type is IMAGINE Image
LRX Function
Syn t a x $filename.lrx()
Ret u rn This function returns the X position, in map coordinates, of the lower right
corner of the file named by the filename part, provided that location is known.
Arg u me n t s None
Des c ri p t i o n The lrx part function supplies the lower right X coordinate of the bounding box
of an image. This is not always known. It is recommended you use the
boundariesknown or flag part function to determine if a useful value is
available.
LRY Function
Syn t a x $filename.lry()
Ret u rn This function returns the Y position, in map coordinates, of the lower right
corner of the file named by the filename part, provided that location is known.
165
Framepart Functions
Arg u me n t s None
Des c ri p t i o n The lry part function supplies the lower right Y coordinate of the bounding box
of an image. This is not always known. It is recommended you use the
boundariesknown or flag part function to determine if a useful value is
available.
NBANDS Function
Syn t a x $filename.nBands()
Ret u rn This function returns the number of layers, if the file named by the filename
part is a raster image, or 0 otherwise.
Arg u me n t s None
Des c ri p t i o n The nbands function supplies the number of layers in a raster image.
QUERYFORFILENAME Function
Syn t a x $filename.QueryForFilename( [ template ] )
Ret u rn This function returns a Boolean value which is1 the user selects a new file
name, or 0 if the user cancels out of the File Chooser.
Arg u me n t s The template argument, which is optional, can be used to specify the default
type that the File Chooser will be looking for. The user may switch among the
types allowed by the filename part. Refer to the cleartypedefs and
addtypedef part functions if you wish to change the set of types allowed by
the File Chooser.
Des c ri p t i o n The queryforfilename part function launches the File Chooser, which allows
the user select a file that matches any of the types allowed by the given
filename. This function is typically used for an "off-screen" filename that is
never displayed to the user. In this way, the user only sees the File Chooser
when it is launched at times determined by the EML script. If the filename part
is "on-screen", then the user typically chooses when to launch the File
Chooser by pressing on the chooser button in the text entry area.
RASTERLAYERLIST Function
Syn t a x $filename.RasterLayerList()
Ret u rn This function returns a list of the layers, in the raster file named by the filename
part. An empty list is returned if the file is not a raster image.
Arg u me n t s None
166
Framepart Functions
Des c ri p t i o n The rasterlayerlist function supplies the names of the layers in a raster
image.
TEMPLATEGET Function
Syn t a x $filename.TemplateGet( )
Ret u rn The template (a wildcard) of the filetype currently selected in the file chooser.
Some example values are "*.img", "*.arcinfo", or "*.map".
Arg u me n t s None
Des c ri p t i o n The templateget part function returns the wildcard that the filename currently
uses to scan directories. This may be a real wildcard, such as "*.jpg", or a
pseudo-wildcard such as "*.grid" which yields all GRID coverages, regardless
of the coverage name. This function is not symmetrical to the templateset
part function. It returns the currently selected wildcard, which is not
necessarily the value "remembered" by templateset.
TEMPLATESET Function
Syn t a x $filename.TemplateSet( template )
Ret u rn None
Arg u me n t s The template to be allowed (and remembered) by the file chooser. This should
be a wildcard such as "*.doq".
Des c ri p t i o n The templateset part function changes the current template of the filename
part (thereby causing a rescan). In addition, this template is remembered, and
enforced by output choosers (those that have specified the newfile attribute).
Even if the user changes the wildcard, the filenamepart will warn the user if
they try to specify an output filename that does not conform to this template.
This function essentially allows the user to override the template specified by
the select attribute. It is superceded by filterspecs, which are a better way to
control the filename filtering. To use filterspecs, use the filetypedef
attribute(s), which can be changed dynamically using the cleartypedefs and
the addtypedef part functions. templateset is needed for occasions when it
is not convenient to specify a filterspec
If you just need to change the template to rescan the directory, you can assign
the value of the filename to the template.
167
Framepart Functions
ULX Function
Syn t a x $filename.ulx()
Ret u rn This function returns the X position, in map coordinates, of the upper left
corner of the file named by the filename part, provided that location is known.
Arg u me n t s None
Des c ri p t i o n The ulx part function supplies the upper left X coordinate of the bounding box
of an image. This is not always known. It is recommended you use the
boundariesknown or flag part function to determine if a useful value is
available.
ULY Function
Syn t a x $filename.uly()
Ret u rn This function returns the Y position, in map coordinates, of the upper left
corner of the file named by the filename part, provided that location is known.
Arg u me n t s None
Des c ri p t i o n The uly part function supplies the upper left Y coordinate of the bounding box
of an image. This is not always known. It is recommended you use the
boundariesknown or flag part function to determine if a useful value is
available.
WIDTH Function
Syn t a x $filename.Width()
Ret u rn This function returns the width of the image as the number of columns, if the
filename is a raster image, or 0 otherwise.
Arg u me n t s None
Des c ri p t i o n The width part function supplies the width of a raster image.
GETLISTINDEX Function
Syn t a x $<listpartname>.GetListIndex()
168
Framepart Functions
Ret u rn This function returns the numeric index of the currently select item in the
scrolllist or the popuplist. The index starts at zero for the first item. If no item
is selected, -1 is returned.
Arg u me n t s None
Des c ri p t i o n The getlistindex part function can be used to find the numeric index of the
item currently selected in a scrolllist or popuplist
SETNAMEANDTITLELIST Function
Syn t a x $<listpartname>.SetNameAndTitleList( namelist, titlelist )
Ret u rn None
Arg u me n t s The namelist contains the actual possible values for the scrolllist or the
popuplist part. The titlelist is the set of names to be presented to the user.
Each list should contain the same number of items.
Des c ri p t i o n The setnameandtitlelist part function changes both the internally used
names for items and the externally displayed names for the items in the
scrolllist or the popup list. The setnamelist and settitlelist part functions can
be used to set these lists independently.
SETNAMELIST Function
Syn t a x $<listpartname>.SetNameList( namelist )
Ret u rn None
Arg u me n t s The list of possible values for the scrolllist or the popuplist part. This list is only
displayed to the user if there is no titlelist for the part. Otherwise, the values in
the titlelist are displayed to the user.
Des c ri p t i o n The setnamelist part function changes the internally used names for items in
thescrolllist or the popup list. The setnameandtitlelist part function can be
used to simultaneously set both this list and the list of titles.
SETTITLELIST Function
Syn t a x $<listpartname>.SetTitleList( titlelist )
Ret u rn None
Arg u me n t s The list of strings to be displayed in the scrolllist or the popuplist. This is the
list actually displayed to the user, although the name list contains the possible
values of the scrolllist part or the popuplist part.
169
Framepart Functions
Des c ri p t i o n The settitlelist part function changes the externally displayed items in the
scrolllist or the popup list. The setnameandtitlelist part function can be used
to simultaneously set both this list and the list of internally used names.
170
EML User Interface Standards
♦ Consistency in User Interface — These standards are to be used to provide a consistent look
and feel across all IMAGINE applications.
♦ On-Line Help — On-line help is generated and distributed based on the content of EML files.
This document contains the following sections:
General Guidelines for EML Scripts
Info Strings
Toolbars
Help Button
Batch Button
Components and Frames
File Naming
Document Frames
Modal Dialogs
Modeless Dialogs
Tool Palettes
Menu Dialogs
Standard Buttons
Icon Formats
171
EML User Interface Standards
♦ Use relative positioning for frameparts whenever possible. This ensures compatibility with
future changes to EML, the C Programmers’ Toolkit, and supported windowing systems.
♦ Never use spaces in LABEL part values to line up things. Use the AT attribute for absolute
positioning only when you are unable to use relative positioning.
♦ Be consistent when giving the part attribute SIZE. Ensure that none of the parts in that dialog
is larger than the frame itself. Mistakes like this produce unpredictable results.
Ellipsis
Ellipses (...) are used in menu options and on buttons whenever that option leads to another
dialog box.
Colons
Colons are used in titles that refer to another nearby element in the dialog box. For example, an
edit text field title describes the edit text field that is near the title, and therefore, it should have a
colon. Group titles always contain a colon. If the framepart presents information (e.g., number of
bands in a file) then the title should contain a colon.
Buttons never use colons since the title is within the button itself.
Use of Labels
A label can be used to add descriptive text, but it should not be used as the title of a frame or a
framepart. Use the title attribute instead.
This rule is especially important for EMLs from which On-Line Help will be generated. A label is
treated as a framepart, and a separate entry is created for a label in the On-Line Help. If that label
actually refers to a framepart, then there are two entries in On-Line Help for that framepart,
instead of one.
172
EML User Interface Standards
Info Strings
Every part should contain the “info” attribute. This keyword is followed by a descriptive string
which is displayed in the statusbar area of the parent frame. For example:
button cancel {
title “Cancel”;
size 6,1.5;
info “Cancels the current operation and exits this frame.”;
on mousedown undisplay framename;
}
Toolbars
Toolbars are used in Document Frames to provide access to often used functions. A toolbar is
created with the following syntax:
toolbar {
button b1 {
icon “open.icon”;
info “Open a New Document”;
on mousedown open();
}
:
:
}
A toolbar may contain icons, buttons, checkboxes, radiobuttons, single line edittexts, and
textnumbers.
Help Button
All dialog boxes need to have a Help button with the exception of instruction boxes or simple
question dialogs like “Do you want to exit?”. In the macro, the description would be similar to this
example:
button helpbutton {
title “Help”;
size 6,1.5;
at 10, 5;
info “Gives help for this dialog”;
on mousedown showhelp;
}
Batch Button
All frames that launch a job should have a Batch button. Here’s an example:
173
EML User Interface Standards
button batchbutton {
title “Batch”;
size 6,1.5;
at 10,5;
on mousedown {
startbatchsingle;
batchjobname “batchjobname”; /*default job name*/
send mousedown to ok;
}
}
The Batch button eliminates the need to turn batch mode on, send a command to the batch
queue, and then turn batch mode off. In the example, the OK button is assumed to send the
command with all of the parameters specified in the dialog to the executable program. The Batch
button turns on batch mode, does a remote button press of the OK button and then turns batch
mode off.
♦ For every component there is a subdirectory of On-Line Help files. Context-sensitive On-Line
Help uses the component name and frame name to find the subdirectory and file of On-Line
Help, respectively.
♦ For On-Line Help generation and distribution, components are identified from the names of
EML files in $IMAGINE_HOME/scripts. These eml files are parsed, and a list of the
components and frames is generated for use in On-Line Help generation. That is why
$IMAGINE_HOME/scripts should never be used for test files.
For these reasons, components must be created with care. They should be well-thought-out
parts of the overall software package.
File Naming
Each EML file should have the .eml extension and, if it defines a component, it must be named
after the component. For example, the EML file that contains the definition:
component mapcomposertools {
...
}
174
EML User Interface Standards
On-Line Help subdirectories are named after components and files are named after frames.
Therefore, every component name and frame name should follow the system rules for directory
and file names.
Document Frames
Document frames have the following characteristics.
♦ There is always a menu bar. The menu bar must have the File and Help menus. The File
menu must have Close as the last (or next to the last) item.
♦ There is always a tool bar which contains icons to invoke frequently used operations.
♦ Scroll bars are present in most document windows, though they are not necessary.
♦ There is always a status bar which is used to display status messages and framepart
descriptive information.
♦ Document Frames are typically resizeable. There are some cases where this is not
necessary as in imageinfo.
175
EML User Interface Standards
Modal Dialogs
A Modal Dialog has the following characteristics.
♦ It is used to display/query information in a serial fashion. Its use precludes the use of any
other dialog in the application until it is dismissed.
The size of the buttons should be 6 wide and 1.5 high. If the text is long, then the button width
may be increased to handle it. If the number of buttons exceeds the width of the frame by a
small amount, then the width of all the buttons may be reduced evenly so that all of the
buttons fit along the bottom of the dialog.
Modeless Dialogs
Modeless dialogs must conform to all of the rules for a modal dialog with the following
exceptions:
♦ A modeless dialog does NOT preclude interaction with the rest of the application.
♦ A modeless dialog has a Close button instead of a Cancel button. When the Close button is
pressed, the modeless dialog is removed from the screen without initiating an action.
♦ A modeless dialog typically has one or more action buttons along the bottom of the dialog. If
there is only one then it should be called Apply. If there are more, then they should be named
in accordance with their function.
176
EML User Interface Standards
Tool Palettes
A tool palette has the following features:
♦ There is a Keep Tool check box which controls the behavior of the tool palette. When the
palette is locked (the Keep Tool button is depressed). Then the selected tool can be used
repeatedly without reselection. When the button is not depressed then the tool palette reverts
to the Select position when the tool is used.
♦ The Help button is labeled with a ? (question mark) icon to maintain visual consistency in a
tool palette.
♦ The very bottom of the tool palette has a Close button which dismisses the palette.
Menu Dialogs
♦ The option buttons should all be 14 units wide and 1.5 units high. Each name should end with
an ellipsis (...) since that button displays another dialog.
♦ There should be a Close and a Help button at the bottom of the dialog.
Standard Buttons
Every dialog should have three standard buttons. The use of the standard buttons OK, Cancel,
Apply, Close and Help depends upon whether a frame is modal or modeless as described
above.
These buttons should be positioned at the bottom of a dialog box, as explained below — it is all
right to have other buttons between them. They should be consistently used as follows:
♦ OK (note the spelling: uppercase O, uppercase K) — Act upon the information entered in the
dialog and close it. This should be the leftmost button in the bottom of a modal dialog.
♦ Cancel — Close the dialog but do NOT act upon the information entered in the dialog. The
user has brought up the wrong dialog or has entered information on which he/she does not
want to act. This should be the button immediately to the left of the Help button in a modal
dialog.
177
EML User Interface Standards
♦ Apply — Apply the changes as specified, but keep the dialog box open. This should be the
leftmost button on the bottom of a modeless dialog.
♦ Close — Close the dialog but do NOT act upon the information entered in the dialog. This
should be the button immediately to the left of the Help button in a modeless dialog.
♦ Help — Connect to the On-Line Help server and display the help file associated with the
dialog. This should be the rightmost button in every dialog.
An OK button should always undisplay the frame before other processing is done. This is
expected, and it tells the user that the program is not hung up.
When you have a dialog that requires picking a file before selecting OK, disable the OK button
on framedisplay and then enable it when a file is chosen.
Push Pins
If a frame includes a part named “dismiss,” then a push pin appears on the window banner (if the
application is run under the OpenLook window manager).
178
EML User Interface Standards
Button
A button is used to initiate an action. A button may be a rectangle with a title centered in it or an
icon. Both forms function the same. The standard height for a regular button is 1.5 character
spaces. Width may be adjusted for string length and appearance.
Checkbox
The checkbox provides a toggle mechanism for on/off, yes/no, true/false types of responses.
Avoid using a horizontal layout for checkboxes. The title should not have any punctuation (except
as explained under Preference Manager). The title wording should be expressed as an action,
such as Clear Display.
Edittext
The edittext is used to provide a simple text input field. It can also provide the capabilities of a
multi-line text editor.
By default, it is a read/write field, but it can be set to read-only for informational text by giving it
the read-only attribute. However, it is preferable to display read-only text with a label instead of
an edittext, since the label does not display a box that might lead the user into thinking it is
writable.
The standard height for this part is 1.5 character spaces. Horizontal sizing is difficult with this part
as the actual output size is about one-half that of buttons or textnumbers, so be prepared for
some trial and error.
Example
edittext text_box {
title “Text Area”;
size 10,1.5;
relative position;
value “Enter text here...”;
}
Filename
The filename framepart provides a tool for interactively selecting a file. The script can control
which file names are displayed via the select command. The default path in the eml preference
database (default_data_path) should be used in the select command. It should show at least
four files at a time, preferably more.
179
EML User Interface Standards
Dialog boxes that are used frequently should have taller filename boxes than seldom-used ones.
Using Adobe-Helvetica-Bold, this part should not be sized larger than 15 units wide since most
file names are not that long. You want to avoid wasted space in this part.
Example
filename filepart {
title “Input file:”;
size 15, 15;
relative position;
/*
** Select all the files with .img extension in the
** default data path.
*/
select getpref (“eml” “default_data_path)+”*.img”;
}
Label
The label framepart is used to display information in a frame. If a label needs a title and then
information, please do not use two labels, but instead give the label a title with the title attribute.
This is much easier when generating On-Line Help, because the title shows up as one framepart
instead of two. For example
Layer Name: Layer_1
This label is defined as one framepart, with Layer Name: as the title of the label, and a variable
containing the layer name as the text.
Meternumber
Menus
Menus can call other menus when the subgrouping makes sense. Menus should never go more
than three levels deep. Menu items should be arranged from the most-used item at the top to the
least-used items at the bottom unless there is a special ordering suggested by the application
(e.g., rectification steps should be sequential.)
180
EML User Interface Standards
Popuplist
The popup list provides a means of selecting one value from a list of several fixed choices. The
minimum width for a popuplist is automatically determined by the length of the longest choice
name. Popup lists are used when the number of choices is relatively small and static.
Radiobutton
The radiobutton provides a means of selecting one value from a set of several fixed choices.
Almost always, the radiobutton is enclosed in a group and a title is given for the group as well as
for each button. The title should be centered above the group. Avoid using a horizontal layout for
radiobuttons.
Scrollist
The scrollist provides a means of selecting a single value from a long list of choices. Like the
filename, the scrollist should show at least four options and preferably more. This part is usually
controlled by an application program that can dynamically change the choices. If the number of
choices is small and static, use a popuplist instead.
Textnumber
The textnumber provides a means of entering or displaying a numeric value. Keep textnumber
fields as short as is practical. The standard height is 1.5 character spaces and a typical width is
5. Minimum and maximum values should be set depending upon the real values they are
reflecting. Titles for these parts use the left attribute with the center modifier and almost always
end with a colon.
When aligning one under the other, the active Upper Left for the part is at the Upper Left of the
box, not at the title, because you generally want the left sides of the boxes to line up; not the titles.
Use the below attribute when possible.
Icons
All IMAGINE icons are distributed in <IMAGINE_HOME>/icons, and may be viewed and/or
edited with an icon editor supplied with the operating system. The IMAGINE interface uses three
different kinds of icons:
♦ Application Icons
♦ Tool Icons
♦ Cursor Icons
181
EML User Interface Standards
Application Icons
Application icons are displayed on the main menu icon panel. The size of these (64 x 48) is based
on the aspect ratio of the screen such that they fit in either the vertical or horizontal main menu
orientation. These should have descriptive text at the bottom using gill sans font, medium weight,
regular style and either a size of 120 or 140. The bottom of the text (not descenders) should start
at the fourth pixel from the bottom. These icons are large enough to allow shading for a 3D effect.
These are 16 x 16 (or 32 x 32 for large format) and contain no descriptive text.
Cursor Icons
These are 16 x 16 and also do not contain descriptive text. They are accompanied by a mask file
with the same name as the cursor icon plus an underscore and the word “mask.” For example,
the icon linkviewers.icon should have the accompanying mask file called linkviewers_mask.icon.
The mask file can be considered as what you would see with the original icon against a reversed
background.
For cursor icons and their masks you must also place a hotspot which is the active area for the
cursor. Iconedit does not have a means for placing a hotspot so you must use bitmap to do this.
Here are some guide lines for placing hotspots into cursor icons:
♦ Hotspots for cross-hairs should be at the spot where the lines intersect.
♦ In general, the location of the hotspot should be easy to locate and obvious.
Icon Formats
Icons can be created using xbitmap or iconedit on the Sun. When using iconedit they may be
saved as X Bitmap or as Color X Pixmap. When saved as a Color X Pixmap, iconedit uses the
XPM format.
When creating color icons the use of colors should be limited. For most tool icons the colors
should be white, black, and grey. When creating a color icon use two shades of gray, a light one
and a slightly darker one. The lighter shade should be used for the background regions of the
icon. This value is replaced by the background color of the button. To insure that this lighter grey
color is recognizable it must be used to color the upper leftmost pixel in the icon. That is IMAGINE
interprets the color of the upperleft most pixel as the background color.
182
Introduction to EML Architecture
Parser
Interpreter
GUI Manager
Message Manager
Preference Manager
Session Manager
183
Parser
Parser
The Parser reads EML script files and converts them into an internal form which represents the
user interface and the associated procedures. The EML files can be used to define dialogs and
to define scripts which control operations. The dialog definitions are handled by the GUI Manager
and the procedures are handled by the Interpreter.
The complete syntax of the EML script language is given in EML Syntax Reference. When a
script is parsed, all of the GUI elements are converted into a tree structured representation in
memory. The GUI manager uses these internal representations to generate the user interface.
Each of the procedures is pre-compiled into an internal pseudocode form which can be quickly
evaluated by the Interpreter. This approach gives a system whose performance is somewhere
between that of a pure interpreter and a pure compiler.
If a syntax error is detected, the parser generates an error message which indicates the script
file name, the line, and the column number where the error was located. It is the responsibility of
each application to display this error.
When the parser is opening a script file it looks in the list of directories specified by the
environment variable ERDAS_SCRIPT_PATH. This specifies a colon-separated list of directory
names which are searched for the named file. The default search path is:
for UNIX:
.:$HOME/.imagine820:$IMAGINE_HOME/scripts/$ARCH:$IMAGINE_HOME/scripts
for NT:
<HOMEDRIVE>:\<HOMEDIRECTORY>\.imagine820
<IMAGINE_HOME>\scripts\<ARCHITECTURE>
<IMAGINE_HOME>\scripts
184
Parser
Application
Component2
Component1
Frame1
Frame1
= procedure
= framepart
185
GUI Manager
GUI Manager
The GUI Manager controls the creation and display of dialogs and the interpretation of user input.
It is responsible for transparently adapting the EML dialogs to different systems such as Motif or
Windows NT. Once the Parser has generated the in-memory representation (tree structure),
the GUI manager can be called on to display any of the frames from any of the components.
When a frame is displayed, each of the frameparts is first created and positioned within the
frame. If a part does not have a position attribute then it is placed to the right of the last framepart
created. If the frame itself has a size, then the automatically positioned parts automatically wrap
around. If the frame does not have a specified size, then it takes on the size of the smallest
bounding box which contains all of the child frameparts.
Each of the user’s input actions are monitored and are translated into the various framepart
behaviors which are described in EML Syntax Reference.
186
Interpreter
Interpreter
The interpreter handles the interpretation and execution of the pseudocode contained in the
procedures. Most of the functions and commands in a procedure are built-in commands and
functions which are handled by the interpreter. However, some commands and functions are
provided by the application itself.
Each application can provide its own set of functions to extend the capability of EML. The
functions can take any number of arguments and return values just like the built-in functions.
Creating an application function is done using the C Toolkit.
An application function is only valid in a script which is used within the application that defines
the function. This means that a Viewer application function cannot be used in a script which is
read by some other application.
Application Commands
Commands which are not built-in commands are passed to the Session Manager. If the
application for which the command is intended is not running then Session Manager attempts to
start it. If the application cannot be found then an error message is displayed.
Each framepart in EML also maintains a dependency list of other frameparts whose value
depend on it. The value attribute defines the dependency implicitly with the expression that is
given. Any time a framepart is referenced in a value expression, the dependency list of that part
is checked to ensure that it contains the name of the referring part (the dependant part). When
a part with a dependant is updated the dependant is also updated. This allows a spreadsheet
like automatic recalculation to be setup.
Variables
Variables may have zero or more values. If a variable has no value it is said to be empty (which
can be tested using the function IsEmpty()). Variables which are not empty are either string or
number variables (which may be determined with the functions IsString() or IsNumber()). Each
variable may actually have multiple values. The individual components may be accessed like an
array ($name[index]).
187
Interpreter
For example a variable called WorkSpace may be defined to hold the name of the directory in
which processing is to be done. This could be defined and set with the statements:
variable WorkSpace;
set WorkSpace = “/usr/data/workarea”;
A variable may be defined across all EML applications (a global variable) or it may exist only in
smaller localized context (a local variable). The extent of a variable’s existence is called its
scope.
Global Variables
A global variable is available throughout the system and there may be only one global variable
with a given name. The value of global variables are available across processes.
Local Variables
Local variables are defined in components, frames, or message handlers and their values are
visible only within those contexts.
188
Message Manager
Message Manager
EML relies heavily on the use of messages. When the user clicks on a button or selects an item,
a message is generated and sent to the framepart to indicate what event has occurred. When a
script is parsed the “startup” message is sent to the script so that it can perform any necessary
initializations.
Messages can originate from several places. The most common is from the GUI Manager which
sends events in response to user actions. The second source of events is from within
procedures.
Message Handlers
Messages are received and handled by frameparts, frames, and components. The on attribute
is used to define a message handler. Every part may have one or more message handlers
associated with it. The message handler specifies a procedure which is to be executed when a
particular message is received. There are standard messages which are created and delivered
by the system in response to user input and other actions, these are detailed in Event
Messages.
Message Passing
Message delivery proceeds in a bottom to top fashion. If a framepart does not have a message
handler for a given message, then the message is sent to the parent of the framepart, which is
typically a frame. If the frame does not have a handler for the message, then the message is sent
to the component. If the component does not have a handler, then the message is discarded
unless there is a receiver registered for the message.
A receiver is some framepart in the system which has declared that it wishes to receive all
undelivered messages of a certain type. A framepart is made a receiver via the receive attribute.
189
Message Manager
Component
Receiver framepart
Frame
Event Messages
User input events generate messages which are delivered by the system. An event message is
always delivered to some target, typically a frame or a framepart. If the target knows how to deal
with the event, it does; otherwise, the event is sent to the parent of the target. If an event is not
accepted, then EML checks to see if there are any registered recipients for the event. If there
are, the event is delivered to that target; otherwise, the event is simply ignored.
The following table defines all of the Event Messages that are automatically sent by the Message
Manager system:
Message Description
mousedown This message is delivered when a user presses and
releases the mouse on a part. This is typically generated
for a button.
190
Message Manager
Message Description
valuechanged This message is delivered when an EML part value is
being changed by an application program, the user, or
EML script.
filenamechoosen Sent only to the filename framepart when a valid file name
is entered by an application program, the user, or EML
script.
Procedure Messages
Messages can also be generated by scripts. In a script, a function call has the form:
name(arg, arg,...)
If the name is not that of a built-in function or an application function then the message “name”
is delivered to the source of the script as a message. A message can also be sent explicitly with
the send command to a named framepart . By placing a message handler at the component level
one can use the message delivery mechanism to implement user defined functions in EML.
191
Session Manager
Session Manager
The Session Manager manages all of the processes in the IMAGINE System. It starts, stops, and
communicates with all of the processes. All processes are started by Session Manager and they
send/receive commands to/from Session Manager and from others via Session Manager’s
communication mechanisms. The Session Manager is also responsible for keeping global
variables and preferences up to date throughout the system.
Starting Processes
Processes are started in one of four ways described below.
Application Command
If an application command (such as viewer) is issued and the corresponding application is not
running, then the Session Manager starts the application and sends the command arguments to
it. This mechanism starts only one copy of any given application. This is used for applications
such as the Viewer which create and maintain multiple document windows and which support a
set of application commands.
SPAWN Command
If an application is started with the spawn command the session manager starts it with the given
command line arguments. It does not check to see if there is only one copy running, so this
mechanism can be used to run multiple copies of applications which do not support multiple
document windows. The spawn command operates on any executable file.
JOB Command
If an application is started with the job command the Session Manager starts it with the given
command line arguments. It also displays a Job Status dialog which indicates the progress of the
application. The Job Status dialog also provides a Cancel button which can be used to stop the
application. This mechanism is used to start applications which have no user interface such as
the Spatial Modeler Language.
SYSTEM Command
If an application is started with the system command, the Session Manager pauses until the
application completes. This should only be used to run system commands which completes very
quickly.
192
Session Manager
♦ Verbose
♦ Terse
Verbose messages are mostly informational, they indicate the status of the application (for
example: the Viewer application sends a message Displaying layer... every time a layer is
displayed on the Viewer). This type of message can be suppressed by changing the user eml
preference Log Message Level to terse.
Terse messages always appear in the Session Log since they need to be noticed by the user.
For example, if a file is modified, the application sends a message File xxx is being modified
to the Session Log.
Terse messages are generally suitable for most situations. For troubleshooting and debugging,
however, verbose messages can prove to be more useful.
The Session Log is actually written to a file specified in the user eml preference Log Path.
Depending on the user eml preference set for Session Log Printing, the IMAGINE software
may print the Session Log when it terminates.
Messages can also be logged manually by the user into the Session Log by using the Log
Message dialog accessed under Session/Enter Log Message in the IMAGINE icon panel.
193
Session Manager
The batch processor is turned on by the Start Batch Mode option under Session on the
IMAGINE icon panel. While the batch processor on, all the jobs run by the IMAGINE System are
entered into a batch queue. When the batch processor is turned off, the batch processor prompts
the user to provide a name for the jobs, and when to run the job (date/time), etc. The batch
processor is turned off by the Stop Batch Mode option.
There is also a option under Session called View Batch Job List which enables the user to
view/edit/delete/resubmit the currently queued jobs.
194
Preference Manager
Preference Manager
The Preference Manager maintains the database of preferences which allow the user to
customize the system.
The IMAGINE System has a built-in preference manager that manages user preferences and
provides access to the preferences for the EML system and IMAGINE Application software.
Each category in IMAGINE has a preference database file associated with it that contains the
default preferences. The preference database files have an extension .pdf and they are located
in the <$IMAGINE_HOME>/defaults directory.
At system startup, these database files are read by the preference manager, the defaults in these
files are first overridden by the global preferences defaults in the $IMAGINE_HOME/defaults/
v8preference file and finally with the user preferences in $HOME/.imaginexxx/v8preference file.
(xxx here is the version number, for example, 810 for Ver. 8.1 release).
Preference Editor
Preference Manager also provides a Preference Editor which allows you to change/save
preference defaults at Global (System) level or Local (User) level. This editor is invoked by the
menu option Session/Preference Editor in the IMAGINE icon panel.
All preference types, except numeric, require string arguments (enclosed in double quotes).
195
Preference Manager
A semicolon delimits the end of each entry in the preference database file. If no keyword is given,
defaultvalue is assumed to be of string type.
Example
default_data_path(“Default Data Directory”): “$IMAGINE_HOME/
examples”
“Default data path for images”
Titles should be succinct and free of punctuation (underscores are permitted). Capitalize each
key word.
Info strings should also be brief; especially those associated with popuplists. For popuplists
make sure that the initial info string is short since the info string for each option is appended to
it. For checkboxes, always phrase the info string as a question. Capitalize the beginning of each
info string and keep the rest lowercase. Info strings should form complete sentences and be
properly punctuated.
The keyword maxlength is used to limit the length of a string to a specified number of characters.
Syntax
preferencename(“title”):“defaultstring”
“infostring”
maxlength value;
Example
log_message_format(“Log Message time format”): “dd/mm/yy hh:mm:ss”
“Date/time format for logmessage prefix”
maxlength 17;
The logical preference type is declared with the boolean keyword. It accepts only one of three
pairs of options: “yes” “no”, “true” “false”, or “on” “off”.
Syntax
preferencename(“title”):“defaultstring”
“infostring”
boolean “affirmed” “denied”;
196
Preference Manager
Example
cellarray_use3d(“CellArray 3D Appearance”): “yes”
“Should Titles and Row Numbers Have a 3D Appearance”
boolean “yes” “no”;
The enumerated preference type is declared with the enums keyword. It allows any number of
options. Each option consists of a pair of quoted strings. The first string is the value of the part;
the second string is the info string.
Syntax
preferencename(“title”):“defaultstring”
“infostring”
enums {
“value” “infostring”
:
“value” “infostring”
};
Example
log_print_type(“Session Log Printing”): “query”
“Print Session Log on exit?”
enums {
“always” “Always print”
“query” “Ask the user whether to print or not”
“never” “Never print”
};
The keywords min and max are used to indicate that defaultvalue is a number and not a string.
One or both of these keywords are used to limit one or both extremes of the range of numeric
values that defaultvalue may assume.
Syntax
preferencename(“title”):defaultvalue
“infostring”
min value
max value;
197
Preference Manager
Example
default_dblclk_interval(“Double Click Interval”): 300
“Interval in milliseconds”
min 200
max 1000;
198
On-Line Help
On-Line Help
The On-Line Help system consists of several “manuals”. Each manual is composed of several
files. All help files are distributed in the <IMAGINE_HOME>/help directory. The file types have
the following characteristics:
When IMAGINE is started, all of the context index files (.ndx) are read into a lookup table.
When the Help button is selected on a dialog, the component name and the frame name of the
requesting dialog are passed to IMAGINE. These strings are catenated and looked up in the
context index to locate the help file (.hlp) that contains the description of that dialog.
The contents files (.cnt) are like Tables of Contents. They contain all of the topics in a help file.
When you select the Contents button on the help viewer toolbar, this file is opened. Select the
topic of interest and click the Display button to view it.
The word index files (.fts) are used by the Find button on the help viewer. They provide the links
from a word or phrase into the documents that contain them. The Find dialog provides several
options for using the specified words in the search.
199
Introduction to C Toolkit Interface to EML
EML is not unlike any other window environment such as Motif or MS-Windows. In fact EML is
built on top of those window systems so one can even mix EML with the native window system
capabilities, though this is discouraged since it prohibits portability across platforms.
What would be the reasons for accessing EML through the Toolkit? Your application needs to do
more than can be done with the commands and functions described in the section on syntax.
Your application needs access to EML Toolkit objects such as the CellArray, the ColorWheel, or
the Canvas. Your application needs access to data structures not available at the EML script
level. If your application meets any of these needs then you should consider using the C Toolkit.
The overall structure of an EML application is very straightforward. The GUI elements are
created, callbacks are added, and then the main event loop is entered. The GUI elements are
defined in the EML Script and are created by Parser.
Files
200
Files
Files
There are a number of header files within EML. They are all of the form eeml?*.h. The most
commonly used ones are listed below.:
201
Reading the EML Script
In this example, the EML script “table.eml” is parsed and a single pointer to the result is returned.
eml_ParseVa has been called with two options, the appfuncs and the appdata. The appfuncs is
a translation table which is used to extend the set of functions known to EML and appdata which
provides the application functions with user specific data.
202
Reading the EML Script
Estr_StringList *
Eeml_ApplicationFunction __((
Eeml_Menu menu,/* Unused */
Emsc_Opaque *context,/* Function Context */
long argc,/* Argument Count */
char **argv,/* Argument List */
Eerr_ErrorReport **err));
When the application function is called, each of the arguments is converted to a string and
passed in via the argv. The number of arguments is contained in argc. Additionally the context
argument is a pointer to user defined data which is defined as the appdata in the eeml_ParseVa
call or with the eeml_FrameContextSet() function.
Application Contexts
An application context is a pointer to some user defined data. Each Frame in EML has a context
associated with it. The initial value of the application context for all frames in a given component
can be set as shown above in the call to eeml_ParseVa. The application context can also be set
individually for different frames. When a procedure is executed by the interpreter, the context of
the containing frame is passed down to any application functions. This allows a connection
between the top of an application and all of its application functions without resorting to global
variables.
The function eeml_FindPart is used to locate a given frame or even a given framepart within an
Eeml_ParseResult. Most of the EML API functions expect a part as an argument. The following
is an example of finding a part in a result:
Eui_BasePart *frame;
frame = eeml_FindPart(result,"tableframe",&err);
203
Reading the EML Script
For an application such as the Viewer, ImageInfo or any other which creates and maintains
multiple document windows, it is necessary to use a frame as template which is duplicated for
each new instance of the document window. This is done by using the original frame as template
and then duplicating it as needed using the eeml_PartDup function. The following is an example:
Typically the new frame is going to be associated with some new data so the
eeml_FrameContextSet function is used to create this association. This provides an environment
which allows the creation of any number of document frames, each of which tracks its own data.
eeml_FrameContextSet(newframe, newdata);
When the frame is dismissed, the clean-up code for the frame should free the context.
Adding Callbacks
Each part may have a list of callback functions associated with it. A callback function is a function
which is called by EML when a given message is delivered to a part. For example, the application
may have a given function called when the mouse is pressed, that is, when the “mousedown”
message has been received. This association is done using the eeml_AddCallback function. The
following is an example of adding a callback function to a button.
ok = eeml_FindPart(result,"tableframe:ok",&err);
eeml_AddCallback( ok, okCB, (Emsc_Opaque *) ca,"mousedown", &err
);
The part “ok” from frame “tableframe” is located and the function okCB is associated with the
message “mousedown.” Now, whenever the user clicks on the OK button, the okCB function is
called. In addition, the data pointed to by ca is passed to the callback function. The callback
function must have the following prototype:
int
callbackfunc(
Eui_BasePart *part,
Emsc_Opaque *data
)
204
Reading the EML Script
Where *part is a pointer to the part from which the function was called; and *data is the user
supplied pointer which can be used to pass data into the function. The function must return either
0 or 1. EML allows multiple callbacks to be assigned to each part for any message. When a
message is delivered to a part, EML invokes each of the message handlers. By returning a value
of 1 it terminates the loop which calls the next function.
Custom Parts
Two EML capabilities are available as custom parts. These are the CellArray and the
ColorWheel. There is no syntax in EML which allows these items to be declared. Instead the EML
script must contain a “generic” part definition which is located and converted to one of the custom
parts in the application program.
Each part in EML is based on the Eui_BasePart which contains the core information such as
size, position, color, etc. The Eui_BasePart also contains an array of pointers to functions which
give a part its specific behavior. In the case of the parts defined in EML Syntax Reference, these
function pointers are initially set by the EML Parser. For each of the custom parts, there is an
Install function that is used to set up these pointers. For example, the function
eeui_CellArrayInstall converts a generic framepart into a CellArray. The following is an
example of converting a generic into a CellArray:
/*
** Install the cellarray in the generic part and
** set the initial parameters
*/
eeui_CellArrayInstall( ca );
eeml_SetParameters( ca, &err,
"showrowcolumn", rowflag,
"rowcount", nrows,
"columncount", 2,
"rowtitle", "Row",
"nextedit", 2,
"rowselectflag", select,
"column", 0,
"columntitle", "Value",
"columnwidth", 4,
"columntype", "text",
"editflag", edit,
"selectflag", select,
"getcellvalue", getclassvalue,
"putcellvalue", putclassvalue,
205
Reading the EML Script
"cellinfo", NULL,
"column", 1,
"columntitle", "Class Name",
"columnwidth", 10,
"columntype", "text",
"editflag", edit,
"selectflag", select,
"getcellvalue", getclassname,
"putcellvalue", putclassname,
"cellinfo", NULL,
NULL );
206
The Main Event Loop
Once the primary frame is displayed, then each application should enter a while loop which
continues until the doneFlag in theRoot is set to TRUE. This doneFlag is set when the quit
command is issued, or it could be set by the user’s application code itself.
Application Commands
If the <appname> is the same as the currently running application then the command plus the
arguments are placed into a command queue for the application. Each command is then
removed from the queue and returned to the application via the eeml_GetNextCommand
function. It is up to the application to process the commands which it receives.
The description and syntax of all IMAGINE application commands are provided in the IMAGINE
Command and Function Syntax help file.
207
Getting and Setting Part Values
When a part value is changed, the message “valuechanged” is sent to the part. Any callbacks or
message handlers attached to the part are invoked at this time. In addition, every part has a
dependency list. If there are any other parts whose values depend on the updated part then
those parts are also updated.
Refer to VALUE Attribute and Linked Part Values for more information.
208
Exiting and Cleaning Up
209
EML Appendixes
EML Appendixes
This section consists of tables filled with formatting and configuration information.
Number Formatting
Number Input
Preference Database
210
Number Formatting
Number Formatting
The format string may consist of up to three semi-colon separated fields of formatting
information. If only the first field is given then it is used for all numbers. If the first and second are
given then the first is used for positive numbers and the second is used for zero and negative
numbers. If all three are given then the first is for positive numbers, the second is for negative
and the third is for zero. These are the default conditions for each field, however, each field may
specify a condition of the form [<te><value>]. Here <te> is one of <,>,=,<>,>=,<= and <value> is
any number.
#,##0; (#,##0); 0
Each field consists of a series of format characters from the following table.
Format Description
? This is the same as the 0 with the exception that it prints a space
for leading and trailing zeros.
. This indicates where the decimal point is to be included.
211
Number Formatting
Format Description
d Interpret the number as a time and extract the day. Print the day
of the month (1-31) without leading zeros.
dd Interpret the number as a time and extract the day. Print the day
of the month (01-31) with leading zeros.
ddd Interpret the number as a time and extract the day. Print the day
of the week as (Sun,Mon,Tue...).
dddd Interpret the number as a time and extract the day. Print the day
of the week as (Sunday, Monday, Tuesday...)
m Interpret the number as a time and extract the month. Print the
month as a number (1-12) without leading zeros.
mm Interpret the number as a time and extract the month. Print the
month as a number (01-12) with leading zeros.
mmm Interpret the number as a time and extract the month. Print the
month as (Jan,Feb,Mar...).
mmmm Interpret the number as a time and extract the month. Print the
month as (January, February, March, ...)
Interpret the number as a time and extract the year. Print the
yy year as a two digit number (00-99) which is the number of years
since 1900.
yyyy Interpret the number as a time and extract the year. Print the
year as a four digit number (1992).
212
Number Formatting
Format Description
Interpret the number as a time or and angle and extract the hour.
h Print the hour of the day without leading zeros as (0-23) if 24-
hour time is used, or as (1-12) if twelve hour time is used.
Interpret the number as a time or angle and extract the hour.
hh Print the hour of the day with leading zeros as (00-23) if 24-hour
time is used, or as (1-12) if twelve hour time is used.
Interpret the number as a time or angle and extract the minute.
m Print the minute as (0-59) without leading zeros. (m is interpreted
as minute instead of month if it follows h or hh.
Interpret the number as a time or angle and extract the minute.
mm Print the minute as (0-59) with leading zeros (mm is interpreted
as minute instead of month if it follows h or hh.
AM/PM Use 12-hour time and indicate the 12-hour period with AM or am
am/pm for (AM) and PM or pm for (PM).
213
Number Formatting
Format Description
[Black]
[Red]
[Green]
[Blue]
[Cyan] Indicate the color code to be used for the output text.
[Magenta]
[Yellow]
[White]
[=value] Use this field if the number is equal to the given value.
[>value] Use this field if the number is greater than the given value.
[<value] Use this field if the number is less than the given value.
[>=value] Use this field if the number is greater than or equal to the given
value.
[<=value] Use this field if the number if less than or equal to the given
value.
[<>value] Use this field if the number is not equal to the given value.
Numbers which are interpreted as times are assumed to be encoded as the number of seconds
since Jan-1-1970 12:00:00 AM GMT.
214
Number Input
Number Input
All numeric input areas in EML can accept numeric expressions as well as simple numbers.
215
Number Input
In all of the forms above that deal with units, the unit names come from the file
<IMAGINE_HOME>/etc/units.dat. This file defines a series of categories (distance, area, weight)
and within each category a variety of units are defined. For each category a default unit is defined
which has a conversion factor of 1.0.
For example the default unit in distance is the meter, all of the other distance units are given in
terms of meters. Units and categories may be added to this file. If the environment variable
ERDAS_ETC_PATH is defined then the file units.dat will be found using that path. This means
that you can put a modified units.dat in the current directory (or your “personal” directory) instead
of modifying the one in <IMAGINE_HOME>/etc.
216
Device Configuration Properties
The tables below identify the properties associated with each device within a device class. The
combination of deviceclass, devicename, and property forms the key to extract data from the
Configuration Database using the getcfg function. The Property Title is the string displayed in the
Configuration Editor dialogs.
deviceclass - cdroms
devicename - cdrom
deviceclass - hosts
devicename - host
217
Device Configuration Properties
deviceclass - tapes
devicename - tape
deviceclass - printers
devicename - calcomp
218
Device Configuration Properties
219
Device Configuration Properties
devicename - canon
220
Device Configuration Properties
devicename - hpgl
221
Device Configuration Properties
devicename - hprtl
222
Device Configuration Properties
devicename - iris
223
Device Configuration Properties
devicename - kodak
224
Device Configuration Properties
devicename - linotronic
225
Device Configuration Properties
devicename - postscript
226
Device Configuration Properties
devicename - serveware
227
Device Configuration Properties
devicename - tekinkjet
228
Device Configuration Properties
devicename - versatec
229
Preference Database
Preference Database
Many of the Preferences described in this topic are applicable to UNIX only. In all cases, the
default value shown is for UNIX systems. Under NT, the appropriate preferences and their
default values are displayed in the Preference Editor dialog.
The combination of category and preferencename forms the key to extracting data from the user
preference database using the getpref function. The tables below list the preference names and
default values for each category. The Preference title is the string that is displayed in the
Preference Editor dialogs.
category - annotation
category - catalog
230
Preference Database
category - eml
231
Preference Database
232
Preference Database
category - filepref
category - gcpeditor
category - import
233
Preference Database
category - legend
234
Preference Database
category - mapcomposer
category - memory
category - modeler
235
Preference Database
236
Preference Database
category - threeview
237
Preference Database
category - viewer
238
Preference Database
239
Cross Index
Cross Index
The following table lists all of the keywords and symbols that are recognized by the EML parser.
These keywords may not be used as names for user defined elements.
The first section is alphabetical, the second section is divided into the following categories:
Name Description
ABOVE Attribute that is used to position one part above
another. OBSOLETE in 8.2.
ADDTYPEDEF Function that adds one or more types from a
FileFilter DLL to the list of supported types. Specific
to the filename framepart.
ALIGN Attribute that controls the alignment of text within the
area defined for the label.
AT Attribute that is used to specify the position for a part.
OBSOLETE in 8.2.
ATTACH Attribute that is used to specify the way in which each
of the sides of a part attaches to either the frame or
other parts. OBSOLETE in 8.2.
AUTOEXTEND Function that adds an extension to a filename.
Specific to the filename framepart.
BACKGROUND Attribute that specifies the color to be used as the
background for the part.
BANDLIST Function that returns the list of names of the layers in
the specified file.
BATCHJOBNAME Command that is used to specify the name for the
current batch job.
BELOW Attribute that is used to position one part below
another. OBSOLETE in 8.2.
BOTTOM Function returns the bottom most coordinate of the
named frame or framepart.
240
Cross Index
241
Cross Index
242
Cross Index
IF statement.
ENABLE Command that enables a framepart.
EXIT Statement that is used to exit from a loop.
EXP Function that computes the exponentiation of a
specified number.
EXPORT Function that allows contents of selected rows and
columns to be exported to a file. Specific to the
cellarray framepart.
FILENAME Framepart that provides a tool for interactively
selecting a file.
FEXIST Function that tests to see if the file named in its
argument exists.
FEXT Function that extracts the extension portion from a
filename string.
FILETYPE Function that obtains the type of image named by the
filename part. Specific to the filename framepart.
FLAG Function that determines whether or not the named
file has map boundaries other than through
calibration. Specific to the filename framepart.
FLOOR Function that computes the mathematical floor of a
floating-point number.
FMT Function that is used to format numbers.
FNAME Function that extracts the name component of a
filename from a string.
FORM Modifier of ATTACH attribute that indicates part is
attached to the frame. OBSOLETE in 8.2.
FORMAT Attribute in a cellarray column that controls how
values in that column are displayed.
FORMAT Attribute that sets the display format to be used if the
value of the label is a number.
FORMAT Function that allows changes to the display of the
selected columns’ format. Specific to the cellarray
framepart.
FONT Attribute that is used to specify the font which will be
used for displaying text in the part.
FOREACH Statement that provides looping mechanism allowing
243
Cross Index
244
Cross Index
245
Cross Index
246
Cross Index
247
Cross Index
248
Cross Index
OR Boolean-or operator.
PART Modifier of ATTACH attribute that indicates part is
attached to another part. OBSOLETE in 8.2.
PASTE Function that allows the contents of a clipboard be
inserted into selected rows and columns Specific to
the cellarray framepart.
PICTURELIST Attribute that indicates that the scrolling list will
contain pixmaps instead of text strings.
PLAY Command to send a Sun Audio file to the audio
device.
POPUPLIST Framepart that provides a means of selecting one
value from a list of several fixed choices.
POSITION Attribute that specifies the location of a part.
OBSOLETE in 8.2.
POWER Exponentiation operator returns the result of raising
the left-hand expression to the value of the right-hand
expression.
PREFERENCEEDITOR Command that displays the Preference Editor.
QUERYFORFILENAME Function that allows selection of a file that matches
any of the types allowed by the given filename.
Specific to the filename framepart.
QUIT Command that causes the termination of the EML
interpreter.
QUOTE Function that adds double quotes (“”) around its
argument.
RADIOBUTTON Framepart that provides a means of selecting one
value from a set of several fixed choices.
RADIOGROUP A menu type which consists of one or more entries
each with a radio button displayed to the left of it.
RASTERLAYERLIST Function that supplies the names of layers in a raster
image. Specific to the filename framepart.
READONLY Attribute that indicates that the framepart is for
display purposes only.
RECEIVE Attribute that places a part on the receiver list for a
particular message.
REFLOW Command that causes the parts in a frame to be
249
Cross Index
250
Cross Index
251
Cross Index
252
Cross Index
253
Cross Index
254
Cross Index
Index by Category
Attribute Description
ABOVE Attribute that is used to position one part above
another.
ALIGN Attribute that controls the alignment of text within the
area defined for the label.
AT Attribute that is used to specify the position for a part.
ATTACH Attribute that is used to specify the way in which each
of the sides of a part attaches to either the frame or
other parts.
BACKGROUND Attribute that specifies the color to be used as the
background for the part.
BELOW Attribute that is used to position one part below
another.
CHANGEABLE Attribute that controls whether the user can change
the width of a column in a cellarray.
CHOOSERBUTTON Attribute that indicates that the button will be
attatched to a chooser.
COLORBUTTON Attribute that indicates that a button is a color button.
COLUMN Attribute that specifies the number of columns to be
used when displaying the radio button.
COLUMNALIGNMENT Attribute that controls the alignment of text within a
column in a cellarray.
COLUMNDATATYPE Attribute that controls the appearance of columndata
within a column in a cellarray.
COLUMNLINEWIDTH Attribute that controls the width of the line appearing
to the right of a column in a cellarray.
COLUMNWIDTH Attribute that controls the width of a column in a
cellarray.
EDITABLE Attribute that controls whether the value of a cell
within a column can be changed.
DELTA Attribute that sets the value by which the number is
incremented.
DIMENSION Attribute that is used to specify the size of the part.
FORMAT Attribute in a cellarray column that controls how
255
Cross Index
256
Cross Index
257
Cross Index
258
Cross Index
CLOSE Command that closes one of the two output log files.
COMLOG Command that renames the session log file.
CONFIGURATIONEDITOR Command that invokes the configuration editor.
DISABLE Command that disables a framepart so that the user
may not interact with it.
DISPLAY Command that is used to display a frame if it is not
currently displayed.
ECHO Command that prints its arguments to the session log.
ENABLE Command that enables a framepart.
HELPOUTLINE Command that creates a FrameMaker MIF macro file
which is an outline for the IMAGINE On-Line Help
system.
HIDE Command that makes a frame or a framepart
invisible.
INSERTTEXT Command that allows text to be inserted into an
edittext framepart.
JOB Command that is used to execute an application as a
job.
LOAD Command that loads an EML Macro.
LOGMESSAGE Command that places a message in the status log.
MOVE Command that repositions a frame on the screen.
PLAY Command to send a Sun Audio file to the audio
device.
PREFERENCEEDITOR Command that displays the Preference Editor.
QUIT Command that causes the termination of the EML
interpreter.
REFLOW Command that causes the parts in a frame to be
repositioned to fit within the boundaries of the frame.
REFRESHLIST Command that updates the list of files displayed in a
filename framepart.
RESIZE Command that changes the size of a frame.
SEND Command that delivers a message to a destination.
SET Command that is used to assign a value to a variable
259
Cross Index
or to a framepart.
SHOW Command that makes a frame or a framepart visible.
SHOWHELP Command that displays help from the On-Line Help
data base.
SHOWVERSION Command that displays a frame which gives the
current version of IMAGINE.
SPAWN Command that starts a separate copy of an
interactive application.
STARTBATCH Command that begins multiple job batch mode.
STARTBATCHSINGLE Command that begins single job batch mode.
STATUSLOG Command that renames the command history file.
STOPBATCH Command that terminates the batch job mode.
SYNCJOB Command that executes an application
synchronously as a job.
SYSTEM Command that indicates that the arguments following
it are system commands.
UNDISPLAY Command that removes a frame from the display.
UNLOAD Command that removes an EML macro from memory.
VIEWBATCHLIST Command that displays the Batch Editor.
Framepart Description
BUTTON Framepart whose main purpose is to initiate an
action.
CANVASPART Framepart that supplies access to onscreen graphics.
CELLARRAYPART Framepart that allows viewing and editing of large
(virtual) arrays of rows and columns.
CHECKBOX Framepart that is used to provide user input of a
boolean value.
EDITTEXT Framepart which can be used to implement a single
or multi-line text input field.
FILENAME Framepart that provides a tool for interactively
selecting a file.
GENERIC Framepart that is a simple placeholder used by C
Toolkit applications to provide a means of plugging
260
Cross Index
261
Cross Index
framepart.
CDMOUNTUIL Function displays the CDROM Mounting Utility.
CEIL Function computes the mathematical ceiling of a
floating-point number.
CLEARTYPEDEFS Function that restores the filename part to a state
where it does not recognize any specific file types.
Specific to the filename framepart.
COLUMNSELECT Function that changes which columns are selected in
the cellarray. Specific to the cellarray framepart.
COPY Function that duplicates currently selected rows and/
or columns to the clipboard. Specific to the cellarray
framepart.
COSINE Function that computes the mathematical cosine of
its argument.
DATATYPE Function that determines the data type of the image
named in the filename part. Specific to the filename
framepart.
DELETE Function that removes currently selected columns
from the cellarray. Specific to the cellarray framepart.
ERROR Function that displays an error message.
EXP Function that computes the exponentiation of a
specified number.
EXPORT Function that allows contents of selected rows and
columns to be exported to a file. Specific to the
cellarray framepart.
FEXIST Function that tests to see if the file named in its
argument exists.
FEXT Function that extracts the extension portion from a
filename string.
FILETYPE Function that obtains the type of image named by the
filename part. Specific to the filename framepart.
FLAG Function that determines whether or not the named
file has map boundaries other than through
calibration. Specific to the filename framepart.
FLOOR Function that computes the mathematical floor of a
floating-point number.
262
Cross Index
263
Cross Index
264
Cross Index
265
Cross Index
266
Cross Index
267
Cross Index
268
Cross Index
269
Cross Index
270