Re: modal windows



On Tue, 21 Mar 2000, Antonio Campos wrote:

> Suppose I have a window (a painting program for example), and then the
> user selects exit from the menues or press the close button that the
> WM puts over my window.
> Then I can show a modal dialog asking the user to save his/her work,
> before closing the application.
> 
> But, and here comes the problem: with gtk, the user still can focus the
> main program window, and worse, close the main program window (bypassing
> the modal dialog question) pressing over the close button that the
> WM puts over the window.

  GTK can't stop the window manager from letting users interact with
windows. And it shouldn't, in my opinion. A user could want to minimize
the main window to see something behind it, even when when there is a
modal dialog on top of it.

> 
> I think this is incorrect. I know I can stop the emmision of the
> "destroy" signal over the main window to not let the user close the main
> window throught the WM, but shouldn't that be done directly by setting
> the dialog window to modal? Even more, shouldn't a modal window not
> allow the user to focus other windows of the program?

  You can (this is FAQ), handle the "delete_event" signal from that window
and return TRUE in the signal handler. That way, the window won't be
destroyed.  If you return FALSE, instead, the window will be destroyed.

> 
> Thanks in advance...
> 
> 
> 
> 

-- 
Gustavo J.A.M. Carneiro
[reinolinux.fe.up.pt/~ee96090]
                                       



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]