Boost logo

Boost :

From: Bohdan (gejrlaug_at_[hidden])
Date: 2003-08-11 14:16:16

"John Torjo" <john.lists_at_[hidden]> wrote in message
> >
> > AFAIK, some gui toolkits use not event, but callback system.
> > IMHO it is more evective. Definitely it should be discussed
> > carefully.
> >
> Aren't we talking about the same thing? ;)

Not exactly.

------------- Callbacks ------------------
button b;
b.on_click_callback = &do_button_down; // or: b.on_click_callback.connect(
&my_func );

-------------- Events --------------------

class MyButton : public button
    void dispatch_event( Event & event )
         switch( event.ID )
         case EVENT_BUTTON_DOWN:
                do_button_down( ... ); break;
                default_handler( ... );

    Sure you can wrap event-interface to work with callbacks and vice-versa
or even user mixed approach.
  Have nothing against your ideas :) just want to note that there are
can be 'native' gui libs that are not using event-objects at all and
that event mapping/dispatch probelm is platform specific.
  The question is which interface (callback or events) is more comfortable
for user and which one is more effective. IMHO, mapping proposed by
you should be deeply inside library and user interface should work with
callbacks only.

> In response to an event, you call an event callback.
> That's what my example does - it's obfuscated indeed, but that's
> because I had to tweak it to work with VC6.


Boost list run by bdawes at, gregod at, cpdaniel at, john at