Well, it was a nice test to see if a simple example was quickly understandable.
It is not a good manner to answer to a future user to say that his knowledges are rusty, although I hope I should take it in an humoristic fashion. Avoiding “fucking” and its derivative would be nicer too, for every reader of the mailing list.
Bear in mind that not all programmers have the same way to solve a problem, mainly event management can be implemented in various ways. That’s why I asked you that question. In Java for instance, when a callback is triggered, it receives the source object as a parameter.
You made an interesting prototype. People is ready to give advice and tips here. Except if you are of those people who think that what they do is always the best, and that no feedback is necessary (any good project need critics and feedbacks. Most of the other projects are given up because of the lack of communication).
By the way, can you tell my where you explain about shared callbacks?
Cheers
Julien
— En date de?: Ven 31.10.08, W.Boeke <w.boeke at chello.nl> a ?crit? W.Boeke <w.boeke at chello.nl>
Objet: Re: [SDL] Re : SDL-widgets, a GUI toolkit (not for games)
?: sdl at lists.libsdl.org
Date: Vendredi 31 Octobre 2008, 13h40
Julien wrote:
Just a remark on the Hello World example:
In the callbacks, you make reference to “top_win” and
"but", but how do you know that the event
comes from that particular object ? Isn’t there something missing in
the arguments of the
callbacks ? (or maybe I’ve read too fast the doc :))
Code that works cannot have something missing … Probably you found out
already, or your
knowledge of C++ is somewhat rusty! Anyhow, e.g. if statement
but=new Button(top_win,Rect(5,10,60,0),“catch me!”,button_cmd);
is executed, then a new widget is created, that, if clicked, calls function
button_cmd.
There is only one such function, and this does what it should do: manipulate
’but’.
If there are many Buttons in an application, they still can share one callback
function:
RTFM (read the fucking manual)!
Wouter
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org