Thibaut Barrère
2009-Feb-26 22:25 UTC
[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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090226/443936c2/attachment.html>
Jim Deville
2009-Feb-26 23:32 UTC
[Ironruby-core] A tiny DSL to build Windows::Forms menus from IronRuby - review wanted
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. JD From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090226/c1f6c922/attachment.html>
Thibaut Barrère
2009-Feb-27 19:54 UTC
[Ironruby-core] A tiny DSL to build Windows::Forms menus from IronRuby - review wanted
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:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *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 > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090227/564fd491/attachment.html>
Thibaut Barrère
2009-Feb-27 22:45 UTC
[Ironruby-core] A tiny DSL to build Windows::Forms menus from IronRuby - review wanted
After chatting with Ivan, I created some code to build Forms too: form = Magic.build do form(:text => "Hello") do flow_layout_panel(:dock => DockStyle.fill) do button(:text => "Click me!", :click => lambda { MessageBox.Show("Hello") }) button(:text => "Quit", :click => lambda { Application.Exit }) end end end * * I use method_missing and transform the method name from flow_layout_panel to FlowLayoutPanel class etc. After using these a bit, I''m pretty sure we''ll end up with some community project sharing that kind of stuff, at some point. Nb: I hope it''s not OT for the core list - or is it time to create a user group ? cheers, -- Thibaut On Fri, Feb 27, 2009 at 8:54 PM, Thibaut Barr?re <thibaut.barrere at gmail.com>wrote:> 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:* ironruby-core-bounces at rubyforge.org [mailto: >> ironruby-core-bounces at rubyforge.org] *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 >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090227/43d9252c/attachment-0001.html>
Jimmy Schementi
2009-Feb-27 22:48 UTC
[Ironruby-core] A tiny DSL to build Windows::Forms menus from IronRuby - review wanted
Awesome stuff! If you make this into its own github project, I can add it to http://github.com/ironruby/ironruby-contrib as a submodule. That''ll force me to keep it updated =) From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Thibaut Barr?re Sent: Friday, February 27, 2009 2:46 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] A tiny DSL to build Windows::Forms menus from IronRuby - review wanted After chatting with Ivan, I created some code to build Forms too: form = Magic.build do form(:text => "Hello") do flow_layout_panel(:dock => DockStyle.fill) do button(:text => "Click me!", :click => lambda { MessageBox.Show("Hello") }) button(:text => "Quit", :click => lambda { Application.Exit }) end end end I use method_missing and transform the method name from flow_layout_panel to FlowLayoutPanel class etc. After using these a bit, I''m pretty sure we''ll end up with some community project sharing that kind of stuff, at some point. Nb: I hope it''s not OT for the core list - or is it time to create a user group ? cheers, -- Thibaut On Fri, Feb 27, 2009 at 8:54 PM, Thibaut Barr?re <thibaut.barrere at gmail.com<mailto:thibaut.barrere at gmail.com>> wrote: 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: ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org> [mailto:ironruby-core-bounces at rubyforge.org<mailto:ironruby-core-bounces at rubyforge.org>] 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 Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org> http://rubyforge.org/mailman/listinfo/ironruby-core -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090227/5172f20b/attachment.html>
Thibaut Barrère
2009-Feb-28 10:21 UTC
[Ironruby-core] A tiny DSL to build Windows::Forms menus from IronRuby - review wanted
Hi Jimmy,> Awesome stuff! If you make this into its own github project, I can add it > to http://github.com/ironruby/ironruby-contrib as a submodule. That?ll > force me to keep it updated =) >glad you like it! I''ll definitely extract it to a separate github project later on - I''ll ping you when I do so. -- Thibaut> > > *From:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *On Behalf Of *Thibaut Barr?re > *Sent:* Friday, February 27, 2009 2:46 PM > *To:* ironruby-core at rubyforge.org > *Subject:* Re: [Ironruby-core] A tiny DSL to build Windows::Forms menus > from IronRuby - review wanted > > > > After chatting with Ivan, I created some code to build Forms too: > > > > > > form *=* Magic*.*build *do* > > > > form(:text *=>* "Hello") *do* > > > > flow_layout_panel(:dock *=>* DockStyle*.*fill) *do* > > > > button(:text *=>* "Click me!", :click *=>* lambda { MessageBox*.*Show("Hello") }) > > > > button(:text *=>* "Quit", :click *=>* lambda { Application*.*Exit }) > > > > *end* > > > > *end* > > > > *end* > > > > > > > > I use method_missing and transform the method name from flow_layout_panel > to FlowLayoutPanel class etc. > > > > After using these a bit, I''m pretty sure we''ll end up with some community > project sharing that kind of stuff, at some point. > > > > Nb: I hope it''s not OT for the core list - or is it time to create a user > group ? > > > > cheers, > > > > -- Thibaut > > > > On Fri, Feb 27, 2009 at 8:54 PM, Thibaut Barr?re < > thibaut.barrere at gmail.com> wrote: > > 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:* ironruby-core-bounces at rubyforge.org [mailto: > ironruby-core-bounces at rubyforge.org] *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 > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090228/ea692f76/attachment-0001.html>
Thibaut Barrère
2009-Mar-04 09:00 UTC
[Ironruby-core] A tiny DSL to build Windows::Forms menus from IronRuby - review wanted
Hi Jimmy et al,>> Awesome stuff! If you make this into its own github project, I can add it to >> http://github.com/ironruby/ironruby-contrib as a submodule. That?ll force me >> to keep it updated =)> glad you like it! I''ll definitely extract it to a separate github project later on - I''ll ping you when I do so.not sure if my annoucement was clear - the separate project is now available. It''s called Magic: http://github.com/thbar/magic/tree/master At the end I realize the syntax is totally shooesesque (http://shoooes.net/). I''m in the process of evolving it so that it works well with WPF and Silverlight (and QuickGraph, too). cheers, -- Thibaut> > > > From: ironruby-core-bounces at rubyforge.org > [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Thibaut Barr?re > Sent: Friday, February 27, 2009 2:46 PM > To: ironruby-core at rubyforge.org > Subject: Re: [Ironruby-core] A tiny DSL to build Windows::Forms menus from > IronRuby - review wanted > > > > After chatting with Ivan, I created some code to build Forms too: > > > > > > form = Magic.build do > > > > ??form(:text => "Hello") do > > > > ????flow_layout_panel(:dock => DockStyle.fill) do > > > > ??????button(:text => "Click me!", :click => lambda { > MessageBox.Show("Hello") }) > > > > ??????button(:text => "Quit", :click => lambda { Application.Exit }) > > > > ????end > > > > ??end > > > > end > > > > > > > > I use method_missing and transform the method name from flow_layout_panel to > FlowLayoutPanel class etc. > > > > After using these a bit, I''m pretty sure we''ll end up with some community > project sharing that kind of stuff, at some point. > > > > Nb: I hope it''s not OT for the core list - or is it time to create a user > group ? > > > > cheers, > > > > -- Thibaut > > > > On Fri, Feb 27, 2009 at 8:54 PM, Thibaut Barr?re <thibaut.barrere at gmail.com> > wrote: > > 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: ironruby-core-bounces at rubyforge.org > [mailto:ironruby-core-bounces at rubyforge.org] 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?on github) and the implementation. > > > > 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 > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > > > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >