Updating table rows with bindings

2008-07-31 Thread James W. Walker
When an NSTableView is set up with bindings and NSArrayController,  
what is the right way to modify a row?  I see NSArrayController  
methods to add and remove objects, but nothing to modify one.  I guess  
I could remove and then add, but that seems ugly.


Before I started with bindings, it wasn't a problem.  The model array  
for the table was an NSMutableArrray of NSMutableDictionary, so I  
could just find the dictionary for the row and update it.  But  
apparently [[ arrayController arrangedObjects] objectAtIndex: i ]  
returns an immutable dictionary, so I can't do it that way.  I can't  
see how to work with the model array directly any more, because any  
way I get indexes of selected items gives indexes into the arranged  
objects, not the original array.

___

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]


KCGDisplaySetMainFlag not firing

2008-07-31 Thread Trygve Inda
I have a MBP17 and a 23 Cinema. The Cinema is the main display.

I am using:

void DisplayReconfigurationCallBack (CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags, void *userInfo)

When I remove the Cinema I get:

KCGDisplayRemoveFlag
kCGDisplaySetMainFlag   // main is now set to the internal 17

When I re-attach the Cinema I get:

KCGDisplayAddFlag

But do not get kCGDisplaySetMainFlag even though the main display is reset
to the Cinema.

Is this expected behavior? It seems odd.

Thanks,

Trygve


___

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]


Re: Document based initial window.

2008-07-31 Thread Seth Willits

On Jul 30, 2008, at 9:31 PM, Bill Bumgarner wrote:

In a Cocoa document based application, how do you stop it from  
initially opening an empty document on start up?


(I'm using a core data application if it matters).


Implement...

- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender;

... and return NO.

This method goes on your application delegate.



Now if only Interface Builder would do the same, and stop showing the  
template chooser window every time It drives me *insane*




--
Seth Willits




___

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]


[MEET] Aachen CocoaHeads TODAY (31 July 08)

2008-07-31 Thread Stefan Hafeneger

Hi everyone,

Aachen CocoaHeads is today (31 July 08) at 7PM.

Talk: Amin Negm-Awad, Advanced Cocoa Bindings

Please visit http://www.cocoaheads.de/ for location information.

See you there!

Stefan



smime.p7s
Description: S/MIME cryptographic signature
___

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]

Re: Document based initial window.

2008-07-31 Thread Nathan Kinsinger


On Jul 31, 2008, at 3:18 AM, Seth Willits wrote:

Now if only Interface Builder would do the same, and stop showing  
the template chooser window every time It drives me *insane*


--
Seth Willits


It may be just as troublesome, but if you set the Restore open  
documents preference it won't open the template chooser.


--Nathan
___

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]


Re: [Moderator] Re: Checking for Hackintosh

2008-07-31 Thread Matt Burnett

are you familiar with the term conflict of interest?

On Jul 30, 2008, at 11:18 PM, CocoaDev Admins wrote:


this type of comment isn't productive or appropriate for the list.

scott [moderator]


On 30-Jul-08, at 8:06 PM, Matt Burnett wrote:

The OP needs to get off his high horse and come to the realization  
that some people are a bit more clever than him (or Apple). But  
anyways you guys all forgot something big, virtualization. Can't OS  
X Server 10.5 be (legally) virtualized? Any hardware checks will  
either break in a virtualized environment, or a hackintosh will  
pretend to be virtualized, either way you lose. I bet the OP is the  
type of guy who thinks fighting piracy makes business sense too.




___

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]


Re: Checking for hackintosh

2008-07-31 Thread Andrew Merenbach


On Jul 30, 2008, at 10:20 PM, Andrew Merenbach wrote:


On Jul 30, 2008, at 8:24 PM, Chris Suter wrote:

On Thu, Jul 31, 2008 at 1:00 PM, Matt Burnett [EMAIL PROTECTED] 
wrote:


Then shouldn't you be able to determine if they are using a  
hackintosh by

the descriptions of support requests they are submitting?



Sure, if customers are willing to disclose that they're running on a
Hackintosh which isn't usually the case.


If not are you sure your code checks return values and is designed  
to fail

gracefully?



Of course, but we don't support Hackintosh's so we don't test on  
them and

they are different (especially where disk utilities are concerned).

I was just making the point that it would be useful to be able to  
detect
whether you're running on a Hackintosh *if* there was a reliable  
way of

doing it.

-- Chris



This thread, albeit only marginally-related to Cocoa, is an  
interesting one.  One solution (not saying that it'd work for  
everyone) would be to abandon Hackintosh-*checking* code, but  
install a menu item to send a system profile to you, via an online  
PHP form or some such, along with a support request message.  Thus  
one need not program in potentially-fragile code, but one does get  
to decide, per-support-request, whether a computer is legitimately a  
supported machine.


On the other hand, it might be possible for a clever user to hack  
your program and to send bogus information to your web form.  This  
would be Bad.  But such a system might at least be a deterrent to  
Hackintoshers.


Cheers,
Andrew


While it may be poor form to reply to myself, I realize now my need to  
clarify: this is a *menu item* that I am suggesting -- a voluntary  
option.  They'd still have access to one's support e-mail address.   
It's simply that, if one has doubts, one can ask the customer, Would  
you be able to actually send me a system profile?  I made it easy for  
you with this menu item.  And, lo and behold, your words come true --  
they send you a system profile, you figure out whether they're using a  
Hackintosh or not.  It's still completely voluntary on their part.   
But the functionality behind a Support menu item with an optional  
system profile attachment seems to me like an ingenious idea with  
which a third party might develop a framework.  Just a thought.


Just a thought.

Cheers,
Andrew



smime.p7s
Description: S/MIME cryptographic signature
___

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]

OT: Disk Utility creating corrupt DMGs for some

2008-07-31 Thread Dale Jensen
I looked at the list of mailing lists and none of them seemed  
appropriate, so if someone can point me to a better resource, many  
thanks.  I'll include the problem, in case anyone knows that's going on.


I've had a similar problem to this in the past, with a different  
computer, product and company, so it must not be super rare, but I  
can't find anything relevant googling.


I have a self created DMG file that fails to mount on four different  
people's computers, the Finder reporting Illegal seek.  It mounts  
just fine on about a dozen other machines, including the exact same  
model and system version.  For example, two iMac 24 with 10.5.4,  
mounts fine on one, fails on the other.  Repeated downloads of the DMG  
don't result in valid files, and if I just copy the DMG across the  
network to one of the computers, it still fails.


Mounting and verifying both the Master and Final DMG in Disk Utility  
results in no errors.  I have Verify Checksums turned on in Disk  
Utility preferences.  The Master is 40MB, the Final, around 7MB.


Our distribution process is thus:

1) I have a Master DMG which I mount, copy a new build to, then  
unmount
2) I load the Master DMG in Disk Utility, click the Convert button,  
select Format: compressed and Encryption: none, and create the  
smaller DMG
3) This is then uploaded, with Transmit, to a server.  Everyone but me  
downloads it with FTP from this server


Any insights or pointers to diagnostics or other information sources  
would be very well appreciated.


Thanks!


dale

--
Dale Jensen, CEO
Ntractive, LLC
[EMAIL PROTECTED]
http://www.ntractive.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 [EMAIL PROTECTED]


Re: Checking for hackintosh

2008-07-31 Thread Aaron Fothergill
back in the old days of the Apple ][, apps used to be able to check  
the ROMS, specifically the bit that displayed Apple ][ on startup  
as the clones would normally have something different there to avoid  
copyright theft being added to their list of crimes. I believe  
Nintendo still do something similar in running a check vs their logo  
on carts. If you copy the logo to make your clone cart work, you're  
in direct breach of copyright.


Maybe it's worth a feature request to Apple to add something similar?


Aaron



On Jul 31, 2008, at 3:27 AM, Chris Suter wrote:

On Thu, Jul 31, 2008 at 12:00 PM, Michael Ash  
[EMAIL PROTECTED] wrote:



On Tue, Jul 29, 2008 at 10:22 PM, John Joyce
[EMAIL PROTECTED] wrote:

Does anybody have a means or a tool for checking for hackintoshes?
I really don't approve of such things and would like to leave clever
messages on my own software if it is run on a hackintosh.


I really strongly advise against this.

Your code will have bugs, simply because it is code. It is quite
likely that one of these bugs will one day prevent a legitimate user
who owns a real, legitimate Macintosh from using your software.

At that point, I would argue, the harm to that one user far outweighs
any minor, undetectable gain you could possibly get from such a
scheme.



One issue that we have is that we get a lot of support for our  
products from
people who are running our software on Hackintosh's and they aren't  
usually
up front about that fact. They end up wasting our time when it  
turns out the
problem they've got is because they're running on a Hackintosh. So  
there

would be some benefit if we could detect when we're running from a
Hackintosh. Unfortunately, as others have pointed out, there is no  
future

proof way of doing that at the moment (that I know of).

-- Chris
___

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/zwilnik%40mac.com

This email sent to [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]


Re: OT: Disk Utility creating corrupt DMGs for some

2008-07-31 Thread I. Savant
On Thu, Jul 31, 2008 at 9:50 AM, Dale Jensen [EMAIL PROTECTED] wrote:
 I looked at the list of mailing lists and none of them seemed appropriate,
 so if someone can point me to a better resource, many thanks.  I'll include
 the problem, in case anyone knows that's going on.

  Your suspicions are correct - this isn't at all Cocoa-related so
this list is no more appropriate than any of the others. I couldn't
see a good fit for this problem in the list list myself, so I
sympathize. :-)

  Normally, when there's some sort of problem like this which you
suspect is a bug or otherwise abhorrent / undesirable behavior, you'd
file a bug report at:

http://bugreport.apple.com

  Then, DTS can handle it or tell you how you've misunderstood
something. ;-) Unfortunately that appears to be the only 'official'
channel available for your issue. There are, however, the discussion
forums on Apple's support site. Perhaps the problem (and possible
work-around) is discussed there.

--
I.S.
___

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]


Re: Multithreaded file read

2008-07-31 Thread Roger Herikstad
Hi,
 Thanks to both you for your help. I see my concern was unnecessary,
as I am indeed using separate file descriptors for the threads.
Thanks!

~ Roger

On Thu, Jul 31, 2008 at 1:47 PM, Jens Alfke [EMAIL PROTECTED] wrote:

 On 29 Jul '08, at 11:06 PM, Roger Herikstad wrote:

 I have a cocoa program that will read these index files and
 fetch the appropriate data from the big file, plot it and store as an
 image. I would like to run these print operations in parallel, but I'm
 concerned that a conflict will arise if two threads are reading into
 the same file.

 As long as each thread opens its own file descriptor, you'll be fine. Each
 descriptor has its own cursor. The thing you shouldn't do is share a
 single file descriptor between threads (unless you use the pread/pwrite API,
 which is stateless.)
 —Jens
___

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]


Re: Distributed Objects connection went invalid while waiting for a reply

2008-07-31 Thread Hamish Allan
Hi Chris,

On Tue, Jul 29, 2008 at 3:33 AM, Chris Suter [EMAIL PROTECTED] wrote:

 It sounds to me like you've got some kind of timing issue and that the delay
 that you're adding is merely hiding the true cause of the problem. Are you
 able to post a simple test case that displays the problem or post the code
 that you're using when you set things up?

I've posted a simple test case at:

$ svn checkout 
http://hamish-cocoa-dev-examples.googlecode.com/svn/trunk/DistributedObjectsTest
DistributedObjectsTest

The README file explains the class layout. Any insights gratefully appreciated.

The documentation at
http://developer.apple.com/documentation/Cocoa/Conceptual/DistrObjects/Tasks/configuring.html
has the following to say about callbacks:

Warning: Because independent conversation queueing causes remote
messages to block where they normally do not, it can cause deadlock to
occur between applications. Use this method only when you know the
nature of the interaction between two applications. Specifically, note
that multiple callbacks between the client and server are not possible
with independent conversation queueing.

The implication here is that callbacks are expected to be nested (i.e.
the callback is made before the vended object method returns), and
indeed, in my test app with DISTRIBUTED_OBJECTS_TEST_CODEPATH set to 1
or 4 there is no connection went invalid warning. However, there are
other codepaths that give no warning despite the callback not being
nested. It's a mystery to me!

Many thanks,
Hamish
___

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]


Re: Problem binding NSTextView's attributedString

2008-07-31 Thread Negm-Awad Amin


Am Mi,30.07.2008 um 22:36 schrieb Pete Callaway:


Hi,

This is probably a simple question, but I'm having a spot of bother
with a bound NSTextView.

In IB I've set the text view's attributedString to be bound to the
file's owner with a model key path of
document.selectedPage.stringContent.

I assume, that you use a window controller.


This is fine but when my
document's selectedPage property changes, the NSTextView doesn't
update to show the stringContent of the new selectedPage.
Obviously you have a to-many relationship from document to pages.  
(Otherwise there would be no selectedPage property.) It is a good  
idea, to bind an array controller pages controller to this  
relationship and to use the selection property of the array  
controller. You can additionally bind the selection of the array  
controller to something in your document instance (selectionIndexes  
…), if you want to.



I've checked changes to selectedPage can be observed OK so I'm not
sure what I'm missing from the equation. Any tips?
I think, that your solution should work. I do not know, why it  
doesn't. Anyway: It is a better idea, to use an array controller for  
to-many relationships between the instance, owning the to-many  
relationship and the targeted instances (pages). Selection management  
is a typiscal task of bindings controller, esp. array controller.


Cheers,

Amin




Cheers,
Pete
___

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Bindings to simulate spreadsheet functions in NSTableView?

2008-07-31 Thread Negm-Awad Amin


Am Do,31.07.2008 um 07:08 schrieb vince:


thanks,
I have a tableView with two columns. Column one lists arbitrary input
numbers. Column two lists monetary (dollar) vales. I want to display  
the

total running sum of column one in a textField and the dynamic (total)
monetary value of column two in a separate textField at the bottom  
of the

application, much the same as a spreadsheet function.

Can I accomplish this using bindings? If not can someone explain?
If you use an array controller for that list (you do), you can use the  
@-operators of the array controller. To get a sum of the arranged  
objects, you enter this binding for the textfield:


Bind to: yourRowController
Controller Key: arrangedObjects
Model Key Path: @sum.attributeWithValue




thanks and sorry about the rudimentary question ...

v.
___

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Binding an NSMenu to an NSArrayController

2008-07-31 Thread Keary Suska
7/30/08 6:33 PM, also sprach [EMAIL PROTECTED]:

 I've got an NSArrayController that I'd like to use to populate an
 NSMenu for use in an NSStatusItem.  Is there a way to do this with
 bindings?

No, or not that I am aware of. The list of classes and their bindings are
found at 
http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/C
ocoaBindingsRef.html, and I believe that list is supposed to be
comprehensive.

Best,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

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]


Re: outlineView:dataCellForTableColumn:item: and bindings don't mix? Editing doesn't stick.

2008-07-31 Thread Sean McBride
On 7/30/08 12:52 PM, Corbin Dunn said:

 I'm trying to use it exactly as used in the
 DragNDropOutlineView example: to use a cell that will be used for the
 entire row (ie a full width cell).

 It works in the test app (which doesn't use bindings), but doesn't
 work
 in my app that uses bindings.  I'm able to get the full width cell
 look,
 but editing the cell stops working.  I can type a new value for the
 cell, but pressing return/tab doesn't commit the new value.

 This short sample shows the problem.
 http://www.rogue-research.com/vtk/TreeTestFullWidthBug.zip

 Anyone made full width cells work with bindings?

Ah...with bindings. Xcode uses it with bindings, but they don't allow
the group rows to be edited. The trouble is that the bindings go
with the tablecolumn...and there really isn't a table column in that
case. Have you tried manually handling the updates yourself w/the
datasource method?

Corbin,

Your workaround seems to work.  I use
outlineView:setObjectValue:forTableColumn:byItem: and test for the same
conditions I use to make a row full width (nil tablecolumn etc).  In
such cases, I use the treenode's represented object (my model) and
update it myself.  I just do nothing in other cases, in which case the
bindings system is still used, happily.

PS: I filed rdar://6113109.

Thanks,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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]


Re: Problem binding NSTextView's attributedString

2008-07-31 Thread I. Savant
On Thu, Jul 31, 2008 at 2:26 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote:

 I've checked changes to selectedPage can be observed OK so I'm not
 sure what I'm missing from the equation. Any tips?

 I think, that your solution should work. I do not know, why it doesn't.

  This is because Pete hasn't posted any code. It doesn't make much
sense on the surface of things that your selectedPage property is
observed OK but the mechanism isn't working. This leads me to
believe your working assumption may be incorrect. Post your
selectedPage related code for review.

--
I.S.
___

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]


Re: Updating table rows with bindings

2008-07-31 Thread Keary Suska
7/31/08 1:00 AM, also sprach [EMAIL PROTECTED]:

 When an NSTableView is set up with bindings and NSArrayController,
 what is the right way to modify a row?  I see NSArrayController
 methods to add and remove objects, but nothing to modify one.  I guess
 I could remove and then add, but that seems ugly.

NSArrayController does not have any concept of row, or even any idea
whatsoever what kind of objects its content array contains. They don't even
have to be the objects of the same class. That's concept #1. An object's
properties are modified using Key-Value Coding. That's concept #2.
 
 Before I started with bindings, it wasn't a problem.  The model array
 for the table was an NSMutableArrray of NSMutableDictionary, so I
 could just find the dictionary for the row and update it.  But
 apparently [[ arrayController arrangedObjects] objectAtIndex: i ]
 returns an immutable dictionary, so I can't do it that way.  I can't
 see how to work with the model array directly any more, because any
 way I get indexes of selected items gives indexes into the arranged
 objects, not the original array.

If [[ arrayController arrangedObjects] objectAtIndex: i ] I returning an
immutable object, it's because that is what you are putting into
arrayController 's content array. Use mutable dictionaries instead.

Also, any programmatic changes to models should be done directly to the
model, and not through the controller's content, unless you are using the
controllers specific methods for manipulating content (such as -addObject:).

Lastly, there is no reliable way to map an array controller's
arrangedObjects to the model array, without making dangerous assumptions.
Why would you need this anyway? -selectedObjects will give you all the
objects you care about. (rhetorical question for most--there may be
situations, but IMHO this approach reveals a design flaw 99.99% of the time)

HTH,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

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]


Re: Updating table rows with bindings

2008-07-31 Thread James W. Walker


On Jul 31, 2008, at 8:21 AM, Keary Suska wrote:

If [[ arrayController arrangedObjects] objectAtIndex: i ] I  
returning an

immutable object, it's because that is what you are putting into
arrayController 's content array. Use mutable dictionaries instead.


I was mistaken, it is mutable.  I was confused because I had tested with

NSLog(@arranged object class = %@, [rowDict class]);

and got arranged object class = NSCFDictionary.  I thought I would  
see the word mutable there.

___

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]


inspecting undo

2008-07-31 Thread James Maxwell
I'm trying to figure out why a particular undo isn't working and I'm  
wondering whether there's any way of viewing the method and object  
registered with the most recent undo. I think I know why my undo isn't  
working, in this particular case, but I'd like to see exactly what the  
undoManager thinks it has at the top of its stack.


AFAIK there's no way to print the whole undo stack, but can I just see  
the top?


J.
___

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]


Re: Making child windows move with their parents

2008-07-31 Thread Sumner Trammell
Thanks Graham.

I'm beginning to wonder if this will work at all?  It just occurred to
me that every time I click a popup-type link in my webView, that popup
is itself a new instance of MyDocument.  I don't see how I could add
that popup window as a child of the main window when they are separate
document instances.  I hope I am looking at this wrong.


A few sanity checks:

aSender is the child webView
[aSender window] is the child webView's window
theDocument is the child webView's document
[[theDocument webView] window] is the child webView's document's
window (say that fast!)

self is the parent document (class MyDocument)
[self webView] is the parent document's webView
[[self webView] window] is the parent document's webView's window


In my mind, I want to add the child window to the parent one:

[[[self webView] window] addChildWindow:[[theDocument webView] window]
ordered:NSWindowAbove];


I'll try this shortly.


Thanks,
-s


On Thu, Jul 31, 2008 at 1:43 AM, Graham Cox [EMAIL PROTECTED] wrote:
 NSDocument doesn't implement -window

 I think you're getting muddled about what sender is and the relationship
 between the document and other objects. Using addChildWindow: should be OK,
 once you've sorted this out.

 hth,

 Graham

 On 31 Jul 2008, at 2:51 pm, Sumner Trammell wrote:

 but it doesn't work.  I get *** -[MyDocument window]: unrecognized
 selector sent to instance 0x1613ab30 in the run log.


___

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]


Re: Making child windows move with their parents

2008-07-31 Thread Sumner Trammell
Thanks Jens.

I'll change that config.  I did see the warning, but figured I would
run it anyway.

In a document-based app created using the Xcode template, there is in
fact a window outlet on File's Owner, which in this case is of class
MyDocument.  What does that window outlet actually represent?


-s





On Thu, Jul 31, 2008 at 1:45 AM, Jens Alfke [EMAIL PROTECTED] wrote:

 On 30 Jul '08, at 9:51 PM, Sumner Trammell wrote:

 but it doesn't work.  I get *** -[MyDocument window]: unrecognized
 selector sent to instance 0x1613ab30 in the run log.

 aSender is the WebView in the main window.
 self is the MyDocument object, and it has a window outlet that I can
 see when I right-click the File's Owner in IB.

 Look at your code. You tried to send -window to a MyDocument object, which
 is a subclass of NSDocument:

[[self window] addChildWindow:[aSender window]
 ordered:NSWindowAbove];

 There is no such method (because documents can have multiple windows, so
 there's no sensible result.)

 You must have gotten a warning about this at compile time. *Do not ignore
 such warnings*. They should be treated as error messages because, nearly
 always, they indicate a situation that will throw an exception at runtime,
 causing your app to fail. I recommend turning on the treat warnings as
 errors build config checkbox.

 —Jens
___

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]


Re: inspecting undo

2008-07-31 Thread I. Savant
On Thu, Jul 31, 2008 at 12:52 PM, James Maxwell
[EMAIL PROTECTED] wrote:

 AFAIK there's no way to print the whole undo stack, but can I just see the
 top?

  There's no public API for directly accessing the stacks (undo and
redo), however you could do the following:

1 - Subclass NSUndoManager.
2 - Override the appropriate methods ( -registerUndoWithTarget:... and
-prepareWithInvocationTarget: ) and provide logging before calling
super.
3 - Return a shared instance of your undo manager subclass for the
desired window(s) via the -[NSWindow windowWillReturnUndoManager:]
delegate method.

  Of course this doesn't help with the redo stack, just what's added
to the undo stack.

--
I.S.
___

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]


CALayer drawing transition effect?

2008-07-31 Thread Joseph Kelly
I am subclassing CALayer, and overriding -drawInContext: to perform my  
drawing.


I'm noticing that whenever my -drawInContext gets called (in response  
to calling -setNeedsDisplay)  that there appears to be an actual  
animated fade-out / fade-in of of the old content and the new content.


I do not see this transition effect documented anywhere, so I'm  
wondering if I'm doing something wrong. Or, if this is the correct  
behavior, how do I turn it off?


It's really quite an eye-catching effect, but it's not desirable in  
this particular case; I need the layer content to show up immediately.


I've got several instances of my CALayer subclass as sublayers of an  
NSView with -setWantsLayer:YES.


The reason I subclass CALayer is merely as a convenience. I pass off  
drawing to a C++ object, and rather than create an objective C proxy  
which delegates drawing from a CALayer which it owns, I collapsed it  
into a subclass. But if this is the culprit, I'll go ahead w/ the  
proxy object.


Thanks in advance,


Joe K.
___

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]


Re: inspecting undo

2008-07-31 Thread Charles Steinman
--- On Thu, 7/31/08, James Maxwell [EMAIL PROTECTED] wrote:

 From: James Maxwell [EMAIL PROTECTED]
 Subject: inspecting undo
 To: Cocoa Dev cocoa-dev@lists.apple.com
 Date: Thursday, July 31, 2008, 9:52 AM
 I'm trying to figure out why a particular undo isn't
 working and I'm  
 wondering whether there's any way of viewing the method
 and object  
 registered with the most recent undo. I think I know why my
 undo isn't  
 working, in this particular case, but I'd like to see
 exactly what the  
 undoManager thinks it has at the top of its stack.
 
 AFAIK there's no way to print the whole undo stack, but
 can I just see  
 the top?

If it's just for debugging purposes, you could cheat and look at the _undoStack 
ivar. Of course, this is an evil hack and should never, ever be used in 
production code, but it could be instructive just as an experiment.

Cheers,
Chuck


  
___

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]


Re: Making child windows move with their parents

2008-07-31 Thread Sumner Trammell
Nope.  This version crashes as well:

[[[self webView] window] addChildWindow:[[theDocument webView] window]
ordered:NSWindowAbove];



I'm getting something wrong in the way I'm looking at this problem.
What am I not seeing?



Thanks,
-s




On Thu, Jul 31, 2008 at 1:01 PM, Sumner Trammell
[EMAIL PROTECTED] wrote:
 Thanks Graham.

 I'm beginning to wonder if this will work at all?  It just occurred to
 me that every time I click a popup-type link in my webView, that popup
 is itself a new instance of MyDocument.  I don't see how I could add
 that popup window as a child of the main window when they are separate
 document instances.  I hope I am looking at this wrong.


 A few sanity checks:

 aSender is the child webView
 [aSender window] is the child webView's window
 theDocument is the child webView's document
 [[theDocument webView] window] is the child webView's document's
 window (say that fast!)

 self is the parent document (class MyDocument)
 [self webView] is the parent document's webView
 [[self webView] window] is the parent document's webView's window


 In my mind, I want to add the child window to the parent one:

 [[[self webView] window] addChildWindow:[[theDocument webView] window]
 ordered:NSWindowAbove];


 I'll try this shortly.


 Thanks,
 -s


 On Thu, Jul 31, 2008 at 1:43 AM, Graham Cox [EMAIL PROTECTED] wrote:
 NSDocument doesn't implement -window

 I think you're getting muddled about what sender is and the relationship
 between the document and other objects. Using addChildWindow: should be OK,
 once you've sorted this out.

 hth,

 Graham

 On 31 Jul 2008, at 2:51 pm, Sumner Trammell wrote:

 but it doesn't work.  I get *** -[MyDocument window]: unrecognized
 selector sent to instance 0x1613ab30 in the run log.



___

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]


Re: CALayer drawing transition effect?

2008-07-31 Thread Jens Alfke


On 31 Jul '08, at 10:24 AM, Joseph Kelly wrote:

I'm noticing that whenever my -drawInContext gets called (in  
response to calling -setNeedsDisplay) that there appears to be an  
actual animated fade-out / fade-in of of the old content and the new  
content.
I do not see this transition effect documented anywhere, so I'm  
wondering if I'm doing something wrong. Or, if this is the correct  
behavior, how do I turn it off?


The content of a layer is an animatable property, so by default,  
changing the content will do a crossfade. It seems that applies to  
custom content (drawn by -drawInContext:) as well as the content  
property.


There are a couple ways to suppress animations. You can use the  
CAContext API to disable all animations while you make your changes,  
or you can use the layer's actions dictionary to override the  
animation for the content transition.


—Jens___

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]


Re: Binding an NSMenu to an NSArrayController

2008-07-31 Thread Dave DeLong
I was afraid of that...  Thanks for the link, though!  I'll have to go study it.

Cheers,

Dave

On Thu, Jul 31, 2008 at 8:46 AM, Keary Suska [EMAIL PROTECTED] wrote:
 7/30/08 6:33 PM, also sprach [EMAIL PROTECTED]:

 I've got an NSArrayController that I'd like to use to populate an
 NSMenu for use in an NSStatusItem.  Is there a way to do this with
 bindings?

 No, or not that I am aware of. The list of classes and their bindings are
 found at
 http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/C
 ocoaBindingsRef.html, and I believe that list is supposed to be
 comprehensive.

 Best,

 Keary Suska
___

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]


compiler warning for not fully implementing protocol

2008-07-31 Thread Mark Sanvitale
I have a formal protocol that declares two methods.  I have a class  
that adopts this protocol.  This class implements one of the protocol  
methods.  This class inherits from another class.  This super class  
actually implements a method matching the signature of the second  
method declared in the protocol.  Everything runs just fine, however,  
the compiler insists something is wrong by warning me incomplete  
implementation of class X, method definition for 'method-name'  
not found, and class 'X' does not fully implement the 'Y' protocol.


I think the compiler is wrong.  Or is this by design according to  
some strict rule(s) of Objective-C?  Am I expected to redefine the  
method I inherit from my super class if the method is part of a  
protocol I adopt?



Mark Sanvitale
Exbiblio
[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]


[Q] [NSValue valueWithBytes: objCType:]

2008-07-31 Thread JongAm Park

How are you doing, all?

I found a interesting one with the NSValue class, and would like to ask 
a couple of questions.


First, I would like to put data from a callback function to an global or 
a singleton NSArray. The data structure which holds the all the data is :


typedef struct simpleDescription {
   int dataType;
   int dataKind;
   unsigned char uuid;
} simpleDescription;

typedef struct complexType {
   uint8_t *data;
   int dataSize;
   int year;
  
   simpleDescription *dataDesc;

   int tag;
} complexType;

So, the data to queue is in complexType. It contains chunk of data of 
which is is dataSize. While the length of the data is various, but the 
length of dataDesc is fixed. ( It will not point to an array of 
simpleDescription, but one simpleDescription instance. )


I also made another structure, which is the same to the complexType - data,

typedef struct complexTypeConveyer
{
   int dataSize;
   int year;
  
   simpleDescription *dataDesc;

   int tag;
  
} complexTypeConveyer;


It is for converting them using [NSValue valueWithBytes: objCType:] easily.

So, the queuing process is :

- (IBAction)encode:(id)sender
{
   // Setup complexType
   simpleDescription *dataDesc = (simpleDescription *)malloc( sizeof( 
simpleDescription ) );

   dataDesc-dataType ='JaPA';
   dataDesc-dataKind = 'CUST';
   dataDesc-uuid = 0x01;
  
   uint8_t *data = (uint8_t *)malloc( 512 );

   memset( data, 0x0E, 512 );
   complexType dataSet;
  
   dataSet.data = data;

   dataSet.dataSize = 512;
   dataSet.year = 1980;
   dataSet.dataDesc = dataDesc;
   dataSet.tag = 1;
  
   [self printComplexType:dataSet toView:lefTextView];
  
   // Move to the conveyer

   complexTypeConveyer theConveyer;
   theConveyer.dataSize = dataSet.dataSize;
   theConveyer.year = dataSet.year;
   theConveyer.dataDesc = dataSet.dataDesc;
   theConveyer.tag = dataSet.tag;
  
   NSValue *aValue = [NSValue valueWithBytes:theConveyer 
objCType:@encode(complexTypeConveyer)];

   NSLog( @aValue retainCount = %d, [aValue retainCount] );
   NSData *theDataToConvey = [NSData dataWithBytes:dataSet.data 
length:dataSet.dataSize];
  
   NSDictionary *conveyDictionary = [NSDictionary 
dictionaryWithObjectsAndKeys:aValue, @complexTypeConveyer,
 theDataToConvey, @dataToConvey, 
nil];
  
  
   mDataQueue = [NSArray arrayWithObject:conveyDictionary];

   NSLog( @aValue retainCount = %d, [aValue retainCount] );
  
   //bzero( data, 512);

   free( data );
  
   //bzero( dataDesc, sizeof( simpleDescription ) );

   free( dataDesc );
  
   [self recover];

}

As you can see, it will retrieve the queued data in mDataQueue in its - 
recover message.


- (void)recover
{
   //
   // Recover the data
  
   complexTypeConveyer recoveredConveyedType;
  
   NSDictionary *recoveredDictionary = (NSDictionary *)[mDataQueue 
objectAtIndex:0];
   NSValue *recoveredValue = (NSValue *)[recoveredDictionary 
objectForKey:@complexTypeConveyer];
   NSData *recoveredData = (NSData *)[recoveredDictionary 
objectForKey:@datatoConvey];
  
   [recoveredValue getValue:recoveredConveyedType];
   uint8_t *recoveredInnerData = (uint8_t *)malloc( 
recoveredConveyedType.dataSize );
   [recoveredData getBytes:recoveredInnerData 
length:recoveredConveyedType.dataSize];
  
   // Now restore the complex type

   complexType recoveredType;
   recoveredType.data = recoveredInnerData;
   recoveredType.dataSize = recoveredConveyedType.dataSize;
   recoveredType.year = recoveredConveyedType.year;
   recoveredType.dataDesc = recoveredConveyedType.dataDesc;
   recoveredType.tag = recoveredConveyedType.tag;
  
   [self printComplexType:recoveredType toView:rightextView];
  
   free( recoveredType.data );

   free( recoveredType.dataDesc );
}

There is a reason I didn't include the data in the NSValue using the 
valueWithBytes: objCType:. When it retrieves the value from the 
mDataQueue, the content doesn't seem to be maintained. Also, the 
document is somewhat ambiguous.


An NSValue object is a simple container for a single C or Objectie-C 
data item. It can hold any of the scalar types such as int, float, and 
char, as welll as pointers, structures, and object ids. 

-- from Number and Value Programming Topics for Cocoa

It sounds like that it only transforms pointers in a structure, not the 
target content pointed by the pointers. So, as a test I put the dataDesc 
just as a pointer to the structure. ( In the source above, dataDesc is 
declared as :


(case 1)
simpleDescription *dataDesc

But I also tried :

(case 2)
simpleDescription dataDesc

And assigned its address to the field of the complexType.
The purpose of case 2 is to see if the retrieved data in the recover 
function is invalid, because it is declared statically in the encode 
action handler. ( I thought it should be invalid. However, somehow it 
was maintained. This is one of the question I would like to ask. How it 
can be maintained although it is out of the scope? From 

Re: compiler warning for not fully implementing protocol

2008-07-31 Thread Bill Bumgarner

On Jul 31, 2008, at 11:36 AM, Mark Sanvitale wrote:
I have a formal protocol that declares two methods.  I have a class  
that adopts this protocol.  This class implements one of the  
protocol methods.  This class inherits from another class.  This  
super class actually implements a method matching the signature of  
the second method declared in the protocol.  Everything runs just  
fine, however, the compiler insists something is wrong by warning me  
incomplete implementation of class X, method definition for  
'method-name' not found, and class 'X' does not fully implement  
the 'Y' protocol.


I think the compiler is wrong.  Or is this by design according to  
some strict rule(s) of Objective-C?  Am I expected to redefine the  
method I inherit from my super class if the method is part of a  
protocol I adopt?


The compiler has no way of knowing that the protocol's contract was  
fulfilled by the superclass unless you also declare the second method  
in the superclass's public interface.


If you don't want to expose the method's declaration, declare it in a  
private header.


b.bum

___

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]


Re: Problem binding NSTextView's attributedString

2008-07-31 Thread Quincey Morris

On Jul 31, 2008, at 13:02, Pete Callaway wrote:


- (void)setSelectedPage:(PageEntity*)newPage
{
if (newPage == _selectedPage)
return;

[self willChangeValueForKey:@selectedPage];
_selectedPage = newPage;
[self didChangeValueForKey:@selectedPage];
}

- (PageEntity*)selectedPage
{
// Probably OTT
[self willAccessValueForKey:@selectedPage];
PageEntity *page = _selectedPage;
[self didAccessValueForKey:@selectedPage];

return page 
}


So this is a Core Data application? If so, is selectedPage a  
property defined in the Core Data model, or not?


If it is, you probably should be using primitiveSelectedPage and  
setPrimitiveSelectedPage to access your instance variable. If not,  
you're using a property behind Core Data's back, and I didn't have  
great success when I tried doing that -- though I expect it is doable  
and I was just Doing It Wrong. (Also, will/didAccessValueForKey makes  
no sense for properties not in the Core Data model, AFAIK.)


Or, you may be looking in the wrong place for the problem. Are you  
sure that PageEntity is KVO compliant for the property stringContent?



___

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]


Re: [Q] [NSValue valueWithBytes: objCType:]

2008-07-31 Thread Jens Alfke


On 31 Jul '08, at 11:37 AM, JongAm Park wrote:

1. Whether the dataDesc is statically declared or not, although it  
is freed in the end of the encode action handler, it is still  
maintained and could be accessed from another message, recover.  
And with the Memory browser, I could confirm that the memory content  
was still there. Why is it so? Does the NSData or NSArray just  
retains them?


The free( ) call doesn't immediately overwrite the block. It's added  
to a free-list and will be reused later in a future malloc( ) call.  
However, you can't rely on that of course; accessing any data from a  
freed block is a bug that can lead to random crashes.


2. However, when I intentionally bzero it, the content is nullified,  
and the recover message sees the content as zeros. So, it is not  
caches in the NSArray. It seems to me that it just uses by  
referencing.


That's bad. It sounds like the object you create doesn't contain a  
copy of the struct but just a pointer to it.


5. for the data, I used dataWithBytes: length: thinking that it will  
copy the contents, instead of just referencing the original.  
However, it turns out that it just references it. I figured that out  
by bzeroing the original, and how it is seen in the recover function.


No, +dataWithBytes: does copy the data. It's only the ...noCopy  
variants that will [possibly] use your existing buffer.


Something's fundamentally wrong with your code, in that data you think  
you're copying is really just being referenced through a pointer. I'm  
sorry, but you posted a lot of stuff and I'm not going to read through  
it all to debug it for you. You need to do some code review on your own.


—Jens___

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]


Re: Problem binding NSTextView's attributedString

2008-07-31 Thread Pete Callaway
On Thu, Jul 31, 2008 at 9:42 PM, Quincey Morris
[EMAIL PROTECTED] wrote:
 On Jul 31, 2008, at 13:02, Pete Callaway wrote:

 - (void)setSelectedPage:(PageEntity*)newPage
 {
if (newPage == _selectedPage)
return;

[self willChangeValueForKey:@selectedPage];
_selectedPage = newPage;
[self didChangeValueForKey:@selectedPage];
 }

 - (PageEntity*)selectedPage
 {
// Probably OTT
[self willAccessValueForKey:@selectedPage];
PageEntity *page = _selectedPage;
[self didAccessValueForKey:@selectedPage];

return page
 }

 So this is a Core Data application? If so, is selectedPage a property
 defined in the Core Data model, or not?
Yes it is a Core Data application. selectedPage is not defined in the
Core Data model. It's just meant as a pointer to the currently
selected page entity.

 If it is, you probably should be using primitiveSelectedPage and
 setPrimitiveSelectedPage to access your instance variable. If not, you're
 using a property behind Core Data's back, and I didn't have great success
 when I tried doing that -- though I expect it is doable and I was just Doing
 It Wrong. (Also, will/didAccessValueForKey makes no sense for properties not
 in the Core Data model, AFAIK.)
I don't think I'm doing anything behind Core Data's back particularly.
selectedPage is a property of the NSPersistentDocument, not of an
NSManagedObject. I have several view controllers and they each need to
know which entity to show the detail of. It seemed to me that the
obvious way to do this was to maintain a pointer to the selected page
in a central location and the document seemed to be the ideal spot.

 Or, you may be looking in the wrong place for the problem. Are you sure that
 PageEntity is KVO compliant for the property stringContent?
PageEntity is definitely KVO compliant for the stringContent
property. I can update this property via the bound NSTextView but if
the document's selectedPage property changes, the view doesn't update
to show it's stringContent.

Cheers,
Pete
___

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]


Re: CALayer drawing transition effect?

2008-07-31 Thread Joseph Kelly


On Jul 31, 2008, at 11:07 AM, Jens Alfke wrote:

The content of a layer is an animatable property, so by default,  
changing the content will do a crossfade. It seems that applies to  
custom content (drawn by -drawInContext:) as well as the content  
property.


There are a couple ways to suppress animations. You can use the  
CAContext API to disable all animations while you make your changes,  
or you can use the layer's actions dictionary to override the  
animation for the content transition.


Thanks!

I tried the following which seems to work. I'm not sure if it's the  
approved way or not:


- (idCAAction)actionForKey:(NSString *)event
{
if ([event isEqualToString:@contents])
return nil;
return [super actionForKey:event];
}

(there was some mention of returning [NSNull null] to terminate  
further searching, but it just crashed when I did that)


Joe K.
___

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]


Adding an NSColor subclass to NSColorPanel?

2008-07-31 Thread David Springer
Folks,

I would like to add instances of a subclass of NSColor to the color
panel.  The problem is, when you change to another app that does not
know about this subclass, the NSColorPanel kind of freaks out and
shows all the colors as white (even the system colors) - in some cases
it just crashes the other app.  Is there a way I can tell NSColorPanel
to add my special colors only for my app, and not affect other apps?

Thanks!
- Dave.S
___

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]


Re: Adding an NSColor subclass to NSColorPanel?

2008-07-31 Thread Nick Zitzmann


On Jul 31, 2008, at 3:20 PM, David Springer wrote:


I would like to add instances of a subclass of NSColor to the color
panel.



Why, exactly, did you subclass NSColor? NSColor is a class cluster,  
like NSArray and NSString.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Should you unbind an ArrayController for performance reasons?

2008-07-31 Thread Kenny Carruthers
	This is a follow-up post to an earlier post I made regarding the  
performance of updating a relationship property in thousands of  
managed objects. After some profiling with Instruments, it became  
clear that the performance bottle neck was actually in  
NSArrayController. Since that ArrayController had a binding with an  
NSTableView I started to wonder if the performance hit was actually  
caused by all the UI updating that needed to happen. Sure enough it  
was. If I unbind the ArrayController before I update all the managed  
objects, then rebind the ArrayController afterwards, then I get great  
performance and the CoreData state is correct. Is unbinding the  
ArrayController the correct or a valid thing to do? It seems like  
a bit of a hack...


More details of the setup for those interested:

	I have two NSTableViews in a Window. Call them Playlists and Songs.  
Each has an NSArrayController with standard bindings. The  
playlistsController is bound to the managed object context of the  
application and shows entities of type Playlist. The  
songsControllers' contentSet is bound to the selected playlists songs.  
Click a different playlist and the songs table view updates. I think  
this is the standard master/detail view setup. Works fine. However, if  
I load a playlist that contains a few thousand songs then drag those  
songs from the songs table view over to a playlist the operation will  
take several minutes. Profiling showed that the most amount of time is  
spent in the songsController. My guess is that every time I change the  
songs managed object (by doing something like:


theSong.playlist = destinationList

	Then everytime this happens the songs array controller gets notified,  
it has to find the song in question, remove it from its list of  
arrangedObjects, notify the NSTableView that the content set has been  
changed, and then the NSTableView needs to find the row and remove it.  
This, apparently, is not a fast operation. So by unbinding the  
songsController from the table view, doing all the updates, then  
rebinding the controller back, I get the performance, back presumably  
because the table view can then just do one big update when it's  
rebinded (rebounded?).


	So I'm just wondering if there's a better way to do this. Seems like  
I need some ability to tell the array controller that I'm about to  
update a few thousand objects on it and to suspend notifications to  
the tableView until I'm done or something like that.


Thoughts?

Sincerely,
Kenny
___

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]


Re: [Q] [NSValue valueWithBytes: objCType:]

2008-07-31 Thread JongAm Park

Hello.

Well, I did review the code as usual.
It is interesting that the exactly same memory blocks were allocated for 
the interested data and dataDesc.

So, it looked like that it is referenced, although they were not.

Thanks.

Jens Alfke wrote:
Something's fundamentally wrong with your code, in that data you think 
you're copying is really just being referenced through a pointer. I'm 
sorry, but you posted a lot of stuff and I'm not going to read through 
it all to debug it for you. You need to do some code review on your own.


—Jens


___

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]


Re: Problem binding NSTextView's attributedString

2008-07-31 Thread Quincey Morris

On Jul 31, 2008, at 14:04, Pete Callaway wrote:


I don't think I'm doing anything behind Core Data's back particularly.
selectedPage is a property of the NSPersistentDocument, not of an
NSManagedObject. I have several view controllers and they each need to
know which entity to show the detail of. It seemed to me that the
obvious way to do this was to maintain a pointer to the selected page
in a central location and the document seemed to be the ideal spot.


Er, sorry, I was mesmerized by those ...AccessValueForKey calls.  
They're methods of NSManagedObject, so I just assumed that 'self' was  
some kind of NSManagedObject. In fact, your posted implementation of  
selectedPage ought to get compilation errors (including one for the  
missing semi-colon at the end).


My guess (and, sorry, I'm just guessing) is that the text view is  
getting bound to the string object fetched by  
document.selectedPage.textContent at the time the binding is set up  
(i.e. bound to key self of some string) instead of getting bound to  
key selectedPage.textContent of the document. You could find out by  
selecting a different page (so that the wrong text is displayed) and  
then change the text and press Return. Then save and reopen the  
document to find out which page (if any) actually got changed.


Plan B might be to add a NSObjectController. Bind the object  
controller to the document, and bind the text view to the object  
controller, controller key selection, data model key  
selectedPage.textContent. (You kind of want to do that anyway,  
because the object controller has the logic to commit the text field  
if you try to close the document window while the text field is being  
edited.)



___

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]


Thread safety with background fetching

2008-07-31 Thread Ben

Hi List,

Having read the Apple documentation and beginner guides on threading,  
I am still a little confused about protecting my variables from access  
by multiple threads.


A sample of my code is as follows:

@interface Class1 : NSObject
{
XMLFetcherParser *fetcherParser;
}
- (void)doBackgroundFetch;
- (void)receiveItem:(Item *)newItem;
@end

@implementation Class1

- (void)doBackgroundFetch
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

fetcherParser = [[XMLFetcherParser alloc] init];
[fetcherParser doYourThing];

[fetcherParser release];
[pool release];
}

- (void)receiveItem:(Item *)newItem
{
// Add newItem to an array
}

@end

For usage, the summary is that I do:

[NSThread detachNewThreadSelector:@selector(doBackgroundFetch)  
toTarget:self withObject:nil];


and then -[XMLFetcherParser doYourThing] repeatedly sends newly  
created objects to receiveItem: using the performSelectorOnMainThread  
method. Once the spawned thread has done this, it never uses the sent  
object again.



My question is how should I protect this code from thread related  
problems? Do I just place @synchronized(){} blocks around the code in  
receiveItem: and it's counterpart in the spawned thread? Or is that  
just plain wrong? Or (likely) am I barking up totally the wrong tree?



Regards,

Ben

___

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]


Re: Thread safety with background fetching

2008-07-31 Thread Joseph Kelly
The only time you're sharing data across threads is via - 
performSelectorOnMainThread:... which itself is thread safe.


So the main thing you have to work through is the memory management of  
the data which XMLFetcherParser is passing to the -receiveItem: method  
on the main thread. The convention is that things are created and  
immediately added to the autorelease pool.


For instance, If the worker thread's autorelease pool gets released  
right after it passes you the object on the main thread, that object  
will become released, and you're left with a dangling pointer.


You might need to adopt a very tight convention that you retain the  
object before sending it to the main thread, and once in the main  
thread, autorelease it there.


Joe K.



On Jul 31, 2008, at 9:59 AM, Ben wrote:


Hi List,

Having read the Apple documentation and beginner guides on  
threading, I am still a little confused about protecting my  
variables from access by multiple threads.


A sample of my code is as follows:

@interface Class1 : NSObject
{
XMLFetcherParser *fetcherParser;
}
- (void)doBackgroundFetch;
- (void)receiveItem:(Item *)newItem;
@end

@implementation Class1

- (void)doBackgroundFetch
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

fetcherParser = [[XMLFetcherParser alloc] init];
[fetcherParser doYourThing];

[fetcherParser release];
[pool release];
}

- (void)receiveItem:(Item *)newItem
{
// Add newItem to an array
}

@end

For usage, the summary is that I do:

[NSThread detachNewThreadSelector:@selector(doBackgroundFetch)  
toTarget:self withObject:nil];


and then -[XMLFetcherParser doYourThing] repeatedly sends newly  
created objects to receiveItem: using the  
performSelectorOnMainThread method. Once the spawned thread has done  
this, it never uses the sent object again.



My question is how should I protect this code from thread related  
problems? Do I just place @synchronized(){} blocks around the code  
in receiveItem: and it's counterpart in the spawned thread? Or is  
that just plain wrong? Or (likely) am I barking up totally the wrong  
tree?



Regards,

Ben

___

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/joeman%40mac.com

This email sent to [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]


Re: compiler warning for not fully implementing protocol

2008-07-31 Thread Mark Sanvitale
I think I am doing exactly what you say is necessary (i.e. declare  
the second method in the superclass's public interface).


Here are some code snippets:

PortalTabView is the super class (which happens to also adopt a  
protocol, which is not part of this issue but including it for  
completeness):


@protocol PortalTabProtocol
- (void)refreshDisplay:(XBCapture *)capture because:(XBRefreshCause) 
trigger;

@end

@interface PortalTabView : NSView PortalTabProtocol
{}
- (NSString *)tabName;
- (void)refreshDisplay:(XBCapture *)capture because:(XBRefreshCause) 
trigger;

- (XBCapture *)displayCapture;
@end

PortalActionView is the class that gets the compiler warnings about  
the ReadArchiveClient protocol:


@protocol ReadArchiveClient
- (XBCapture *)displayCapture;
- (void)processedArchive:(WebArchive *)archive;
@end

@interface PortalActionView : PortalTabView ReadArchiveClient


So, PortalActionView does implement processedArchive: (without  
declaring it in its interface) but the displayCapture method is  
coming from its super class which does declare this method in its  
public interface, yet the compiler complains method definition for '- 
displayCapture' not found.  Complier bug?



On Jul 31, 2008, at 1:13 PM, Bill Bumgarner wrote:


On Jul 31, 2008, at 11:36 AM, Mark Sanvitale wrote:
I have a formal protocol that declares two methods.  I have a  
class that adopts this protocol.  This class implements one of the  
protocol methods.  This class inherits from another class.  This  
super class actually implements a method matching the signature of  
the second method declared in the protocol.  Everything runs just  
fine, however, the compiler insists something is wrong by warning  
me incomplete implementation of class X, method definition for  
'method-name' not found, and class 'X' does not fully implement  
the 'Y' protocol.


I think the compiler is wrong.  Or is this by design according  
to some strict rule(s) of Objective-C?  Am I expected to redefine  
the method I inherit from my super class if the method is part of  
a protocol I adopt?


The compiler has no way of knowing that the protocol's contract was  
fulfilled by the superclass unless you also declare the second  
method in the superclass's public interface.


If you don't want to expose the method's declaration, declare it in  
a private header.


b.bum






___

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]


Re: Thread safety with background fetching

2008-07-31 Thread Jens Alfke


On 31 Jul '08, at 9:59 AM, Ben wrote:


For usage, the summary is that I do:

[NSThread detachNewThreadSelector:@selector(doBackgroundFetch)  
toTarget:self withObject:nil];


and then -[XMLFetcherParser doYourThing] repeatedly sends newly  
created objects to receiveItem: using the  
performSelectorOnMainThread method. Once the spawned thread has done  
this, it never uses the sent object again.


My question is how should I protect this code from thread related  
problems? Do I just place @synchronized(){} blocks around the code  
in receiveItem: and it's counterpart in the spawned thread?


You shouldn't need to. It sounds like -receiveItem: is only called on  
the main thread, and if the helper object has finished with each new  
object before it sends it to -receiveItem:, those objects won't be  
accessed from multiple threads either.


You've basically got an agent-like mechanism, where the threads are  
very loosely coupled using queues of messages, and don't need to worry  
about synchronization issues. That's the way I like to arrange things  
too.


—Jens

___

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]


Re: [Q] [NSValue valueWithBytes: objCType:]

2008-07-31 Thread Jens Alfke


On 31 Jul '08, at 3:02 PM, JongAm Park wrote:

It is interesting that the exactly same memory blocks were allocated  
for the interested data and dataDesc.


It's actually pretty likely... malloc( ) often reuses a recently-freed  
block of the same size when it can, because this avoids heap  
fragmentation and improves caching.


If you really want to see what's going on, set the environment  
variable MallocScribble to 1 when running your program. This will  
cause newly allocated blocks to be filled with 0xAA and freed blocks  
to be filled with 0x55. It's a good way to track down references to  
uninitialized or freed memory.


—Jens___

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]


Re: Thread safety with background fetching

2008-07-31 Thread Phil
On Fri, Aug 1, 2008 at 4:59 AM, Ben [EMAIL PROTECTED] wrote:
 and then -[XMLFetcherParser doYourThing] repeatedly sends newly created
 objects to receiveItem: using the performSelectorOnMainThread method. Once
 the spawned thread has done this, it never uses the sent object again.


 My question is how should I protect this code from thread related problems?
 Do I just place @synchronized(){} blocks around the code in receiveItem: and
 it's counterpart in the spawned thread? Or is that just plain wrong? Or
 (likely) am I barking up totally the wrong tree?


Since it doesn't look like you're sharing any ivars or objects between
the threads, I don't think you'll need any @synchronized blocks or
locking. The only thing I can see you'll want to watch out for is the
memory management of the objects that you pass to -receiveItem:.

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 [EMAIL PROTECTED]


Re: Thread safety with background fetching

2008-07-31 Thread Joseph Kelly
Jens response just reminded me to check the docs, and it says of - 
performSelectorOnMainThread:...:


This method retains the receiver and the arg parameter until after  
the selector is performed


So I retract what I said before. So long as, was noted, you do not  
mess with the passed object in the worker thread AFTER you send it to  
the main thread, you should be all good.


Joe K.

On Jul 31, 2008, at 4:14 PM, Joseph Kelly wrote:

The only time you're sharing data across threads is via - 
performSelectorOnMainThread:... which itself is thread safe.


So the main thing you have to work through is the memory management  
of the data which XMLFetcherParser is passing to the -receiveItem:  
method on the main thread. The convention is that things are created  
and immediately added to the autorelease pool.


For instance, If the worker thread's autorelease pool gets released  
right after it passes you the object on the main thread, that object  
will become released, and you're left with a dangling pointer.


You might need to adopt a very tight convention that you retain the  
object before sending it to the main thread, and once in the main  
thread, autorelease it there.


Joe K.



On Jul 31, 2008, at 9:59 AM, Ben wrote:


___

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]


Re: Distributed Objects connection went invalid while waiting for a reply

2008-07-31 Thread Chris Suter
Hi Hamish,

On Thu, Jul 31, 2008 at 10:16 PM, Hamish Allan [EMAIL PROTECTED] wrote:

 On Tue, Jul 29, 2008 at 3:33 AM, Chris Suter [EMAIL PROTECTED] wrote:

  It sounds to me like you've got some kind of timing issue and that the
 delay
  that you're adding is merely hiding the true cause of the problem. Are
 you
  able to post a simple test case that displays the problem or post the
 code
  that you're using when you set things up?

 I've posted a simple test case at:

 $ svn checkout
 http://hamish-cocoa-dev-examples.googlecode.com/svn/trunk/DistributedObjectsTest
 DistributedObjectsTest

 The README file explains the class layout. Any insights gratefully
 appreciated.


The reason you're seeing the error is because as soon as you receive the
response in your client, you're printing it and terminating the application
but the server is expecting a response (even though the method has a void
return value). I suspect the reason it works when you use
performSelectorWithDelay: is that the runtime knows that no response is
expected and so the message is sent asynchronously (i.e. as if you'd
specified oneway).

To fix it, add the oneway qualifier to your setAnswerText: method.

I think it would also be prudent to make sure that the client shuts down
gracefully, i.e. call [connection invalidate] at least.

You might want to go through your other methods and consider whether the
oneway qualifier should apply. You could do the same for bycopy.

-- Chris
___

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]


Getting the id of a button in a NSCollectionView

2008-07-31 Thread julius

Hi,
I have an NSCollectionView with an NSArrayController whose repeating  
NSView contains a single button.
When I create a new instance of the NSView I want to get the button's  
id without using the id that is passed with the IBAction message.

How do I do it?

Currently I have a MyElem class which represents and reacts to the  
components of the view, in this case the single button.
And MyControl which creates MyElemObject(s) and puts them into the  
NSArrayControllerOblect.


I just can't work out the bindings which I assume must be simple  
because the example posted by Kevin Hoffman of how to get data to and  
from an NSTextField inside an NSCollectionView  turned out to be simple.

http://iphone.sys-con.com/node/453742

I have tried binding (everything in sight) to NSCollectionView or  
NSArrayController with representedObject.myThing in the Model Key Path.


I assume that knowing how to do this would help me do the same thing  
if I substituted a Custom NSView for the button, i.e. that I would be  
able to get the associated view's id when a MyElemObject gets created.


Thanking you in advance
Julius


http://juliuspaintings.co.uk



___

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]


Re: compiler warning for not fully implementing protocol

2008-07-31 Thread Kyle Sluder
On Thu, Jul 31, 2008 at 7:14 PM, Mark Sanvitale [EMAIL PROTECTED] wrote:
 @interface PortalActionView : PortalTabView ReadArchiveClient


 So, PortalActionView does implement processedArchive: (without declaring it
 in its interface) but the displayCapture method is coming from its super
 class which does declare this method in its public interface, yet the
 compiler complains method definition for '-displayCapture' not found.

Re-read.  You need to specify that PortalActionView implements
-displayCapture in its interface, or else the compiler will complain.
I thought Bill was pretty clear about that.  The compiler does not
know that a class implements a protocol unless that class's interface
declares all of the protocol's required methods.

--Kyle Sluder
___

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]


Re: Making child windows move with their parents

2008-07-31 Thread Sumner Trammell
I've solved it, finally.  My mistake was not realizing that the
(WebView *)sender being passsed into webViewShow: is the CHILD
webView.  I needed to act on the parent webView before things got that
far.

I added the call to addChildWindow:ordered: and things work perfectly.
 Move the main window, and the popup moves right with it.



- (WebView *)webView:(WebView *)aSender
createWebViewWithRequest:(NSURLRequest *)aRequest {

MyDocument *theDocument = [[NSDocumentController
sharedDocumentController] openUntitledDocumentOfType:@MyDocumentType
display:YES];
[[[theDocument webView] mainFrame] loadRequest:aRequest];

//put the parent child stuff here
[[aSender window] addChildWindow:[[theDocument webView] window]
ordered:NSWindowAbove];

return [theDocument webView];
}


aSender is the parent webView that is passed into the method
[aSender window] is the parent webView's window

theDocument is the child document object
[[theDocument webView] window] is the child document's webView's window





On Thu, Jul 31, 2008 at 1:43 PM, Sumner Trammell
[EMAIL PROTECTED] wrote:
 Nope.  This version crashes as well:

 [[[self webView] window] addChildWindow:[[theDocument webView] window]
 ordered:NSWindowAbove];



 I'm getting something wrong in the way I'm looking at this problem.
 What am I not seeing?



 Thanks,
 -s




 On Thu, Jul 31, 2008 at 1:01 PM, Sumner Trammell
 [EMAIL PROTECTED] wrote:
 Thanks Graham.

 I'm beginning to wonder if this will work at all?  It just occurred to
 me that every time I click a popup-type link in my webView, that popup
 is itself a new instance of MyDocument.  I don't see how I could add
 that popup window as a child of the main window when they are separate
 document instances.  I hope I am looking at this wrong.


 A few sanity checks:

 aSender is the child webView
 [aSender window] is the child webView's window
 theDocument is the child webView's document
 [[theDocument webView] window] is the child webView's document's
 window (say that fast!)

 self is the parent document (class MyDocument)
 [self webView] is the parent document's webView
 [[self webView] window] is the parent document's webView's window


 In my mind, I want to add the child window to the parent one:

 [[[self webView] window] addChildWindow:[[theDocument webView] window]
 ordered:NSWindowAbove];


 I'll try this shortly.


 Thanks,
 -s


 On Thu, Jul 31, 2008 at 1:43 AM, Graham Cox [EMAIL PROTECTED] wrote:
 NSDocument doesn't implement -window

 I think you're getting muddled about what sender is and the relationship
 between the document and other objects. Using addChildWindow: should be OK,
 once you've sorted this out.

 hth,

 Graham

 On 31 Jul 2008, at 2:51 pm, Sumner Trammell wrote:

 but it doesn't work.  I get *** -[MyDocument window]: unrecognized
 selector sent to instance 0x1613ab30 in the run log.




___

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]


Re: Making child windows move with their parents

2008-07-31 Thread Sumner Trammell
That should be:

I added the addChildWindow:ordered: call to webView:createWebViewWithRequest:


and things work perfectly.



-s





On Thu, Jul 31, 2008 at 10:55 PM, Sumner Trammell
[EMAIL PROTECTED] wrote:
 I've solved it, finally.  My mistake was not realizing that the
 (WebView *)sender being passsed into webViewShow: is the CHILD
 webView.  I needed to act on the parent webView before things got that
 far.

 I added the call to addChildWindow:ordered: and things work perfectly.
  Move the main window, and the popup moves right with it.



 - (WebView *)webView:(WebView *)aSender
 createWebViewWithRequest:(NSURLRequest *)aRequest {

MyDocument *theDocument = [[NSDocumentController
 sharedDocumentController] openUntitledDocumentOfType:@MyDocumentType
 display:YES];
[[[theDocument webView] mainFrame] loadRequest:aRequest];

//put the parent child stuff here
[[aSender window] addChildWindow:[[theDocument webView] window]
 ordered:NSWindowAbove];

return [theDocument webView];
 }


 aSender is the parent webView that is passed into the method
 [aSender window] is the parent webView's window

 theDocument is the child document object
 [[theDocument webView] window] is the child document's webView's window





 On Thu, Jul 31, 2008 at 1:43 PM, Sumner Trammell
 [EMAIL PROTECTED] wrote:
 Nope.  This version crashes as well:

 [[[self webView] window] addChildWindow:[[theDocument webView] window]
 ordered:NSWindowAbove];



 I'm getting something wrong in the way I'm looking at this problem.
 What am I not seeing?



 Thanks,
 -s




 On Thu, Jul 31, 2008 at 1:01 PM, Sumner Trammell
 [EMAIL PROTECTED] wrote:
 Thanks Graham.

 I'm beginning to wonder if this will work at all?  It just occurred to
 me that every time I click a popup-type link in my webView, that popup
 is itself a new instance of MyDocument.  I don't see how I could add
 that popup window as a child of the main window when they are separate
 document instances.  I hope I am looking at this wrong.


 A few sanity checks:

 aSender is the child webView
 [aSender window] is the child webView's window
 theDocument is the child webView's document
 [[theDocument webView] window] is the child webView's document's
 window (say that fast!)

 self is the parent document (class MyDocument)
 [self webView] is the parent document's webView
 [[self webView] window] is the parent document's webView's window


 In my mind, I want to add the child window to the parent one:

 [[[self webView] window] addChildWindow:[[theDocument webView] window]
 ordered:NSWindowAbove];


 I'll try this shortly.


 Thanks,
 -s


 On Thu, Jul 31, 2008 at 1:43 AM, Graham Cox [EMAIL PROTECTED] wrote:
 NSDocument doesn't implement -window

 I think you're getting muddled about what sender is and the relationship
 between the document and other objects. Using addChildWindow: should be OK,
 once you've sorted this out.

 hth,

 Graham

 On 31 Jul 2008, at 2:51 pm, Sumner Trammell wrote:

 but it doesn't work.  I get *** -[MyDocument window]: unrecognized
 selector sent to instance 0x1613ab30 in the run log.





___

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]


Re: compiler warning for not fully implementing protocol

2008-07-31 Thread Adam R. Maxwell


On Jul 31, 2008, at 4:14 PM, Mark Sanvitale wrote:

I think I am doing exactly what you say is necessary (i.e. declare  
the second method in the superclass's public interface).


Here are some code snippets:


Turning your code snippets into a test program, I can't reproduce that  
compiler warning, or in a trivial test where the superclass declares/ 
implements copyWithZone: and the subclass declares conformance.  If  
this works for you, what did I miss?



// File test.m, compile  run with `cc test.m -framework Foundation -o  
test  ./test`

#import Foundation/Foundation.h

@protocol PortalTabProtocol
- (void)refreshDisplay:(id)capture because:(int)trigger;
@end

@interface PortalTabView : NSObject PortalTabProtocol
- (NSString *)tabName;
- (void)refreshDisplay:(id)capture because:(int)trigger;
- (id)displayCapture;
@end

@protocol ReadArchiveClient
- (id)displayCapture;
- (void)processedArchive:(id)archive;
@end

@interface PortalActionView : PortalTabView ReadArchiveClient
@end

@implementation PortalTabView

- (NSString *)tabName; { return nil; }
- (void)refreshDisplay:(id)capture because:(int)trigger; {}
- (id)displayCapture; { return nil; }

@end

@implementation PortalActionView

- (void)processedArchive:(id)archive {}

@end

int main (int argc, char const *argv[])
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];

id obj = [[PortalActionView alloc] init];
if ([obj conformsToProtocol:@protocol(ReadArchiveClient)])
NSLog(@PortalActionView conforms);
else
NSLog(@PortalActionView does not conform);

[pool release];
return 0;
}



smime.p7s
Description: S/MIME cryptographic signature
___

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]

Re: inspecting undo

2008-07-31 Thread Timothy Wood


On Jul 31, 2008, at 10:03 AM, I. Savant wrote:


On Thu, Jul 31, 2008 at 12:52 PM, James Maxwell
[EMAIL PROTECTED] wrote:

AFAIK there's no way to print the whole undo stack, but can I just  
see the

top?


 There's no public API for directly accessing the stacks (undo and
redo), however you could do the following:

1 - Subclass NSUndoManager.
2 - Override the appropriate methods ( -registerUndoWithTarget:... and
-prepareWithInvocationTarget: ) and provide logging before calling
super.
3 - Return a shared instance of your undo manager subclass for the
desired window(s) via the -[NSWindow windowWillReturnUndoManager:]
delegate method.

 Of course this doesn't help with the redo stack, just what's added
to the undo stack.



  If you want, you can check out our overrides for this in  
OmniFoundation's NSUndoManager(OFExtensions).


  http://www.omnigroup.com/ftp/pub/software/Source/MacOSX/Frameworks/

-tim

___

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]


Re: Adding an NSColor subclass to NSColorPanel?

2008-07-31 Thread Timothy Wood


On Jul 31, 2008, at 2:20 PM, David Springer wrote:

I would like to add instances of a subclass of NSColor to the color
panel.  The problem is, when you change to another app that does not
know about this subclass, the NSColorPanel kind of freaks out and
shows all the colors as white (even the system colors) - in some cases
it just crashes the other app.  Is there a way I can tell NSColorPanel
to add my special colors only for my app, and not affect other apps?


  The problem goes a bit deeper.  At least in the past, if the user  
puts

a custom colors on the palette of colors, it would get archived and will
other apps may raise/crash trying to unarchive load the color list from
~/Library/Colors/NSColorPanelSwatches.plist.  If you do this, it would
be good to make sure your colors *archive* themselves as normal colors,
possibly using -replacementObjectForArchiver:, substituting a stock  
color.


-tim

___

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]


Doc based app - creating a document

2008-07-31 Thread Chris Idou
I've got a core-data document based app. I need to programmatically create or 
open a document at a programmatically chosen location and display it in a 
window. This is what I tried:

[[NSDocumentController sharedDocumentController] 
makeDocumentWithContentsOfURL:url ofType:mytype error:error];
[[NSDocumentController sharedDocumentController] 
openDocumentWithContentsOfURL:url display:YES error:error];

This opens a new window, but when I hit command-S to save it says it doesn't 
know where to save and prompts me, despite me having supplied the URL of where 
to save it. However the default location it prompts is the correct location.

Then after I save it, I was hoping just the call to 
openDocumentWithContentsOfURL: would open it again, but that doesn't seem to do 
anything.

Are there some other APIs I need to be looking at?





  
___

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]


Re: NSTextView + other NSView in NSScrollView?

2008-07-31 Thread Jacob
Alright, I'm able to get a view that can resize to a NSTextView
subview's size, and it works as the document view of a scroll view,
but I'm still not sure how to make it work with another view above it.

On Mon, Jul 28, 2008 at 8:53 AM, Andy Lee [EMAIL PROTECTED] wrote:

 I don't know offhand.  A quick search on CocoaBuilder for NSTextView 
 flipped turns up this suggestion to flip the superview:

 http://www.cocoabuilder.com/archive/message/cocoa/2004/6/20/110164

 But I haven't read it closely.

 --Andy

 On Jul 28, 2008, at 11:09 AM, Jacob Bandes-Storch wrote:

 On Jul 28, 2008, at 7:48 AM, Andy Lee [EMAIL PROTECTED] wrote:

 On Jul 27, 2008, at 11:31 PM, Jacob Bandes-Storch wrote:

 I'm trying to create a Mail-style scroll view, with a view for information 
 (like the view for message headers) above a text view for the content. I 
 created two NSViews in Interface Builder, changed the class of the bottom 
 one to NSTextView,

 Just one more thought: I think some people have mentioned unexpected 
 resizing behavior because they didn't take into account the fact that 
 NSTextView uses a flipped coordinate system.

 Yes, I was wondering about that. It seems like that's the issue I run into 
 when trying to use an NSTextView that's not the documentView of the 
 NSScrollView. What can I do to work around that?

___

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]