MacArthur, Ian (SELEX) (UK) wrote:
>>> Using fltk-1.1.x-r5953 my application tries to do some
>>> processing when a window is closed - but the FL_CLOSE
>>> event never gets to my event handler function. The
>>> FL_HIDE event is the last one to arrive.
>> I don't know the answer to your specific question -- perhaps
>> someone else can offer an explanation. However, when faced
>> with the same problem I discovered that one can accomplish
>> more or less the same thing by assigning a callback to the
>> window. Apparently the callback is done when the window
>> is closed.
>
>
> Yes - I think I'd go with Stan's method...
Right, according to the code, I don't think FL_CLOSE is ever delivered
to the window widget.. it seems to currently only be handled internally
by Fl::handle():
---- snip
int Fl::handle(int e, Fl_Window* window)
{
e_number = e;
if (fl_local_grab) return fl_local_grab(e);
Fl_Widget* wi = window;
switch (e) {
case FL_CLOSE:
if (grab() || modal() && window != modal()) return 0;
wi->do_callback();
return 1;
---- snip
..so by that, I don't think it's ever delivered to the widget's
own handle() the way other events are.
Maybe it should be?
I don't think FL_CLOSE used to even be documented at all in the
old docs, possibly for this reason.
The fact that it is documented now might indicate it needs
a special citation that it's for internal use only, or so it seems.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk