From: <pukite@daina.com>
Subject: Re: Graphical interface for Ada programs
Date: Thu, 16 Mar 95 20:25:21 CST
Date: 1995-03-16T20:25:21-06:00 [thread overview]
Message-ID: <83597.pukite@daina.com> (raw)
ab@captblood.armstrong.edu <ab@captblood.armstrong.edu> wrote:
> I would like to build a graphical interface to an
> Ada program. The interface would have the usual buttons,
> menus, multiple choices, as well as edit subwindows and a
> animated display subwindow.
>
> What do you use for such a combination? Are there any
> PD packagages that provide some/all of these
> interface-design objects?
I will try to explain one method of designing an Ada GUI.
Suppose that I want to design an interactive dialog box. I plan to provide
initial data to the dialog, then perform some procedures or updates while
it is instantiated, and then return some data upon closure.
To accomplish all this, I will eventually have to code (either visually or
textually) various edit subwindows, check boxes, buttons, etc. to the
basic dialog. Here is the list of controls (widgets) that a dialog
might contain:
Check box : BOOLEAN indication (yes or no)
Radio button : set of TYPED (enumerated) values with only one chosen
Edit box : text STRING or INTEGER value or FLOAT
Slider/Scroll: RANGE of discrete values
Push button : PROCEDURE that gets invoked
List box : UNCONSTRAINED ARRAY of items
Combo box : UNCONSTRAINED ARRAY of items with 0th item separate
I can also have composites of these controls:
Group box : A RECORD of related controls surrounded by a rectangle
Array : A CONSTRAINED ARRAY of check boxes, edits, etc
And I can trigger events by clicking on one control which updates another:
Event click : A FUNCTION that returns a value to a specific control
Notice that I have intentionally upper-cased certain words. In fact,
these keywords and a parser allow me a way to map directly from Ada
constructs to the appropriate dialog controls.
I will give an example of how this works. The Ada package below
uniquely specifies a dialog box:
with Wintypes;
package Select_Shape is
subtype Shape_Name is STRING (1..20);
type Shapes is array ( POSITIVE range <> ) of Shape_Name;
type Intensities is range 1..10;
type Colors is ( Red, Green, Blue );
type Dimensions is range 1..3;
type Scaling is array ( Dimensions ) of INTEGER;
generic
with procedure Help
( Window : in Wintypes.HWND ); -- Push button
procedure Box
( Window : in Wintypes.HWND; -- parent Window handle
List_Name : in STRING; -- Static text
List : in out Shapes; -- List box
Intensity : in out Intensities; -- Scroll bar or slider
Fill : out BOOLEAN; -- Check box
Color : in out Colors; -- 3 Radio buttons
Scale : in out Scaling ); -- Array of 3 Edits
end Select_Shape;
This dialog prompts for input on how to display and scale a certain shape.
Note that this also gives the directional modes of the data.
This specific example may be a bit contrived, but I can usually map a fair
share of dialog boxes that I have seen out there with this technique.
Of course, finishing up the coding task requires manual effort or a tool.
The Ada package body will contain interfacing code; and a resource script
file will contain the dialog layout. Plenty of tedious work is involved
in interfacing so I prefer to use the automated approach.
Fortunately, you can get an automated ("declareware") tool from the PAL if
you happen to be Ada coding for Windows. Check out CanAda in the
/languages/Ada/swtools directory and make sure you have a floating-point
coprocessor enabled PC. It contains a Windows hypertext help file
as documentation.
next reply other threads:[~1995-03-17 2:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-03-17 2:25 pukite [this message]
-- strict thread matches above, loose matches on Subject: below --
1995-03-15 21:19 Graphical interface for Ada programs ab
1995-03-16 17:42 ` Frederic Besnard
1995-03-17 18:00 ` Theodore Dennison
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox