On 06.02.2012 11:35, Beamon wrote:
> What's the actual difference between those two?

Basically, the level of usage (sorry, I can't find a better
word for it).

As a user of an existing widget class, you can only access the
callback function you set. When and how it is called depends on
the widget class.

If you want to change this, you must subclass the widget and define
your own handle() method. Then you can access each event and decide
exactly what to do.

So, handle() is the *basic* event handling mechanism, and you will
usually not need to use/define it for simple/standard programs.
You can use existing widgets and utilize the callback functions
for standard events like button clicks, value changes, etc..
Only if you need to change the basic event handling beyond what
FLTK does for you (or if you invent own widgets) you will need
to define a handle(int event) method to handle all events just
as you like.

You can find more info here:

http://www.fltk.org/doc-1.3/events.html
http://www.fltk.org/doc-1.3/subclassing.html

> I want to know when some event occurs, the information is sent to FLTK 
> window, Which has two version of handle() and handle(int x) (I'm not even 
> sure what they do, just know they get/set the events). I am also not sure 
> that every widget also got the same handle() versions?. Which in turn calls 
> the some other functions to call my call_back() to handle the event which was 
> set by my like FL_widget_mine->callback(Handle_it);

Each (widget) class has its own handle(int event) method. All events
are delivered to the widget's handle method. The widget (class) then
does some actions or ignores the event. Eventually, the event() method
calls the callback, if something happened that is "important enough"
to call the user's callback function. For an input widget, this is
when the contents was changed, and/or the widget is left (e.g. with
a mouse click on another widget or by typing tab). You can change
this for any widget by using the when() method in a limited way,
depending on the class's ability (see the particular docs).

> So what happens now when application receives the event?, how does the event 
> propagates till the my provided call_back() of widget is called to handle to 
> event?

First it is handled by the widget's handle(int event) method (pun
intended), then the handle method *may* call the callback function.

> I tried to read the manual two times but I wished I could sue the company for 
> creating such a problematic/hard to understand manual:( .Can anyone share any 
> good tutorial which explain overall working of it

Unfortunately there's no company to blame, the dev's are all volunteers
and are not paid. Which version of FLTK do you use? If you're new to
FLTK you should probably use FLTK 1.3, and I believe that the docs for
1.3 are much better than 1.1. Did you read the chapters mentioned in
the links above? Maybe they are not as clear as a good tutorial, but
they should help as an overview for the reference manual.

> Thanks, I really appreciate any help.

HTH,

Albrecht
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to