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

Christopher David Howie me at chrishowie.com
Sun May 2 16:25:58 EDT 2010


On 05/02/2010 12:31 PM, Maciej Pilichowski wrote:
>   Normally you don't do anything special -- you just show the dialog 
> and it gets focus.
> 
>   But here is the catch: I don't want to show new item in taskbar just 
> for dialog so I set "skip taskbar" for it. In effect:
> 
> a) there is only one entry in taskbar for application, not two (one 
> for main window, the second for the dialog) 
> 
> b) after showing the dialog, main window still has the focus, user has 
> to click on dialog to switch focus
> 
> (a) is desired, (b) not. 
> 
>   So, the question: how to show the dialog with the focus?

Try setting the dialog's TransientFor property to the main window.  This
will prevent any interaction with the main window until the dialog is
closed, and it should also transfer focus the dialog whenever the main
window gets focused.

-- 
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