Hi,
> I think it looks very nice. It’s a shame that you have to resort to direct
> lambda’s since you can’t pass two lambda’s in, but otherwise it’s a nice
> visual representation of the menu, in code.
>
thanks for the feedback, appreciated!
I just realised that I can also use this (without modifying the
implementation):
item("&PowerBlade").click { MessageBox.Show("Powerblades are
amazing...") }
instead of
item("&PowerBlade", lambda { MessageBox.Show("Powerblades are
amazing...") }
same effect, slightly more readable though.
cheers, and I shall move on to long running operations.
-- Thibaut
>
>
> JD
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Thibaut Barrère
> *Sent:* Thursday, February 26, 2009 2:26 PM
> *To:* ironruby-core
> *Subject:* [Ironruby-core] A tiny DSL to build Windows::Forms menus from
> IronRuby - review wanted
>
>
>
> Hi,
>
>
>
> I started working on UI bits, both for Ivan book and because my customers
> are interested (and well - because it's fun, too!). First topic is how to
> build menus more easily (next one will be long running operations and how to
> sugar them).
>
>
>
> I'd be interested to get your opinion on both the DSL syntax (below for
> quick read or
> here<http://github.com/thbar/ironruby-labs/blob/66b45fd6f13d2b3c8aa8021ee3f58303a9bb7eae/ui/003_dsl_menu.rb>
> on
> github) and the
> implementation<http://github.com/thbar/ironruby-labs/blob/66b45fd6f13d2b3c8aa8021ee3f58303a9bb7eae/ui/menu_builder.rb>
> .
>
>
>
> form.menu = MainMenu.build do
> item("&File") {
> item("&New") {
> item("Spreadsheet")
> item("Document")
> }
> item "&Quit", lambda { Application.Exit }
> }
> item("&Tools") {
>
> item "&PowerBlade", lambda { MessageBox.Show("Powerblades are amazing...") }
> item "&Scissors"
> }
> end
>
>
>
> what do you think ?
>
>
>
> cheers,
>
>
>
> Thibaut Barrère
>
> --
> LoGeek
> [blog] http://evolvingworker.com - tools for a better day
> [blog] http://blog.logeek.fr - about writing software
>
> _______________________________________________
> Ironruby-core mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core