Focus a Gtk::Window?

Hello,

How can I focus an existing Gtk::Window inside my application? A little
example:

########################
require ‘gtk2’
secondwindow = nil

button = Gtk::Button.new(“Click me”)
button.signal_connect(“clicked”){
if secondwindow == nil or secondwindow.destroyed?
secondwindow = Gtk::Window.new
secondwindow.show_all
else
# I want to focus the existing window here
end
}

window = Gtk::Window.new
window.add button
window.show_all
Gtk.main
########################

When you click on the button once, it opens a new Gtk::Window. When you
click on it a second time, I want the existing window to be focused.
Making the second window modal is not an option for me here.

Thanks in advance.

On Fri, Sep 21, 2007 at 04:57:39PM +0200, Joachim G. wrote:

Hello,

How can I focus an existing Gtk::Window inside my application? A little

secondwindow.present should do what you want. See:

http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AWindow#present

-pete


This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Peter J. wrote:

On Fri, Sep 21, 2007 at 04:57:39PM +0200, Joachim G. wrote:

Hello,

How can I focus an existing Gtk::Window inside my application? A little

secondwindow.present should do what you want. See:

http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AWindow#present
Yes, thank you, that’s exactly what I was searching for.