comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephe.Leake@nasa.gov>
Subject: Re: Custom model in gtkada?
Date: Tue, 04 Jul 2006 09:51:56 -0400
Date: 2006-07-04T09:51:56-04:00	[thread overview]
Message-ID: <uejx1scjn.fsf@nasa.gov> (raw)
In-Reply-To: 191m62k8p0wpz.qjuymnpvpl0p.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On Sun, 02 Jul 2006 11:17:17 -0400, Stephen Leake wrote:
>
>> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>> 
>>> Yes, but what pointers lack is safety of composition. Primitive operation
>>> is safely inherited and required to be overridden when abstract. Also
>>> within a primitive subprogram you are safe against re-dispatch. An
>>> equivalent design based on pointers will always "dispatch".
>> 
>> This is true, but I don't see how it is relevant to a GUI design. Of
>> course you want the call to "dispatch" to the user-provided operation!
>
> No I don't. More precisely I don't want it be the default. It is unsafe,
> because some non-overridden behavior [already implemented and tested] of a
> widget might change if some signals get overridden. Consider F1 emitting
> F2. Let F2 is overridden while F1 is not. This would mean that F1 might
> function differently. If W1 emits F1 it shall function exactly as it was
> before W2 was derived from it.

Yes, that is an inherent problem in user-overridable subprograms that
are "supposed" to call other subprograms; there is no way to
enforce/check that behavior.

However, that is not unique to GUI event handling; it is a general
problem of subprogram operation specification. I would call it a bad
design to define such a callback. Or at least, such a callback should
be clearly labeled as "expert" or "dangerous".

> Yes, it is Turing complete. (:-)) I'd like to have "class-wide" and
> "primitive" equivalents of signals.

That's an interesting concept. But Gtk is already complex enough :).

>> I have not done much with deriving new widgets from existing widgets.
>> The few times I tried it I ended up with a totally new widget. I'd
>> have to go back and re-examine the details to understand why.
>
> Once I wrote an extensible dialog widget for Windows (in C++), which was
> something like a mixture of Gtk.Boxes and a stack of widgets (subdialogs),
> combined with messages handling. It was nasty. Especially handling messages
> was. Because some messages propagated up the hierarchy, some did down. A
> subdialog could either swallow a message (give a response), or let it
> propagate. That was combined with a possibility for a widget to close
> itself (and let swallow or propagate). A subdialog could catch events like
> button clicks of its parents. Add here a translation of messages parameters
> upon propagation...

Right. That's where I have problems with Gtk as well. Windex (my "pure
Ada" binding to Win32) is a little better, because I can use
Controlled types for some things. But I'm still not clear how to
handle message propagation cleanly.

On the whole, I think Gtk does the best job in GUI library design. But
it's far from "perfect".

>>> It could also need to receive some data back. Probably, a kind of
>>> transaction would even better, considering low-level drawing, double
>>> buffering issues etc. 
>> 
>> By "transaction", you mean something like an Ada rendezvous? Or like a
>> database transaction, with start, operate, end/rollback semantics?
>
> Rollback upon exception would be nice. I agree, it is close to Ada
> rendezvous. Messages are also close to rendezvous, one can route them etc.
> However rendezvous lack marshaling, I am not sure if it is [always]
> bad.

The marshalling packages in GtkAda are supremely confusing. I'd much
prefer an inheritance mechanism there. I started trying to extend
GtkAda to provide one, but I didn't have time to really work on it.
It's not a simple problem.

But I think marshalling is necessary to any real GUI event handling.

>> I never implemented container widgets in Windex. GWindows now has
>> Packing_Boxes, based on my experience with Gtk containers. We still
>> have not figured out a good way to compose the event handling.
>> 
>> Perhaps you'd like to help with that?
>
> I am not satisfied with my own solutions, 

Neither am I, with mine :).

> how can I recommend them? 

Dialog is almost always useful; the combination of two not-so-hot
ideas can sometimes produce a good solution :).

> But of course, I'll help in what I can.

Ok. The GWindows project is part of the Gnavi Sourceforge project; see
http://sourceforge.net/projects/gnavi/ . It's not very active, but
this might trigger some work.

-- 
-- Stephe



  reply	other threads:[~2006-07-04 13:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-13 18:01 Custom model in gtkada? Dmitry A. Kazakov
2006-06-13 19:53 ` M E Leypold
2006-06-14  7:17   ` Dmitry A. Kazakov
2006-06-14 21:00 ` Maxim Reznik
2006-06-15  7:38   ` Dmitry A. Kazakov
2006-06-15 15:31     ` Georg Bauhaus
2006-06-15 16:24       ` Ed Falis
2006-06-15 18:44         ` M E Leypold
2006-06-15 16:25       ` Dmitry A. Kazakov
2006-06-17 15:13         ` Georg Bauhaus
2006-06-17 16:44           ` Dmitry A. Kazakov
2006-06-22  7:16             ` Emmanuel Briot
2006-06-22  8:31               ` Dmitry A. Kazakov
2006-06-22 12:08                 ` Emmanuel Briot
2006-06-23 12:32                 ` Stephen Leake
2006-06-23 13:58                   ` Dmitry A. Kazakov
2006-06-29 17:11                     ` Stephen Leake
2006-06-30 12:29                       ` Dmitry A. Kazakov
2006-07-02 15:17                         ` Stephen Leake
2006-07-03 18:23                           ` Dmitry A. Kazakov
2006-07-04 13:51                             ` Stephen Leake [this message]
2006-07-05 13:06                               ` Dmitry A. Kazakov
2006-07-06  7:10                                 ` Stephen Leake
2006-06-23 16:59                   ` Jeffrey R. Carter
2006-06-23 17:37                     ` Ed Falis
2006-06-23 18:11                     ` Dmitry A. Kazakov
2006-06-29 17:20                     ` Stephen Leake
2006-06-29 20:08                       ` Jeffrey R. Carter
2006-06-30 10:28                         ` Alex R. Mosteo
2006-06-30 16:07                         ` Stephen Leake
2006-06-30 19:45                           ` Jeffrey R. Carter
2006-06-30 22:41                             ` Randy Brukardt
2006-07-01  5:11                               ` Jeffrey R. Carter
replies disabled

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