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:
- there are global settings now
- There is an easier way to create a project: File -> New Project
- All of the examples have been updated. go to
Help -> Install Examples
to overwrite your examples. Also, a treeview example has been added. - 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