# How can I make an FXRuby window stay open for a set amount o

**URL:** <https://www.ruby-forum.com/t/how-can-i-make-an-fxruby-window-stay-open-for-a-set-amount-o/87757>\
**Category:** Ruby\
**Created:** [March 5, 2007, 7:27pm UTC](https://www.ruby-forum.com/t/how-can-i-make-an-fxruby-window-stay-open-for-a-set-amount-o/87757 "2007-03-05T19:27:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [March 5, 2007, 7:27pm UTC](https://www.ruby-forum.com/t/how-can-i-make-an-fxruby-window-stay-open-for-a-set-amount-o/87757/1 "2007-03-05T19:27:31Z")

</div>

I wrote a simple FXRuby program that displays a message in a window on  
the desktop. I would like to make this window go away after a set  
amount of time (e.g. 30 minutes if left alone).

I’m new to scripting in Ruby, so I don’t know how to do this. Can  
anyone offer me any suggestions or pointers as to how I can implement  
a configurable timer that will automatically shut down the window when  
the time is up?

My program is similar to one of the ‘hello’ examples on the FXRuby  
examples page:  
[http://www.fxruby.org/doc/examples.html](http://www.fxruby.org/doc/examples.html)

I’ve browsed through the Programming Ruby book but I didn’t see any  
default classes or methods that would help me do this.

---

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [March 5, 2007, 8:05pm UTC](https://www.ruby-forum.com/t/how-can-i-make-an-fxruby-window-stay-open-for-a-set-amount-o/87757/2 "2007-03-05T20:05:36Z")

</div>

On 3/5/07, Paul [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I wrote a simple FXRuby program that displays a message in a window on  
> the desktop. I would like to make this window go away after a set  
> amount of time (e.g. 30 minutes if left alone).
> 
> I’m new to scripting in Ruby, so I don’t know how to do this. Can  
> anyone offer me any suggestions or pointers as to how I can implement  
> a configurable timer that will automatically shut down the window when  
> the time is up?

Look at the documentation for the addTimeout() method:

```
http://www.fxruby.org/doc/api/classes/Fox/FXApp.html

```

Hope this helps,

Lyle

P.S. Please consider subscribing to the fxruby-users mailing list, and  
posting FXRuby-related questions there instead of on ruby-talk. For  
more information about the fxruby-users mailing list, see this page:

```
http://rubyforge.org/mailman/listinfo/fxruby-users

```

---

<div class="post-metadata">

**Author:** ![paul](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@paul](https://www.ruby-forum.com/u/paul)\
**Post date:** [March 5, 2007, 10:20pm UTC](https://www.ruby-forum.com/t/how-can-i-make-an-fxruby-window-stay-open-for-a-set-amount-o/87757/3 "2007-03-05T22:20:59Z")

</div>

On Mar 5, 2:05 pm, “Lyle J.” wrote:

> Look at the documentation for the addTimeout() method:  
> [snip]
> 
> P.S. Please consider subscribing to the fxruby-users mailing list, and  
> posting FXRuby-related questions there instead of on ruby-talk. For  
> more information about the fxruby-users mailing list, see this page:
> 
> [http://rubyforge.org/mailman/listinfo/fxruby-users](http://rubyforge.org/mailman/listinfo/fxruby-users)

Thanks for the link and the mailing list reference, Lyle. I didn’t  
know about either of those.  
That should really help.

Cheers! Paul. =)
