Re: Headers and referencing pre defined objects.
Re: Headers and referencing pre defined objects.
- Subject: Re: Headers and referencing pre defined objects.
- From: Matt Neuburg <email@hidden>
- Date: Thu, 09 Mar 2006 10:50:04 -0800
- Thread-topic: Headers and referencing pre defined objects.
On Thu, 9 Mar 2006 17:47:07 +1300, Kevin Bracey <email@hidden> said:
>What I'm trying to achieve is that when the User clicks on a row/s in a
>tableview, the text in the textFeild changes and other rows in a
>different TableView get selected.
>In the TableView delegate I'm getting it's NSIndexSet after it's been
>clicked, this is all going well.
>
>Passing this back to the MyDocument is the headscratch:-) I started off
>using Notifications, but found that when you have more than 1 document
>open every Document got the message.
>
>Then I thought I would reference the document, (not actual code but you
>get the idea) [[[[aNotification object] window] document]
>updateOtherControls:myIndexSet].
>
>Then I thought I'd go via the sharedController] currentDocument]
>updateOtherControls:myIndexSet]
>
>Then I thought why not just pass the MyDocument to the Delegate and be
>done with it.
>[myTableViewDelegate setMyDocument:self]
>[holdMyDocument updateOtherControls:myIndexSet]
>
>#import "MyDocument.h" in "MyTableViewDelegate .h" while it is also in
>"MyDocument.h" seems to cause a circular header problem. You can see
>I'm not a C programmer:-)
>
>So I'm looking for 2 clues, firstly the correct way to get a control
>delegate to update other Controls on the same window.
I'm not entirely clear on what the difficulty is here; the fact that you
find this confusing suggests that you may have designed your architecture
upside down or something.
In a document-based app, the document either is or has a window controller.
The purpose of the window controller is to regulate the window interface. So
it should receive the information that something has changed in the window
and make further desired changes in response. The window controller should
have outlets to any interface in its window that it might need.
So for example in my app the window controller is the delegate of the first
table view. Thus it receives tableViewSelectionDidChange. Thus it can tell
the second table view what to do in response.
There is none of this "passing" and "referencing" and "importing" that you
seem so flummoxed over. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden