[MacRuby-devel] What's the best way to implement a delegate/action with multiple parameters?

Michael Winterstein parzival at mindspring.com
Sat Nov 22 09:38:50 PST 2008


>
> Date: Fri, 21 Nov 2008 15:43:38 -0500
> From: Benjamin Stiglitz <ben at tanjero.com>
> Subject: Re: [MacRuby-devel] What's the best way to implement a
> 	delegate/action with multiple parameters?
> To: "MacRuby development discussions."
> 	<macruby-devel at lists.macosforge.org>
> Message-ID: <49459A0D-1E87-4AE8-8709-3505B2C5173E at tanjero.com>
> Content-Type: text/plain; charset=WINDOWS-1252; format=flowed;
> 	delsp=yes
>
>> I'm pretty new to Cocoa, so maybe I'm overlooking the obvious here.
>> I just want to make sure I'm not doing more work than necessary.
>>
>> I'd like to be able to control the minimum size for a NSSplitView.
>> As I understand it, I need to have a delegate with a method that can
>> handle
>> splitView:constrainMaxCoordinate:ofSubviewAt:
>>
>> So far that isn't supported using Interface Builder, is it?
>>
>> If I need to do it 'manually'  - do I get a reference to the
>> NSSplitView, and then tell it to set its delegate to something that
>> responds to the method?  When/where should I do this - in the Window
>> Controller's AwakeFromNib or some other place?
>
> You can set the delegate in Interface Builder by ctrl-clicking from
> the split view to the delegate object and clicking ?delegate? in the
> resulting HUD popup. Then just implement that method on your delegate
> object.
>
> If you haven?t already, be sure to check out the Delegates and Data
> Sources guide at:
> <http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html
>>
>
> -Ben
>


Thanks.  For some reason I was thinking of it backwards - trying to  
connect it up from my delegate to the SplitView, which doesn't make a  
whole lot of sense really.  I also got it confused with actions.   
Wired it up and it works.

-Michael


More information about the MacRuby-devel mailing list