Updates to VisualRuby v 1.0.12 released

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

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

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

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