Re: [gtk-list] Re: How to check if a window is in focus?



Tim Janik wrote:
> 
> On Thu, 27 May 1999, Fiachra wrote:
> 
> > Hi,
> >
> >       What is the best way to tell if a Window has focus. I saw some mention
> > in the GTK reference under Widgets but I'm not sure how to check for this
> > property.
> 
> hm, checking for a window's focus only makes sense if you actually have
> a focus widget, e.g. an entry, right? so this should give you what you
> wnat:
> 
> if (GTK_WINDOW (window)->focus_widget &&
>     GTK_WIDGET_HAS_FOCUS (GTK_WINDOW (window)->focus_widget))
> {
>   // got focus
> }
> 
> >
> > Thanks,
> > James
> >
> 
> ---
> ciaoTJ
> 

i guess it makes sense even if a window is empty, here what i'm actually using:
// get focus
gtk_signal_connect(GTK_OBJECT(window),"focus_in_event",
		   GTK_SIGNAL_FUNC(FocusInHandler), aPointer);
//looses focus
gtk_signal_connect(GTK_OBJECT(window),"focus_out_event",
		   GTK_SIGNAL_FUNC(FocusOutEvent),aPointer);

regards
/mario
--
Mario Motta
AI Research Group - Rimini
mmotta@guest.net
http://www.guest.net/homepages/mmotta/VDKHome/index.htm



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