> I have created a widget that overrides handle(int). Inside 
> handle, I want to
> process various events depending on whether a callback for 
> the widget has
> been set.
> 
> For example,
> 
> int Fl_MyWidget::handle(int e)
> {
>    switch(e)
>    {
>       case FL_PUSH:
>          if(callback())
>          {
>             fl_cursor(FL_CURSOR_HAND);

Just a thought, but isn't FL_PUSH too late to change the cursor to a
hand, is it not more normal to change it on FL_ENTER or something?


>             return 1;
>          }
>          break;
> 
>      // other cases ...
>    }
> }
> 
> Then the app, assigns or removes the callback I defined as needed.
> 
> My problem is that when I create Fl_MyWidget, its callback is 
> automagically
> set to Fl::default_callback(). My questions are:

What widget are you deriving your widget from? I wonder if that makes a
difference to what is assigned by default? E.g. does Fl_Box get a
default callback or not? I do not know... Might be worth a try though. I
suspect that the deafult callback IS set for everything, however...


> 1. What is the purpose of this callback?

It puts a pointer to your widget into the fltk queue - it kind of makes
a list of widgets that may have been modified and require processing, I
think.

> 2. Is it safe to set the callback for Fl_MyWidget (in the 
> ctor) to NULL?

Erm, possibly... Certainly worth a try, I'd say. What's the worst that
can happen... :-)




SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to