comp.lang.ada
 help / color / mirror / Atom feed
* Graphical interface for Ada programs
@ 1995-03-15 21:19 ab
  1995-03-16 17:42 ` Frederic Besnard
  1995-03-17 18:00 ` Theodore Dennison
  0 siblings, 2 replies; 4+ messages in thread
From: ab @ 1995-03-15 21:19 UTC (permalink / raw)
  Cc: ab


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?

Did anybody try to use Xview with Gnat?
Is there a way to access X11 widgets from Gnat?

I'll appreciate your responses and/or pointers 
to sources that deal with this visual/interface aspect 
of an Ada program.

ab



-- 

Dr. A.Bykat
Fuller E. Callaway Professor




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Graphical interface for Ada programs
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Frederic Besnard @ 1995-03-16 17:42 UTC (permalink / raw)


go to the WWW Ada server:

http://lglwww.epfl.ch/Ada/Resources


There is a chapter "bindings" where you will find
all that is currently known on the subject.

A free solution is the DEC binding, both to X and
to MOTIF. It eas originatly written for DEC workstations,
but portings have been made for Sun, with SunAda and Alsys
compilers (as far as I know).
I tried to do so with Rational APEX, but I failed.
If someone tried so and succeed, please let me know.

Another possibility (the one I choosed) is the XinAda implementation
(not binding) of X and MOTIF, coming from TopGraph'X.
It's of course not free (for details, contact M. Mahieux
at 100071.45@compuserve.com), but is more useable.
 
-- Frederic



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Graphical interface for Ada programs
@ 1995-03-17  2:25 pukite
  0 siblings, 0 replies; 4+ messages in thread
From: pukite @ 1995-03-17  2:25 UTC (permalink / 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.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Graphical interface for Ada programs
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Theodore Dennison @ 1995-03-17 18:00 UTC (permalink / raw)
  To: ab

() <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?
> 

If you are developing a GUI, I cannot highly enough suggest a GUI builder.
If you can't afford a GUI builder, and you are running under MOTIF, my next
best suggestion is to use UIL. It is another "language" to use, but it 
allows you to tweak the appearance of the GUI without having to recompile 
and link your application. It also removes all those grisly widget creation
calls from your Ada code. A UIL compiler comes with every implementation of
MOTIF. The only other thing required to use UIL from your Ada programs is a
set of X and Motif bindings.

I haven't used UIL with the GNAT compiler (yet), so I will have to let 
others speak to the availability of X and MOTIF bindings.

T.E.D.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1995-03-17 18:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
1995-03-17  2:25 pukite

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox