"John Torjo" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >
> > 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
{
private:
    void dispatch_event( Event & event )
    {
         switch( event.ID )
         {
         ....
         case EVENT_BUTTON_DOWN:
                do_button_down( ... ); break;
         ...
         defautl:
                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.


regards,
bohdan






_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to