On Thu, Nov 17, 2011 at 2:41 PM, Carlo E. Prelz <fluido@fluido.as> wrote:
       Subject: [ruby-gnome2-devel-en] question about modal window
       Date: gio 17 nov 11 12:54:30 +0800

Quoting hendra kusuma (penguinroad@gmail.com):

> I need to create a modal child window.
> So far I use gtk_window, but it has one problem
>
> usually I have *self.modal = true* in initialize method and *self.modal =
> false* in close method.
> problem is close method doesn't work if the child window is closed by
> clicking x button at the frame,
> so if a user click it, child window disappear but modal state doesn't
> change to false so parent window can't be accessed
>
> so my question is,
>
> is it the right way to create a modal child window, if not, what widget
> should I use?

When I need a modal window, I use Dialog:

dialog=Gtk::Dialog::new("Title",@parent_window,Gtk::Dialog::MODAL)

I pack dialog.vbox with whatever I want to show, and I add one or more
buttons - for example, if I just want the user to close the window I
write:

dialog.add_button('CLOSE',Gtk::Dialog::RESPONSE_CANCEL)
dialog.signal_connect('response') do |w,r|
 dialog.destroy()
end

and I complete with

dialog.show_all()

I hope this helps

Carlo

Thanks
I manage to get it right using dialog like your suggestion, although many part of code needs to change

--
Suka linux?
Kunjungi blog saya http://penguinroad.blogspot.com