Re: NSTreeController and insertObject:atArrangedObjectIndexPath:

2010-06-19 Thread Michael Babin
On Jun 18, 2010, at 5:53 PM, Tony Romano wrote:

 Scenario:  Adding a new node to a NSOutlineView backed by a NSTreeController.
 
 1. Create a new internal object add add it to the data store(file system).  
 This will be my representedObject in the treecontroller
 2. Compute the path and call insertObject:atArrangedObjectIndexPath:
 
 the treecontroller does 2 things during the call to insertObject:
 
 1. It calls my getter, children, and asks me for all the children under the 
 parent node I have added the new node to.  I give it the list INCLUDING the 
 newly created node since it is now in the store.
 2. Then it calls the setter, setChildren,  and gives me the newChildren list. 
  Which now has an additional copy of the new node, one from the getter call 
 and one from the insertAt call. I know this for a fact because I purposely 
 added some data to the newly created node for the insert to distinguish them.
 
 From the UI, the outlineview is correct, but my internal child list has the 
 extra node.  It's not displayed because the treecontroller optimizes when to 
 ask me for a childlist.  I have a work around which I don't like to basically 
 lock out the getter method and just return the current child list(i.e the 
 previous child list which doesn't have the new node added from the file 
 system).  Anyone experience this before and have a recommendation?

I will qualify this by saying that I don't have much direct experience with 
using NSTreeController.

In this case, it appears that the problem is that you are effectively adding 
the new object twice. Your step 1 adds it directly to your model. If this was 
done in a KVO compliant way, then the NSTreeController should take note of the 
change and update the NSOutlineView for you (making step 2 unnecessary). 
Alternatively, you could add the new object to your model through the 
NSTreeController (your step 2) and omit step 1.

___

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 arch...@mail-archive.com


Re: NSTreeController and insertObject:atArrangedObjectIndexPath:

2010-06-19 Thread Clark S. Cox III
You should only need add your object to your model (which needs to me KVO 
compliant). The tree controller will then notice, in response to the KVO 
notification that a new item was added.

You should rarely, if ever, be direcly adding objects to the controller layer 
like this. 

Sent from my iPhone

On Jun 18, 2010, at 18:53, Tony Romano tony...@hotmail.com wrote:

 Scenario:  Adding a new node to a NSOutlineView backed by a NSTreeController.
 
 1. Create a new internal object add add it to the data store(file system).  
 This will be my representedObject in the treecontroller
 2. Compute the path and call insertObject:atArrangedObjectIndexPath:
 
 the treecontroller does 2 things during the call to insertObject:
 
 1. It calls my getter, children, and asks me for all the children under the 
 parent node I have added the new node to.  I give it the list INCLUDING the 
 newly created node since it is now in the store.
 2. Then it calls the setter, setChildren,  and gives me the newChildren list. 
  Which now has an additional copy of the new node, one from the getter call 
 and one from the insertAt call. I know this for a fact because I purposely 
 added some data to the newly created node for the insert to distinguish them.
 
 From the UI, the outlineview is correct, but my internal child list has the 
 extra node.  It's not displayed because the treecontroller optimizes when to 
 ask me for a childlist.  I have a work around which I don't like to basically 
 lock out the getter method and just return the current child list(i.e the 
 previous child list which doesn't have the new node added from the file 
 system).  Anyone experience this before and have a recommendation?
 
 TIA,
 -Tony
 
 ___
 
 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/clarkcox3%40gmail.com
 
 This email sent to clarkc...@gmail.com
___

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 arch...@mail-archive.com


Re: DnD International No symbol

2010-06-19 Thread John Johnson
 On Wed, Jun 16, 2010 at 7:19 PM, Tony Romano tony...@hotmail.com wrote:
 Hmm...  I'm returning the NSDragOperationNone now, all I get is an image of 
 what is being dragged no other symbol and the outlineview won't accept the 
 drop which is correct.  When I have a valid selection, I get the other 
 symbol for copy(green circle with plus sign), or for Move, the outlineview 
 highlights the drop point.
 
 Right, that's what I would expect. Cocoa doesn't distinguish between
 can't drop and can drop by changing the cursor.

I don't know about that. Consider trying to drag and drop a file onto a 
read-only disk image in the finder... you get the no smoking symbol 
cursor.___

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 arch...@mail-archive.com


NSDatepicker inside a TableViewColumn

2010-06-19 Thread Junio Gonçalves Vitorino
Hello, I'm working on a project that the user should fill columns of a
tableview (that maps to a coredata entity) with dates. After googling I
found some posts saying that is impossible to place a NSDatepicker inside a
TableViewColumn, is that true?

If not, why I can't drag a NSDatepicker to my TableViewColumn in IB? I
should do it programatically?

-- 
Atenciosamente, Cordially

Junio Vitorino
http://www.lamiscela.net
55 31 9901-7499
___

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 arch...@mail-archive.com


[iPhone] Detect touches on MKMapView

2010-06-19 Thread Philip Vallone
Hi, 

Can you detect touches in a MKMapView? if so how? If not, how can I?

Thanks for the help

Phil


___

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 arch...@mail-archive.com


Re: NSTreeController and insertObject:atArrangedObjectIndexPath:

2010-06-19 Thread Tony Romano
Maybe I am missing the big picture here

Something has to change in order to trigger the sequence of events.  The UI is 
the outlineview, the controller is NSTreeController, and the store is the file 
system.  The treecontroller stores objects that I have created to represent 
items in the store.  Through bindings, the treecontroller asks for 2 things, my 
arranged list of items and getter/setter to respond from requests from the 
controller to update a child list.

The scenario this thread is about is the user decides via a context menu to add 
a node. I tried both case where I add the folder to the file system first then 
called insertObject or called insertObject then add the folder to the file 
system.  In both cases, both the setter and the getter are called.  There is no 
direct binding to the filesystem.

 insertObject:atArrangedObjectIndexPath: requires I give it an object and an 
index path. So at a minimum, I have to create a blank node with some pertinent 
data .  The object I created is a single node, not bound to anything at this 
point, just a pointer to a blob.  When I make the call to insertObject, I 
expect two things to happen.  

1. It adds this object to my arrangedObjects and then calls my setter telling 
me, Hey there has been a change, here is the new child list.
2. Add it to the NSOutlineView. since they are bound to each other.

The controller does both of these.  The problem is it ALSO calls the getter on 
the parent node of the indexPath provided and tells me to enumerate this node. 
If I updated the file system prior to calling insertObject, I would enumerate 
it and give the list back to the controller. Then, the insertObject code would 
proceed to add the newly created node, hence added twice in the child list.   
It seems like the controller lost track of the child list for this node and 
requested it again and perhaps this is where the  problem is.  I know for a 
fact it tracks child list otherwise the controller would enumerate the nodes 
every time the user opens a folder that had been previously opened.

I guess the scenario the controller is trying to protect itself from the user 
adding a new node to a child that has not been enumerated(makes perfect sense). 
 In this case the node doesn't not have a child list and it would have to ask 
for it first.  But it shouldn't call the setter in this case. Under all 
conditions it calls both, this is a bug.

Sorry for all the details.
-Tony

On Jun 19, 2010, at 6:22 AM, Clark S. Cox III wrote:

 You should only need add your object to your model (which needs to me KVO 
 compliant). The tree controller will then notice, in response to the KVO 
 notification that a new item was added.
 
 You should rarely, if ever, be direcly adding objects to the controller layer 
 like this. 
 
 Sent from my iPhone
 
 On Jun 18, 2010, at 18:53, Tony Romano tony...@hotmail.com wrote:
 
 Scenario:  Adding a new node to a NSOutlineView backed by a NSTreeController.
 
 1. Create a new internal object add add it to the data store(file system).  
 This will be my representedObject in the treecontroller
 2. Compute the path and call insertObject:atArrangedObjectIndexPath:
 
 the treecontroller does 2 things during the call to insertObject:
 
 1. It calls my getter, children, and asks me for all the children under the 
 parent node I have added the new node to.  I give it the list INCLUDING the 
 newly created node since it is now in the store.
 2. Then it calls the setter, setChildren,  and gives me the newChildren 
 list.  Which now has an additional copy of the new node, one from the getter 
 call and one from the insertAt call. I know this for a fact because I 
 purposely added some data to the newly created node for the insert to 
 distinguish them.
 
 From the UI, the outlineview is correct, but my internal child list has the 
 extra node.  It's not displayed because the treecontroller optimizes when to 
 ask me for a childlist.  I have a work around which I don't like to 
 basically lock out the getter method and just return the current child 
 list(i.e the previous child list which doesn't have the new node added from 
 the file system).  Anyone experience this before and have a recommendation?
 
 TIA,
 -Tony
 
 ___
 
 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/clarkcox3%40gmail.com
 
 This email sent to clarkc...@gmail.com
 

-Tony

___

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:

Re: NSDatepicker inside a TableViewColumn

2010-06-19 Thread jonat...@mugginsoft.com

On 19 Jun 2010, at 19:46, Junio Gonçalves Vitorino wrote:

 Hello, I'm working on a project that the user should fill columns of a
 tableview (that maps to a coredata entity) with dates. After googling I
 found some posts saying that is impossible to place a NSDatepicker inside a
 TableViewColumn, is that true?
 
 If not, why I can't drag a NSDatepicker to my TableViewColumn in IB? I
 should do it programatically?
 
NSDatepicker is not an NSCell subclass so you cannot display it in a table 
column.

I would suggest that you display the formatted date in an NSTextField cell.
The user can click the cell to bring up the NSDatePicker instance in a child 
window.

Child window usage is demonstrated here:
http://mattgemmell.com/files/source/maattachedwindow.zip

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com

___

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 arch...@mail-archive.com


raising NSException between Controllers

2010-06-19 Thread John Love
I am having inconsistent problems when I call from Controller #1 one of 1's 
methods which looks like:

- (void ) exitBgCalculationThread:(int)withStatus {
[controller2 haltBgCalculationThread:withStatus];
}

Controller #2's haltBgCalculationThread:withStatus eventually calls:

itsException = [NSException exceptionWithName:newErrorName
   reason:newErrorReason
 userInfo:nil];
[itsException raise];   // stops here and long jumps to 
try-catch-finally Handler
// within EC's -calculateWorksheetRow:

The call to -raise enters the @catch block of a try-catch-finally Handler 
within Controller #2 (the only such Handler anywhere).  The only statement 
within this @catch block is a call to NSLog.  After this, the NSLog call falls 
thru to the @finally portion which returns the correct error code.  Controller 
#2's calculation for loop immediately exits and through a call-back routine 
sends a message back to Controller #1 which displays the appropriate error 
message in the active window.

The correct error message is displayed; however, in seemingly random instances, 
the above NSLog is never seen.

Whenever, I call Controller #2's -haltBgCalculationThread: from Controller #2, 
everything works dandy; the lack of calling NSLog in random instances occurs 
only when I call Controller #2's -haltBgCalculationThread: from Controller #1.

Maybe?? it is because I am bouncing between separate Controllers and am causing 
mayhem.

Any psychic premonitions would be welcomed.

John Love


___

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 arch...@mail-archive.com


merging NSWindow and NSView controllers

2010-06-19 Thread Shane
I have an applications with two controllers, one inherits
NSWindowController and uses initWithWindowNibName:, and the other
inherits NSViewController and uses initWithNibName:

Yet, other than the init function which uses different *.nib files in
each, the rest of the code in the controller is exactly the same since
it draws the same stuff in each NSView of each NIB file (both of which
are custom views). In one NIB file the NSView is inside an NSWindow,
and in the other NIB it's just an NSView. But each view has the same
graphics contents, so it's pretty much duplicated. If I make changes
to one, I pretty much have to do it to the other as well.

Anyone have ideas on how to merge these?
___

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 arch...@mail-archive.com


Re: merging NSWindow and NSView controllers

2010-06-19 Thread Chris Hanson
What kind of drawing in their NSView do these controllers do right now? 
Perhaps that code should be in an NSView subclass and that subclass should be 
used in both controllers' nibs.

  -- Chris 

On Jun 19, 2010, at 4:58 PM, Shane software.research.developm...@gmail.com 
wrote:

 I have an applications with two controllers, one inherits
 NSWindowController and uses initWithWindowNibName:, and the other
 inherits NSViewController and uses initWithNibName:
 
 Yet, other than the init function which uses different *.nib files in
 each, the rest of the code in the controller is exactly the same since
 it draws the same stuff in each NSView of each NIB file (both of which
 are custom views). In one NIB file the NSView is inside an NSWindow,
 and in the other NIB it's just an NSView. But each view has the same
 graphics contents, so it's pretty much duplicated. If I make changes
 to one, I pretty much have to do it to the other as well.
 
 Anyone have ideas on how to merge these?
 ___
 
 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/cmh%40me.com
 
 This email sent to c...@me.com
___

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 arch...@mail-archive.com


Re: merging NSWindow and NSView controllers

2010-06-19 Thread Shane
On Sat, Jun 19, 2010 at 8:34 PM, Chris Hanson c...@me.com wrote:
 What kind of drawing in their NSView do these controllers do right now? 
 Perhaps that code should be in an NSView subclass and that subclass should be 
 used in both controllers' nibs.


It's pretty simple line graph and plots using NSBezierPath from the
drawRect: You may be right. I'm going to go think about that for a
bit.
___

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 arch...@mail-archive.com


Re: raising NSException between Controllers

2010-06-19 Thread Graham Cox

On 20/06/2010, at 8:35 AM, John Love wrote:

 Any psychic premonitions would be welcomed.


At this stage the only advice I would offer is not to use exceptions for flow 
control. That way madness lies...

--Graham


___

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 arch...@mail-archive.com