# Updates to VisualRuby v 1.0.12 released

**URL:** <https://www.ruby-forum.com/t/updates-to-visualruby-v-1-0-12-released/238001>\
**Category:** Ruby-Gnome 2\
**Created:** [December 11, 2013, 7:40am UTC](https://www.ruby-forum.com/t/updates-to-visualruby-v-1-0-12-released/238001 "2013-12-11T07:40:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [December 11, 2013, 7:40am UTC](https://www.ruby-forum.com/t/updates-to-visualruby-v-1-0-12-released/238001/1 "2013-12-11T07:40:43Z")

</div>

Hi y’all:

I’ve had some time lately, so I’ve been working on a new version of  
visualruby. I just pushed ver1.0.12. I’ve made a few great improvements  
that simplify things even further.

Now, there is a #show() method that  
gets included in all GUI objects, so you don’t have to manually write  
code to include the glade file, or set any variables. Its all done  
automatically.

Here’s an example of the “old” way and the “new” way:

OLD WAY:

class MyClass

include GladeGUI

def show()  
@button1 = “Hello World”  
@label1 = “Me too”  
load\_glade( **FILE** )  
set\_glade\_all()  
show\_window()  
end

def button1\_\_clicked(\*args)  
@builder[“button1”].label = “Goodbye”  
end

end

MyClass.new.show()

AND HERE’s THE NEW WAY:

class MyClass

include GladeGUI

def before\_show()  
@button1 = “Hello World”  
@label1 = “Me too”  
end

def button1\_\_clicked(\*args)  
@builder[“button1”].label = “Goodbye”  
end

end

MyClass.new.show() (or show(self) self = parent window

So, now you don’t need to use these methods:  
load\_glade( **FILE** )  
set\_glade\_all()  
show\_window()  
set\_parent()

All of this is done automatically in the #show() method. There is also  
a #before\_show() method that runs immediately before the window is  
shown, so you can update things there.

However, this is all backwards compatible, so any previous code should  
work fine.

Other improvements:

1. there are global settings now
2. There is an easier way to create a project: File -\> New Project
3. All of the examples have been updated. go to  
Help -\> Install Examples  
to overwrite your examples. Also, a treeview example has been added.
4. It is now Ruby 2.0.0 compatible.

Go to Help-\>install Examples and see the smaller files.

I will be trying to update the docs on the website

Please report any issues.

Thanks,  
Eric

---

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 11, 2013, 6:35pm UTC](https://www.ruby-forum.com/t/updates-to-visualruby-v-1-0-12-released/238001/2 "2013-12-11T18:35:32Z")

</div>

Seems there is a bug in the load\_glade in 1.0.12. Specifically in  
my\_class\_file\_path. THis may be a windows only problem?  
A path with C:xxx/yyy etc trips up the code.  
If I change the line -\> caller\_path\_to\_class\_file, =  
caller[0].partition(":")  
TO-\> x,y,z = caller[0].partition(":")  
-\> caller\_path\_to\_class\_file = x + y + z

I can make VR Load again.  
Not sure how you’d want to fix this. and I havn’t tried anything more  
than loading VR

---

<div class="post-metadata">

**Author:** ![ericrchr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/8baadc/32.png) [@ericrchr](https://www.ruby-forum.com/u/ericrchr)\
**Post date:** [December 11, 2013, 9:07pm UTC](https://www.ruby-forum.com/t/updates-to-visualruby-v-1-0-12-released/238001/3 "2013-12-11T21:07:56Z")

</div>

Hi Greg:

Yep, you’re right. The colon in C:\path broke my code in windows.

Its fixed now. I just pushed v 1.0.13 of vr and vrlib. just do this:

gem install visualruby

Thanks for your help. Let me know how if it works.

Eric
