[Gambas-user] A Gambas odissey
doriano.blengino at ...1909...
Wed Aug 13 12:36:21 CEST 2008
Fabien Bodard ha scritto:
> is this can help you ?
> This a simple demo off event management via objerver object that catch
> the event before object.
Ok, it works. But, as you can see in my previous message and the
attached source, it was not that my problem. In fact, I already did the
same in MyDirView (I suppose this is the only way to enrich events).
I have several problems with gambas but, nevertheless, I like it. As far
as I have seen until now, it is the only functioning true RAD tool in
linux, and it has several nice things in it. For example, the settings
class is amusing, and there are many other good things. Unfortunately it
is still in development, so some features are missing or buggy, like the
GTK system; but this is only question of time. Documentation is
hermetic sometimes, but it can grow and improve.
The only real problem comes from the inheritance from visual basic, I
suppose, which, as many other micro$oft products, is tailored to suit a
market, and not to do things the right way. This is very dangerous,
because a similar product invades the market, cutting away other,
perhaps better, competitors. Then it shapes the mind of the users
(programmers), so the general culture is polluted too.
In this respect, it is a point of distinction that Gambas claims to be
"not a clone of visual basic" and, in fact, it is not a clone. But... I
could be wrong, I don't know visual basic enough, perhaps it should be
better I didn't talk... well, I think event management is wrong. I
suppose this is an inheritance from visual basic, like several others.
Many of them could be good and, if you don't like them, simply you can
avoid them. But others cannot be avoided, and event management is one of
them. I am afraid to see gambas collapse because of a inherent flaw. In
this very case, I have simply the problem that DirView does not raise
the KeyPress event. The first thing you replied to me was "you can
rewrite it". Multiply this reply for every control a user wants to use,
but also wants to improve, and see where all we will go.
To be sure, I just made a test with delphi. I derived a TMyListBox from
TListBox, and overrided the KeyPress event:
TMyListbox = class(TListBox)
procedure keypress(var key: char); override;
procedure TMyListBox.keypress(var key: char);
if key=#13 then begin
addItem('A item', NIL);
This code snippet creates a widget class, TMyListBox, which is a ListBox
that adds an item to the list if the user presses enter (key #13). All
the rest is untouched, all the events (Click, DoubleClick, Resize, and
so on) function like before. Don't pay too much attention to the
verbosity of pascal: it comes from the fact that pascal does not require
to have a different file for every different class you want to declare,
so every declaration (the keypress procedure, for example) has to be
associated to its class. In gambas this example could be something like:
' gambas class file
public sub ME_KeyPress()
if key.code=key.enter then
inherited KeyPress ' or "Raise KeyPress", or whatever...
This is the crucial point. In gambas this is not possible. I wanted to
derive MyDirView from DirView and only add a couple of things, all the
rest was pretty ok. But I was left with two options:
1 - inherit from DirView, and replicate all its events with a
2 - inherit from TreeView, rewrite all the file related stuff, and
replicate all its events with different names
I chose the second option, because I wanted to modify several things,
but the real problem is events. If they were transparently raised,
unless overridden, the circle would be complete. It would be a quick and
trivial job to create personalized controls to suite every need.
I know what happended to DirView. The programmer created it from
TreeView, and thinked nobody was interested in KeyPress, Expand, and
other events from TreeView. On the other hand, implement them would have
required writing them one by one, with a different name; certainly this
was not appealing...
I am sorry to write this kind of flaming: someone could interpret it as
a complaint. But I think this is an important point to make gambas a
much better than it is now. I don't know if Benoit would read this
message thread, and I know, as said before, that perhaps gambas is too
developed to make this kind of modification. But I would pray the gambas
developers to pay attention, and then decide. If I am wrong, I am sorry.
I will never raise this argument again.
Good day to everybody, and long life to Gambas.
More information about the User