Designing Views Outside ABC
While the View Manager is easy to use, it is sometimes advantageous to
develop your views outside of ABC. An alternate method of designing
the interface is to build a textfile external to ABC and use the
external View compiler. Once the interface is compiled, it can be
imported into ABC and the final touches made. The next sections
describe the widgets, their characteristics and the format required to
specify them. While the format is case-insensitive, the examples have
the keywords in upper case for clarity. As an example, the external
specification for the programmer interface is shown below.
MAINWINDOW progmain DIMENSIONS 100:100
{ DIALOGBOX progbox AT 0,2 TITLE "Program Box" WORKAREA
{ MENU actmenu HORIZONTAL
{ PUSHBUTTON exit ICON "Exit"
PUSHBUTTON checkpoint ICON "Checkmark"
PUSHBUTTON exportAct ICON "directoryIcon"
PUSHBUTTON editAct ICON "Edit"
PUSHBUTTON doAct ICON "activityIcon"
PUSHBUTTON addAct ICON "add"
PUSHBUTTON delAct ICON "delete"
PUSHBUTTON undelAct ICON "undelete"
PUSHBUTTON renameAct ICON "rename"
}
SCROLLEDWINDOW progwin AT 1,22
DIMENSIONS 1100:700
SCROLLBAR VERTICAL
}
}
In the following sections, each of the Widget types are described and
their syntax specification given.
Dialogbox
A dialogbox is the primary container for other widgets. Almost all
the screen objects are dialogboxes which contain pushbuttons, labels,
texteditors, listboxes etc. The characteristics of a dialogbox
include its label, list of widgets, style (modal, modeless or
workarea) and whether input focus should be taken when it appears. A
modal dialogbox will appear and not allow other screen activity to
occur until it is deleted. A workarea dialogbox typically appears
within another dialogbox. The modeless dialogbox is "free-standing"
on the screen. The label is only shown for a modeless dialogbox.
DIALOGBOX adialog AT 5,5 TITLE "name" MODELESS FOCUS
{
}
The position, title, mode and focus are optional. The mode can be
the keyword modeless, modal or workarea.
Label
A label is either text or an icon that is displayed within a dialogbox. It
consists of a label which is a string.
LABEL alabel AT 5,5 TITLE "test"
or
LABEL anicon AT 5,5 ICON "abitmap"
If the ICON keyword is used, the name refers to the bitmap in the directory
"/bitmaps".
Listbox
A listbox is a scrollable list of text items. With a listbox you can specify
the number of rows in the listbox, its width in pixels.
LISTBOX alistbox AT 5,5 WIDTH 140 ROWS 10
Mainwindow
The mainwindow is the first window which appears when ABC is first
entered. Designing your own mainwindow allows you to build your own
applications using ABC. A mainwindow requires a dimension and a list of
widgets which are restricted to a menubar, workarea dialogbox and window.
MAINWINDOW amainwindow AT 50,50 DIMENSIONS 500:300
{ ... other widgets ...
}
Menu
A menu is a list of widgets which can be selected. The widgets can be
labels, separators, togglebuttons, pushbuttons or pulldownmenus. A menu
may be vertical or horizontal as well.
MENU aMenu AT 5,5 VERTICAL
{ ... other menu widgets ...
}
Menubar
A menubar is a horizontal menu for a mainwindow and may consist
of pulldownmenus, labels, separators or pushbuttons.
MENUBAR amenubar
{ ... other widgets ...
}
Messagebox
A messagebox is a dialogbox which appears with a message and an ok pushbutton.
MESSAGE oops AT 200,200 TITLE "Oops!"
Popupmenu
A popupmenu is a menu which pops up on the screen as the result of a mouse
click. It can be vertical or horizontal and can contain the same set of
widgets as Menu.
POPUPMENU apop VERTICAL
{ ... other widgets ...
}
Pulldownmenu
A pulldownmenu is a menu which appears as the result of a click on a
pulldownmenu item. It consists of a label, may be vertical or
horizontal and can contain the same set of widgets as a Menu.
PULLDOWNMENU apdm AT 5,5 TITLE "File" VERTICAL
{ ... other widgets ...
}
Pushbutton
A pushbutton is an active label. It can be initially inactive and
made the default pushbutton. A default pushbutton will be activated
when RETURN is pressed in a dialogbox which has a texteditor.
Like labels, icons may be specified for pushbuttons.
PUSHBUTTON apush AT 120,50 TITLE "OK" INACTIVE DEFAULT
If an icon is desired, use the keyword ICON in place of TITLE. The
supplied name will be interpreted as a bitmap name in the ABC
directory "/bitmaps". You may optionally supply two bitmaps names
separated by a colon. The first bitmap will appear when the
pushbutton is not activated and the second when it is as in
"closebox:openbox".
Radiobox
A radiobox is a collection of togglebuttons, only one of which can be
on at any time. A radiobox may be horizontal or vertical.
RADIOBOX arbox AT 5,5 VERTICAL
{ ... togglebuttons ...
}
Scale
A scale is a widget which lets the user select a number within a range
by sliding a slider on a scale. A scale may be vertical or
horizontal, have an initial value and a precision (the number of
digits to the right of the decimal). In addition, you can specify the
overall dimension of the window surrounding the scale as well as the
dimension of the scale itself. Tic marks may be labelled. You can
also specify that a drag event be generated when the slider is
dragged.
SCALE temp AT 5,5 TITLE "Temperature" HORIZONTAL
DIMENSIONS 170:50
INNER DIMENSIONS 100:10
BOUNDS 0:100
PRECISION 2
INITIAL 50
TICS "Cold","Hot"
DRAGNOTIFY
Scrollbar
The scrollbar widget lets a user drag a slider along a scrollbar. It
may be vertical or horizontal. You can specify the dimensions of the
whole slider as well as the scrollbox, the initial value and bounds of
the scrollbar. The scrollbar will generate events when a unit
increment or decrement occur, a page increment or decrement occur, or
when an optional drag event occurs.
SCROLLBAR ascroll AT 5,5 VERTICAL
DIMENSIONS 20:100
SLIDERSIZE 10
INITIAL 50
BOUNDS 1:100
UNIT 1
PAGE 10
DRAGNOTIFY
ScrolledWindow
A scrolledwindow is a graphics window with scrollbars.
SCROLLEDWINDOW ascr AT 5,5
DIMENSIONS 1000:500
SCROLLBAR VERTICAL HORIZONTAL
You may specify either vertical or horizontal scrollbars or both.
Separator
A separator is a vertical or horizontal line which may appear in
dialogboxes and menus.
SEPARATOR asep AT 5,5 VERTICAL LENGTH 100
Texteditor
A texteditor accepts text typed from the keyboard. You may specify
whether a vertical scrollbar is present and the rows and columns of
the editor. The texteditor will automatically resize when text is
entered beyond its original size unless the scrollbar is present.
TEXTEDITOR aneditor AT 5,5 SCROLLING COLUMNS 40 ROWS 3
Togglebutton
A togglebutton is a button which is either on or off. Like label it
can display an icon as well as text. You may also specify whether it
is initially on or off. By default, it is off.
TOGGLEBUTTON atog AT 5,5 TITLE "Test" ON
As with pushbuttons, replacing TITLE with ICON will display an icon
rather than a checkbox. Supplying two bitmap names separated by a
colon will allow you to display the on state with the first bitmap
name and the off state with the second as in "onbit:offbit".
VideoWindow
A videowindow will show a motion picture clip in its window.
VIDEOWINDOW vw AT 5,5 DIMENSIONS 500:200
Window
A window is the only widget in which you can draw graphics. You must
specify its dimensions.
WINDOW awindow AT 5,5 DIMENSIONS 200:300
Compiling Views
Enter your view definitions in a textfile and then issue the
"abcwcomp" command to compile. For example, if you entered the view
definitions in the file 'example.db' you would compile it with:
% abcwcomp example.db
If the view was correctly specified, the file 'example.asm' will be
generated. This can then be imported into ABC and manipulated (see
the Chapter on System mode). Of course, if there are errors, the
compiler will list them and you may correct them.