Question about modal window

Dear all,

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?
or
if it is, what event can I use for changing modal state before close,
I already use *delete_event and destroy *but it doesn’t work

Thanks

Subject: [ruby-gnome2-devel-en] question about modal window
Date: gio 17 nov 11 12:54:30 +0800

Quoting hendra kusuma ([email protected]):

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

  •     Se la Strada e la sua Virtu' non fossero state messe da 
    

parte,

  • K * Carlo E. Prelz - [email protected] che bisogno ci
    sarebbe
    •           di parlare tanto di amore e di rettitudine? 
      

(Chuang-Tzu)

On Thu, Nov 17, 2011 at 2:41 PM, Carlo E. Prelz [email protected]
wrote:

problem is close method doesn’t work if the child window is closed by

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs