> When I open a window after a double click of a button, my > window gets the following events in this order. > > FL_FOCUS > FL_SHOW > FL_UNFOCUS > > Because of the UNFOCUS event, the following keyboard events > goes to other windows. > > How can I prevent this happening? I'm returning 1 from the > handler of my window if I get a FOCUS event.
I don't think you can stop it - the order the events get delivered to fltk depend very much on the timing and sequencing of your window manager... So fltk has to make do with what it is given... I suspect the unfocus is sent because the button you just clicked gets sent the focus, since it is the last object you interacted with. What platform are you on? Can you try a different window manager easily? If so, you *might* find the events arrive in a different order. Although that won't help you much, of course... But, you might be able to work around it: The first thing to try might be clearing the visible_focus() setting for the button in question - that might stop it from stealing the focus away from your new window (but if you want the visible focus indication on your button, that would not be practical.) Alternately (and this is more of a hack...) you could have the button callback show your new window, *and* start a oneshot timeout with add_timeout, set to some small value, say 0.2 of a second... Then, the timeout callback does a set_focus on to your new window. I *think* that might allow you to pass the focus to your new window after it is shown, and after the button has released. But... 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

