# Vruby question

**URL:** <https://www.ruby-forum.com/t/vruby-question/70436>\
**Category:** Ruby\
**Created:** [September 29, 2006, 5:12am UTC](https://www.ruby-forum.com/t/vruby-question/70436 "2006-09-29T05:12:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esad\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@Esad\_H](https://www.ruby-forum.com/u/Esad_H)\
**Post date:** [September 29, 2006, 5:12am UTC](https://www.ruby-forum.com/t/vruby-question/70436/1 "2006-09-29T05:12:58Z")

</div>

Hi!

In the following code ([Parked at Loopia](http://pastie.caboo.se/15426)), the Dialog returns  
the value (:test) the first time, but after the form B has been closed,  
and created again, it returns 0. Any idea why? Am I doing something  
wrong or is this bug in vruby/swin? If I use hide instead of close,  
everything works well.

Esad

---

<div class="post-metadata">

**Author:** ![Esad\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@Esad\_H](https://www.ruby-forum.com/u/Esad_H)\
**Post date:** [September 29, 2006, 5:47pm UTC](https://www.ruby-forum.com/t/vruby-question/70436/2 "2006-09-29T17:47:05Z")

</div>

On Fri, 29 Sep 2006 05:03:36 +0200, Esad H. wrote:

> Hi!
> 
> In the following code ([Parked at Loopia](http://pastie.caboo.se/15426)), the Dialog returns  
> the value (:test) the first time, but after the form B has been closed,  
> and created again, it returns 0. Any idea why? Am I doing something  
> wrong or is this bug in vruby/swin? If I use hide instead of close,  
> everything works well.
> 
> Esad

I have used vruby and other GUI frameworks only sparingly and years ago,  
but they usually differentiate between creating a window and displaying  
it on screen.

So I’d guess that closing (as in “I don’t need this anymore”) a window  
might free system resources and leave you with a reference to something  
invalid.

If you hde the window (as in “I might need it later”) ruby keeps the  
system resources around and the second use of b is fine.

Then again, I really don’t know what I’m talking about 🙂

Have fun,  
s.

---

<div class="post-metadata">

**Author:** ![Esad\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@Esad\_H](https://www.ruby-forum.com/u/Esad_H)\
**Post date:** [September 29, 2006, 9:31pm UTC](https://www.ruby-forum.com/t/vruby-question/70436/3 "2006-09-29T21:31:35Z")

</div>

Hi!

Stefan S. wrote:

> I have used vruby and other GUI frameworks only sparingly and years ago,  
> but they usually differentiate between creating a window and displaying  
> it on screen.

The problem with the form is that after you show it, you should enter  
the messageloop, and in case of dialog vruby does that for you (it enter  
the messageloop after the dialog is closed and then returns a value).

I simply added something like this (after form creation)

Thread.new { VRLocalScreen.messageloop }

which createas a messageloop for the form in background, this thread  
dies after the form has been closed.

It worked!

I feel vruby has a great potential, it is too pity it so chaotic and  
undocumented. If I could find few more people, I’d be willing to spend  
some time creating english documentation, cleaning up the sources,  
applying patches, starting a mailing list, a nice english webpage etc.

Esad

---

<div class="post-metadata">

**Author:** ![Esad\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@Esad\_H](https://www.ruby-forum.com/u/Esad_H)\
**Post date:** [September 30, 2006, 12:03am UTC](https://www.ruby-forum.com/t/vruby-question/70436/4 "2006-09-30T00:03:50Z")

</div>

On Saturday, September 30, 2006, at 4:30 AM, Esad H. wrote:

> the messageloop after the dialog is closed and then returns a value).  
> I feel vruby has a great potential, it is too pity it so chaotic and  
> undocumented. If I could find few more people, I’d be willing to spend  
> some time creating english documentation, cleaning up the sources,  
> applying patches, starting a mailing list, a nice english webpage etc.
> 
> Esad

You might want to check out VRTools to see about the holes in VRuby that  
it fills (gem install VRTools).

- Supports Tabbing in forms
- Allows creation of forms and dialogs using a similar mechanism
- Adds support for right click menus
- Adds a layout manager for VRuby forms
- Allows test first to be used on a form

Steve T.
