[Gtk-sharp-list] How to initially set focus for modal dialog regardless taskbar?

Christopher David Howie me at chrishowie.com
Mon May 3 11:27:42 EDT 2010


On 05/03/2010 04:12 AM, Maciej Pilichowski wrote:
> So for focus, the problem is solved, thank you, not I have to figure 
> out what is going on with twice clicking on [x].

Perhaps try adding an event handler to the dialog's Delete event.  This
is the event that is raised when the user clicks the X in the window's
title bar.  Do a Console.WriteLine() or something to see when it happens.

If this method is called the first time you click, you can make the
window hide on the first click by calling Hide() in the event handler.
(If you are displaying the dialog with Run() you will probably want to
instead call Respond() with the appropriate ResponseType.  Then Hide()
or Destroy() the dialog from the code that calls Run().)

If, on the other hand, you don't get any message on the console when you
click the X for the first time, then it sounds like your window manager
might not be passing the event on to your application.  In that case
there is pretty much nothing you can do about it.

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

PGP key:

pub   2048R/CF8338F5 2010-04-14
      Fingerprint: 2B7A B280 8B12 21CC 260A  DF65 6FCE 505A CF83 38F5


More information about the Gtk-sharp-list mailing list