# Gtk Dialog window hangs around

**URL:** <https://www.ruby-forum.com/t/gtk-dialog-window-hangs-around/64198>\
**Category:** Ruby\
**Created:** [June 23, 2006, 12:12am UTC](https://www.ruby-forum.com/t/gtk-dialog-window-hangs-around/64198 "2006-06-23T00:12:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farrel\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9d8465/32.png) [@Farrel\_L](https://www.ruby-forum.com/u/Farrel_L)\
**Post date:** [June 23, 2006, 12:12am UTC](https://www.ruby-forum.com/t/gtk-dialog-window-hangs-around/64198/1 "2006-06-23T00:12:41Z")

</div>

Hi Folks,

I’m doing a project that makes quite a bit of use of Gtk::Dialogs.  
They are not called from within a parent window, just from within a  
normal Ruby app like so:

```
  self.check(options)
  Gtk.init
  self.build(options)
  dialog = Gtk::MessageDialog.new(
    nil,
    Gtk::Dialog::MODAL,
    options[:type],
    options[:buttons],
    options[:text].to_s)
  options[:title] ? dialog.set_title(options[:title]) : nil
  dialog.signal_connect("delete_event"){Gtk.main_quit}

  result = nil
  dialog.run do |response|
    case response
    when Gtk::Dialog::RESPONSE_OK:
      result = true
    when Gtk::Dialog::RESPONSE_CANCEL:
      result = false
    end
  end
  dialog.destroy
  return result

```

The problem I am having is that the window containing the dialog does  
not disappear after the dialog.run call is finished. It becomes a  
blank grey square and if you close it with the window manager it kills  
the entire process. Is it not possible to use Gtk::Dialog nicely  
outside of a pre-existing Gtk window?

Thanks,  
Farrel

---

<div class="post-metadata">

**Author:** ![Farrel\_L](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9d8465/32.png) [@Farrel\_L](https://www.ruby-forum.com/u/Farrel_L)\
**Post date:** [June 23, 2006, 12:46am UTC](https://www.ruby-forum.com/t/gtk-dialog-window-hangs-around/64198/2 "2006-06-23T00:46:25Z")

</div>

> ```
> dialog.signal_connect("delete_event"){Gtk.main_quit}
> 
> ```

Ignore this line it’s been taken out but the blank window is still  
persisting…
