N. Cassetta wrote:
Here's a (minimal) implementation of my problem. When I click the lower button,
fl_alert() appears and suddenly closes as if a mouse click was still pending.
I use FLTK 1.1.9 with CodeBlocks (MinGW)and WinXP.
Yes, it's true. You described *exactly* what's happening!
Confirmed on Windows with FLTK 1.1.9, 1.1.10, and 1.3.0.
In my configuration the number of "sudden death's" of the
alert window depends on the number of clicks on the buttons
labeled with 2,3,4, and 5, no matter of how often the other
buttons are clicked. It doesn't happen at all, if you click
the "Then here" button before the "First click here" button.
The explanation of this effect is somewhat special ;-P
The fact is that your number buttons don't have callbacks,
and thus their events get queued in the internal queue of
events for widgets without a callback. And this is the event
queue that is used to read the events for the buttons in
fl_alert() etc.
Now, what's happening in your special case is that you delete
the widgets before the alert window is created and shows for
the first time, and therefore the button(s) internally used
in fl_alert() and others get the *same* addresses as your
previously deleted buttons. Then fl_alert() reads *their*
events and mis-interprets them.
The solution is easy, however: I just made a small test with
fltk 1.1.10 by reading the event queue before popping up the
fl_alert() window, and this solved the problem.
Maybe we should use this to fix the problem in 1.1.10, but
a long term solution would probably be different.
Please see the attached diff file for FLTK 1.1.9 and try if
it solves your problem.
Albrecht
Index: src/fl_ask.cxx
===================================================================
--- src/fl_ask.cxx (revision 6881)
+++ src/fl_ask.cxx (working copy)
@@ -207,6 +207,8 @@
else
button[0]->shortcut(FL_Escape);
+ while (Fl::readqueue()) ;
+
message_form->show();
// deactivate Fl::grab(), because it is incompatible with Fl::readqueue()
Fl_Window* g = Fl::grab();
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk