Am Fr,08.08.2008 um 21:01 schrieb Ken Ferry:

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.
Thank you for making my mail precise!

Of course, I read this in the documentation. :-)

NSActionCell overwrites -controlView, which in its base version (NSCell) simply returns nil. NSFormCell is a subclass of NSActionCell. So you can use it on your own risk.

Amin


-Ken
Cocoa Frameworks

On Fri, Aug 8, 2008 at 11:51 AM, Negm-Awad Amin <[EMAIL PROTECTED] > 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]

Amin Negm-Awad
[EMAIL PROTECTED]




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[EMAIL PROTECTED]




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to