Tried to encapsulate what you want to put in the eventhandler in an anonymous function?
And I don't know how that works in Clojure-CLR, but you might need proxy... 2010/2/24 adam11235 <[email protected]>: > Hi, > > I've made progress in creating a simple app to show a windows form, > however I am having trouble wiring up a delegate (to handle button > clicks). > > The Java version uses Proxy to implement ActionListener, instead I am > just trying to create an EventHandler passing as the 2nd constructor > argument the code I would like executed. (see the .add_Click line) > > The delegate code gets invoked immediately instead of when the button > click occurs, and then complains it expected a function pointer rather > than the DialogResult it received (due to execution of the code) > > I tried quoting that code but no success. > > How do you wire up delegates? > > (import '(System.Windows.Forms MessageBox Form Button)) > > (defn windowsPlay [] > (let > [ win (Form.) > temp-button (Button.) > ] > (.. win (get_Controls) (Add temp-button)) > (doto temp-button > (.set_Top 50) > (.set_Text "Clicky") > (.add_Click (EventHandler. temp-button (MessageBox/Show "I got > clicked")))) > (doto win > (.set_Text "hello") > (.ShowDialog)))) > > (windowsPlay) > > Thanks, Adam. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- Communication is essential. So we need decent tools when communication is lacking, when language capability is hard to acquire... - http://esperanto.net - http://esperanto-jongeren.nl Linux-user #496644 (http://counter.li.org) - first touch of linux in 2004 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
