# Shoes: Reopening Window if Necessary

**URL:** <https://www.ruby-forum.com/t/shoes-reopening-window-if-necessary/192615>\
**Category:** Ruby\
**Created:** [August 3, 2010, 7:31am UTC](https://www.ruby-forum.com/t/shoes-reopening-window-if-necessary/192615 "2010-08-03T07:31:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![callyworld](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@callyworld](https://www.ruby-forum.com/u/callyworld)\
**Post date:** [August 3, 2010, 7:31am UTC](https://www.ruby-forum.com/t/shoes-reopening-window-if-necessary/192615/1 "2010-08-03T07:31:42Z")

</div>

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.
