FLTK logo

Re: Fl_Menu and pop-up window conflict

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.bugs  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Fl_Menu and pop-up window conflict Albrecht Schlosser Jul 21, 2009  
 
Albrecht Schlosser wrote:

> Add the following three lines with "***" comments to your code, and it 
> will work as intended.
> 
>   bool response = false;
>   responseWindow->user_data((void*)&response);
> 
>   Fl_Window *g = Fl::grab();    // *** non-NULL, if menu is open
>   if (g) Fl::grab(0);        // *** release menu grab()
> 
>   // Here's where it hangs
>   while (responseWindow->shown())
>     Fl::wait();
> 
>   if (g) Fl::grab(g);        // *** restore menu grab()

Sorry, I must add this *WARNING*:

Please use this as a workaround for FLTK 1.1.9 only and test again after later 
upgrading. After all I'm not sure if we will find a completely different 
solution for FLTK 1.1.10 and FLTK 1.3 - I'm thinking of something, but I need 
some more investigation time. But _if_ we do, then this proposed solution 
_might_ crash your program or have bad effects, because the last line _might_ 
use a pointer to a (menu) window that has been deleted during the Fl::wait() 
loop. I'm sorry that this is so vague, but I really don't know more now.

Albrecht
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.