[MacRuby-devel] handlers and carets
Laurent Sansonetti
lsansonetti at apple.com
Fri May 6 17:58:38 PDT 2011
Hi Pavlos,
You simply pass a Proc object.
handler = Proc.new do |result|
if result == …
...
end
oPanel.beginSheetModalForWindow self.window, completionHandler: handler
Make sure you installed the latest BridgeSupport preview before, available from http://www.macruby.org/files.
Laurent
On May 6, 2011, at 5:38 PM, Pavlos Vinieratos wrote:
> hello. how can I write this in macruby?
> [oPanel beginSheetModalForWindow:[self window]
>
> completionHandler:^(NSInteger result) {
>
> if (result == NSFileHandlingPanelOKButton) {
>
> for (NSURL *fileURL in [oPanel URLs]) {
>
> // do something with fileURL
>
> }
>
> }
>
> }];
>
> the second arg is a handler..
>
> thank you
>
> --
> Pavlos Vinieratos
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110506/99bdf48a/attachment-0001.html>
More information about the MacRuby-devel
mailing list