The graphical interface – Comtrol eCos User Manual

Page 783

Advertising
background image

Writing New Devices - host

set message ""

if { ![synth::filter_parse_options $console_appearance parsed_options message] } {

synth::report_error \

"Invalid entry in target definition file $synth::target_definition\

\n

synth_device \"console\", entry \"appearance\"\n$message"

} else {

synth::filter_add_parsed "console" parsed_options

}

On success

parsed_options

will be updated with an internal representation of the desired appearance, which can

then be used in a call to synth::filter_add_parsed. On failure

message

will be updated with details of the parsing

error that occurred.

The Graphical Interface

When the I/O auxiliary is running in graphical mode, many scripts will want to update the user interface in some
way. This may be as simple as adding another entry to the help menu for the device, or adding a new button to the
toolbar. It may also involve adding new subwindows, or even creating entire new toplevel windows. These may
be simple monitor windows, displaying additional information about what is going on in the system in a graphical
format. Alternatively they may emulate actual I/O operations, for example button widgets could be used to emulate
real physical buttons.

The I/O auxiliary does not provide many procedures related to the graphical interface. Instead it is expected that
scripts will just update the widget hierarchy directly.

So adding a new item to the

Help

menu involves a .menubar.help add operation with suitable arguments. Adding

a new button to the toolbar involves creating a child window in

.toolbar

and packing it appropriately. Scripts can

create their own subwindows and then pack it into one of

.main.nw

,

.main.n

,

.main.ne

,

.main.w

,

.main.e

,

.main.sw

,

.main.s

or

.main.se

. Normally the user should be allowed to

control

this via the target definition

file. The central window

.main.centre

should normally be left alone by other scripts since it gets used for text

output.

The following graphics-related utilities may be found useful:

synth::load_image

<

image name

> <

filename

>

synth::register_ballon_help

<

widget

> <

message

>

679

Advertising