www.digitalmars.com         C & C++   DMDScript  

D - How? Callbacks from GTK+

reply "ant" <antoniom gosympatico.ca> writes:
I need help here.
After following D for the last year
I just spend 4 hours with D and 4 hours with GTK+ on linux
and I'm coding a D wrap for GTK+ obviously I'm calling it DUI.

It's a child's play except for the callbacks (signals?).
I read the old posts on callbacks and delegates and I still have no clue on
how
to get the callbacks to work beside creating a static function for each
callback,
for each widget instance.
Is there a better way (I sure hope so)?
Can anyone help?

(Yes, I have to say that I never worked at this low level.)

My first idea was to have 1 callback per GTK widget (or widget class or...)
that would then call the appropriate D widget,
unfortunatly I don't think I can set my D widget pointer on the GTK widget.
Is it here I can use and array of delegates?
Do I need browse all the D widgets until I find the correspondence to the
GTK widget
that generated the callback? This would imply mantaining a table with all
the D widgets,
doesn't sound like a good idea...

(hope this makes sense)

If you are curiouse on my DUI implementation:
It's a prety simple job, just typing in D classes that wrap the GTK widgets.
For sure it will not be the definitive D graphic toolkit but it will work,
no doubt
after just a couple of hours I have a top level window and buttons and text
entry.
My experience is manly java.swing, I did look at other X toolkits many year
ago.

Thanks
Ant
Jul 14 2003
parent Ant <Ant_member pathlink.com> writes:
In article <beut8f$pv6$1 digitaldaemon.com>, ant says...
I need help here.
Never mind, I figured it out. I'll let you know when it becames interesting. Ant
Jul 15 2003