>>> I would like to cause a callback if I click anywhere on the
>>> background of my window . Not just if I click on the closing-x
>>> on the upper right corner.
>>> How do I do that?

>> Derive your own subclassed widget.
>> In the handle method, call the base class handle method and check
>> the return value:
>>  - if it is non-zero, some widget has consumed the event so there
>>    is nothing more to do, simply return that value.
>>  - if it is zero, no one used the event, so check if it is the
>>    event that you are looking for. If so, just use do_callback()
>>    or some similar mechanism to invoke the requisite actions. Then
>>    return 1 to stop the event from propagating any further (since
>>    you have used it.)
>> Something like that ought to work.


> I'm really new in C++, so how do I call the handle method in my
> subclass to get the return value?

An example is worth a thousand words, and Greg's examples are great!
http://seriss.com/people/erco/fltk/#PopupWindow
http://seriss.com/people/erco/fltk/#DrawCoords

and then there's the documentation:
http://www.fltk.org/documentation.php/doc-1.1/subclassing.html#handle

Hope that helps
D.

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

Reply via email to