[MacRuby-devel] Obj-C translation

Brad Wilson brad at lucky-dip.net
Fri Apr 3 01:20:36 PDT 2009

I think you've translated that a little wrong. This is untested, but  
I'd suggest trying:

def webView(sender, didReceiveTitle:title, forFrame:frame)

Does that sound right to anybody else? The method name should be the  
bit after the first ), and before the first :. Everything after that  
are args.

Which means you can end up with ruby methods that look like they have  
the same name, but work because of the named args. Stuff like:
def webView(sender, didFinishLoading:frame)
(and any other Webview notifications.)

For what it's worth, I found Hillegass' Cocoa Programming for OSX book  
a big help for learning Cocoa andMacruby at the same time.

On 03/04/2009, at 7:11 PM, Frisco Del Rosario wrote:

> On Thu, Apr 2, 2009 at 1:11 PM , John Shea wrote:
> > if you look about a quarter of the way down this page ( the  
> introductory tutorial)
> > http://www.macruby.org/documentation/tutorial.html you will see it  
> all explained.
> I'd rtfm, but comprehended none of it, it seems.
> > In this case:
> > - (BOOL)windowShouldZoom:(NSWindow *)window toFrame: 
> (NSRect)proposedFrame
> > could become:
> > windowShouldZoom(window,  toFrame:proposedFrame)
> Got it! Now moving on to this delegate method — in Cocoa Programming  
> Quick Start, Daniel H. Steinberg gives:
> - (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title  
> forFrame:(WebFrame *)frame {
> [[sender window] setTitle:title];
> }
> Which I  translated as:
> def didReceiveTitle(title, forFrame:frame)
>      sender.window(setTitle:title)
> end
> That should be correct. But what might be the cause for the delegate  
> method never to be triggered? (That is, the window title never  
> changes.)
> Thank y'all for your help, and for putting up with an old dog trying  
> to learn new stuff.
> _______________________________________________
> 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/20090403/31386c76/attachment-0001.html>

More information about the MacRuby-devel mailing list