Anvil is growing rapidly and keeps getting cooler everyday! It now has support for MVC architecture (models are missing right now, but will be implemented soon) and it boasts a cool new way to shuffle away some of the code in your application view to other views like partials in rails. From the example I posted in the
previous post, you can now do:
app/views/application.rb
1
2
3
|
anvil "Hammer" do |app|
app.frame "Hamr", :render => 'hamr', :title => "Hamr", :maximize => true
end
|
app/views/frames/hamr_frame.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# Create Menu Bar
frame.menu_bar "Main" do |menu_bar|
menu_bar.menu "&File", :render => 'file'
menu_bar.menu "&Edit", :render => 'edit'
menu_bar.menu "&Search", :render => 'search'
menu_bar.menu "&Help", :render => 'help'
end
frame.text_control "Editor",
:size => { :width => 100, :height => 200 },
:style => [ :multiline, :rich, :rich2 ]
frame.create_status_bar(2)
frame.set_status_text("Hamr World!", 0)
|
app/views/menus/file_menu.rb
1
2
3
4
5
6
7
8
9
10
|
item.add(:new)
item.add(:open)
item.separator
item.add(:save)
item.separator
item.add(:preview)
item.add(:print)
item.separator
item.add(:close)
item.add(:quit)
|
This new way makes your code much neater. Support for putting all of the code into your application.rb file is still there, but having the ability to shuffle it away is very nice. Anyway, check out the projects:
anvil.rubyforge.org and
hamr.rubyforge.org.
Sorry, comments are closed for this article.