comp.lang.ada
 help / color / mirror / Atom feed
From: Michael Bode <m.g.bode@web.de>
Subject: Re: Newbie Needs Ada Advice
Date: Tue, 08 May 2007 21:23:19 +0200
Date: 2007-05-08T21:23:19+02:00	[thread overview]
Message-ID: <f1qin8$doi$1@online.de> (raw)
In-Reply-To: 1178638047.133001.115090@o5g2000hsb.googlegroups.com

ezkcdude <zamir.evan@gmail.com> writes:

> It's not so much look, but the ease of doing it. For example, I would
> like something like the GUI builders you can find in NetBeans. Glade
> is similar, but then you have the XML stuff, which seems like even
> more overhead to learn. I noticed that the version of glade bundled
> with GtkAda in GPS is not the most current version. The current
> version of Glade does not output source code, only XML.

I'm not sure what your problem with XML is. You never need to look at
the XML glade generates. The 'standard' way is to use gate to generate
Ada code. I'm using myself the 'other' way: use libglade to build the
GUI from the XML file. One disadvantage of this method is that you
more or less use only the predefined widget types and can't derive new
types from those. On the plus side you get internationalisation for
free because Gnu gettext works just fine with glade files. One
example:

procedure Create_Window (Window : in out Window_Record;
                         Fname  :        String;
                         Root   :        String)
is
begin
   Gtk_New (XML => Window.XML,
            Fname => Fname,
            Root => Root,
            Domain => Application.I18n_Textdomain);
   Window.Window := Gtk_Window (Get_Widget (Window.XML, Root));
end Create_Window;

I call this procedure 5 times in one of my apps for 5 different
windows and it pulls in 19874 lines of XML using the right language
for labels etc. and build the whole gui. What I have to do in code is
connect Ada variables to the widgets like that:

Main_Window.Connect_Btn := Gtk_Button (Get_Widget (Main_Window.XML, "connect"));

and connect callbacks:

Button_Handlers.Connect (Main_Window.Connect_Btn, "clicked",
                         Button_Handlers.To_Marshaller (Connect_Cb'Access));

> I am not really concerned with looks. Most important are 1)
> functionality 2) performance and 3) ease of programming. Java really
> seems to have the upper hand in #3. Is this not the case?

Sometimes code generators generate the right code, sometimes you
better code by hand. Suppose you have 5 unrelated checkboxes in your
window. A GUI code generator will generate 5 unrelated widget
variables and 5 unrelated callback functions to handle the "clicked"
events. Fine.

No suppose you have 32 checkboxes that form a logical array. The code
generator will generate 32 unrelated widget variables and 32 callback
functions. The human programmer will write an array of widgets,
generate them in a loop and handle the events in one callback
function.

I'm just starting to look into Java, so I'm only guessing. I believe
even if GUI programming might be easier interfacing to your hardware
(drives, cameras, whatever) might be harder in Java.

I've myself a similar project on my todo list which keeps getting
delayed again and again. I think I got as far a reading the serial
number off of the camera :-(

-- 
No intelligent man has any respect for an unjust law. 
He simply follows the eleventh commandment.
-- R.A. Heinlein



  parent reply	other threads:[~2007-05-08 19:23 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-03 17:13 Newbie Needs Ada Advice ezkcdude
2007-05-03 18:24 ` Dmitry A. Kazakov
2007-05-03 22:14   ` ezkcdude
2007-05-04  4:07 ` tmoran
2007-05-04 12:57   ` Bob Spooner
2007-05-04 13:38     ` Dmitry A. Kazakov
2007-05-04 14:40       ` ezkcdude
2007-05-04 19:19       ` Bob Spooner
2007-05-04 19:48         ` Dmitry A. Kazakov
2007-05-06 21:46           ` ezkcdude
2007-05-07  7:31             ` Dmitry A. Kazakov
2007-05-07  7:42             ` Alex R. Mosteo
2007-05-07  9:15               ` Dmitry A. Kazakov
2007-05-08  2:58             ` Justin Gombos
2007-05-08 11:58               ` ezkcdude
2007-05-04  4:42 ` Jeffrey R. Carter
2007-05-04  6:48 ` Jacob Sparre Andersen
2007-05-07  8:01 ` Markus E Leypold
2007-05-08 14:40   ` ezkcdude
2007-05-08 15:07     ` Pascal Obry
2007-05-08 15:27       ` ezkcdude
2007-05-08 15:54         ` Pascal Obry
2007-05-08 16:07         ` Georg Bauhaus
2007-05-08 18:42           ` Markus E Leypold
2007-05-08 16:18         ` Ali Bendriss
2007-05-08 19:23         ` Michael Bode [this message]
2007-05-08 16:11     ` Markus E Leypold
2007-05-08 16:49       ` ezkcdude
2007-05-08 18:20         ` Ludovic Brenta
2007-05-08 21:17           ` Markus E Leypold
2007-05-08 18:45         ` Markus E Leypold
2007-05-08 18:28     ` Alex R. Mosteo
2007-05-08 18:51       ` ezkcdude
2007-05-08 19:31         ` Michael Bode
2007-05-08 19:43           ` Michael Bode
2007-05-08 20:02         ` Dmitry A. Kazakov
2007-05-08 21:26           ` Markus E Leypold
2007-05-08 21:21         ` Markus E Leypold
2007-05-08 21:27           ` ezkcdude
2007-05-08 21:56             ` Markus E Leypold
2007-05-09 13:25               ` Jacob Sparre Andersen
2007-05-09 15:58                 ` Markus E Leypold
2007-05-10 21:20                   ` Memory mapped files and shared memory (Was: Newbie Needs Ada Advice) Jacob Sparre Andersen
2007-05-11 16:38                     ` ezkcdude
2007-05-10 18:14     ` Newbie Needs Ada Advice Chip and Allie Orange
2007-05-27  5:50     ` adaworks
2007-05-29 12:54       ` ezkcdude
replies disabled

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