Re: How to raise / focus a window?
- From: Shaun McCance <shaunm wolfram com>
- To: David Topper <topper virginia edu>
- Cc: gtk <gtk-app-devel-list gnome org>
- Subject: Re: How to raise / focus a window?
- Date: 24 May 2003 03:25:53 -0500
On Sat, 2003-05-24 at 03:54, David Topper wrote:
I've got an app with several windows and one central "master" window
which controls hiding / showing of the others. Unfortunately, I can't
seem to raise focus for a window. I'm doing the following:
if (GTK_IS_WIDGET(s_obj->perl_buf->window)) {
gtk_widget_set_uposition(GTK_WIDGET(s_obj->perl_buf->window),
s_obj->perl_buf->x,
s_obj->perl_buf->y);
gtk_widget_show(GTK_WIDGET(s_obj->perl_buf->window));
gtk_window_activate_focus(s_obj->perl_buf->window);
But it doesn't seem to work. I've also changed my WM from "focus
follows mouse" to "click to focus" and neither works. I'm running
Slackware 9 and KDE.
Anyone have an idea?
I believe the function you're looking for is gtk_window_present. You
should probably never call gtk_widget_set_uposition. gtk_widget_show
will only do something if the window is hidden (not just obscured by
other window). However, gtk_window_present calls gtk_widget_show for
you, so you don't have to worry about that. And unless you're doing
something you haven't described, gtk_window_activate_focus is probably
not what you want. I activates the widget in the window that currently
has keyboard focus.
So, just call:
gtk_window_present(GTK_WINDOW(s_obj->perl_buf_window));
See also:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWindow.html#gtk-window-present
--
Shaun
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]