Shoes: Reopening Window if Necessary

In my shoes app, I have a situation like this: There is a separate
window that displays special data. Certain buttons call a function which
should do the following:

  • Create the window if it has not been created yet
  • Replace the contents of the window (without closing it) if the window
    has already been created
  • Recreate the window if it has been closed after being created

So far, I have something like so:

def set_region_view(region)
# window never created before
if @region_view_window == nil
@region_view_window = window :width => 200, :height => 200 do
para region
end
# window created already, so contents replaced
else
@region_view_window.app do
clear
para region
end
end
end

But this code cannot recreate the window if it has been closed by the
user. Conceptually this seems very simple to implement, but I can not
tell from the Shoes manual what commands I could use to do it. Please
advise.

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