Re: NSForm from NSFormCell
Re: NSForm from NSFormCell
- Subject: Re: NSForm from NSFormCell
- From: "Ken Ferry" <email@hidden>
- Date: Fri, 8 Aug 2008 12:01:13 -0700
Actually, NSCell has a -controlView method that returns the control
last used to draw the cell.
Use of this property can be somewhat error prone, though, for the
reasons Amin describes. Certainly make sure that the control responds
to the message you intend to send before dispatching it.
-Ken
Cocoa Frameworks
On Fri, Aug 8, 2008 at 11:51 AM, Negm-Awad Amin <email@hidden> wrote:
>
> Am Fr,08.08.2008 um 20:22 schrieb Kurt Sutter:
>
>> I have a series of NSFormCell objects in an NSForm.
>>
>> Given the NSFormCell object, is there a way to get the corresponding
>> NSForm object?
>>
>> More specifically: I have added an class extension to NSFormCell, which
>> does some operations on the form cell. One of the operations requires the
>> method to select the form cell, and the method would therefore like to call
>> selectTextAtIndex of the owning NSForm. However, all I have is "self" of the
>> NSFormCell, and I have no clue how to obtain the NSForm object therefrom.
>>
>> Any advice?
>
> 1. Probably you have to change a part of your design. Cells are like stamps
> or templates for drawing and user events. "Belonging" is a term, which is a
> littlebit strange for a cell. This is the reason for passing the concrete
> view as a argument to several messages, i. e. -drawWithFrame:inView:. Of
> course, any cell belongs to a view (control) in reality, but not by
> structure.
>
> 2. However you can add a property to the cell (you have a subclass) and set
> it in a subclass of NSFormCell or from outside. As said, this is not the
> intended structure.
>
> 3. I've seen – do not ask me where, pls – that some people remember the view
> through the last -drawWithFrame:inView: message. IMHO this is worse.
>
> Amin
>>
>>
>> Kurt
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> Amin Negm-Awad
> email@hidden
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden