Re: Finder's sidebar background color

2008-11-16 Thread Benjamin Dobson
Well, it is kind of a source list (a list of command descriptions).  
It is hard to explain in words, please take a look at the link to  
OnMyCommand I've posted earlier.


However, I do think it really fits its purpose :D


I agree, but I don't understand why a real source list doesn't do what  
you want.

___

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: Playing around with BWToolKit

2008-11-16 Thread Brandon Walkin

Hi Dave,

If the user isn't able to configure the toolbar, then all you need to  
do is get a reference to the BWSelectableToolbar and call this method  
on it:


- (void)switchToItemAtIndex:(int)anIndex animate:(BOOL)shouldAnimate

The index is the raw toolbar index - it's zero based and includes  
spaces and separators. And in your case you'd pass in NO for  
animation. In a future version of BWToolkit, I'll likely make this  
more obvious and base it on the item identifier or the item label  
rather than the index.


Cheers,
Brandon


On 15-Nov-08, at 8:51 PM, Dave DeLong wrote:


Hey everyone,

I've been playing around with Brandon's new BWToolKit, and I was  
wondering if there's any way to hook the ToolbarItems up through  
code.  I've got a window with four different sections, and I want to  
have some NSMenuItems that, when selected, will open the window to  
the appropriate section.


The closest I've come is to grab all the item identifiers and select  
them that way, but I was wondering if anyone's found a more robust  
way to do that.


Thanks,

Dave
___

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/bwalkin%40gmail.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: Configure a button added in IB

2008-11-16 Thread Mikael Wämundson

Thanks! Works like a charm.
Didn't work at first because I put

theButton = [[NSButton alloc] init];
before the
[theButton setTitle:@send steve money];

When that was removed, it worked ok (and you will probably get your  
money).


wamund

16 nov 2008 kl. 02.48 skrev Steven Riggs:


To do it from code, add something like..
IBOutlet NSButton *theButton;
...to your .h

Instanitate your class in interface builder and then connect  
theButton to your button my control dragging from your class to the  
button.


and then use the documentation here: 
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSButton_Class/Reference/Reference.html

...to learn what kind of messages you can send to it.

ex.  [theButton setTitle:@send steve money];

:-)

Good luck,
   Steven Riggs

On Nov 15, 2008, at 7:04 PM, Mikael Wämundson wrote:


Am a quite a newbie to Cocoa programming.
Adding and configuring a button in IB is straightforward. I  
understand the process of setting action and target in IB and the  
connection to Xcode (IBOutlet and IBAction).
But what is the approach when creating a button in IB that I then  
want to configure (set title, image, enabled, etc.) in Xcode? How  
do I reach the button from Xcode?


wamund
___

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/steven.riggs 
%40me.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: Playing around with BWToolKit

2008-11-16 Thread Brandon Walkin


On 16-Nov-08, at 5:10 AM, Nathan Kinsinger wrote:


On Nov 16, 2008, at 1:50 AM, Brandon Walkin wrote:


Hi Dave,

If the user isn't able to configure the toolbar, then all you need  
to do is get a reference to the BWSelectableToolbar and call this  
method on it:


- (void)switchToItemAtIndex:(int)anIndex animate:(BOOL)shouldAnimate

The index is the raw toolbar index - it's zero based and includes  
spaces and separators. And in your case you'd pass in NO for  
animation. In a future version of BWToolkit, I'll likely make this  
more obvious and base it on the item identifier or the item label  
rather than the index.


Cheers,
Brandon


On 15-Nov-08, at 8:51 PM, Dave DeLong wrote:


Hey everyone,

I've been playing around with Brandon's new BWToolKit, and I was  
wondering if there's any way to hook the ToolbarItems up through  
code.  I've got a window with four different sections, and I want  
to have some NSMenuItems that, when selected, will open the window  
to the appropriate section.


The closest I've come is to grab all the item identifiers and  
select them that way, but I was wondering if anyone's found a more  
robust way to do that.


Thanks,

Dave


I've been playing with this too, and I used -setSelectedIndex:  
because that is in your header and -switchToItemAtIndex:animate: is  
marked as private. I also tried using NSToolbar's - 
setSelectedItemIdentifier:, however that causes the toolbar icon to  
change but not the view, so you may want to override that.


1) add:
- (void)setSelectedItemIdentifier:(NSString *)itemIdentifier
{
  selectedIndex = [itemIdentifiers indexOfObject:itemIdentifier];
  [self switchToItemAtIndex:[self  
toolbarIndexFromSelectableIndex:selectedIndex] animate:YES];

}

2) change line 284 in -selectItemAtIndex: to call supers  
implementation:

[super setSelectedItemIdentifier:identifier];

Using the label to change the toolbar selection is not a good idea  
because the labels may be localized and then they won't match. And  
using the index only works for toolbars that can't be modified. You  
could create a custom NSToolbarItem class in IB and add the  
identifier to the IB inspector, that way developers can set custom  
identifiers in IB like they can when creating the toolbar items in  
code.


One more thing, any of the headers (like BWSelectableToolbar.h) that  
users of your framework may need to use your classes, should be  
marked as public so that the headers are exported with the framework  
and then we can include them like:

#import BWToolkitFramework/BWSelectableToolbar.h


--Nathan



Thanks for the suggestions. I'll implement them for the next release.

Just a note: I'm tracking issues on Bitbucket so if you have any other  
bugs or feature enhancements, please post them there. http://www.bitbucket.org/bwalkin/bwtoolkit/issues/


Cheers,
Brandon


___

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: Playing around with BWToolKit

2008-11-16 Thread Nathan Kinsinger

On Nov 16, 2008, at 1:50 AM, Brandon Walkin wrote:


Hi Dave,

If the user isn't able to configure the toolbar, then all you need  
to do is get a reference to the BWSelectableToolbar and call this  
method on it:


- (void)switchToItemAtIndex:(int)anIndex animate:(BOOL)shouldAnimate

The index is the raw toolbar index - it's zero based and includes  
spaces and separators. And in your case you'd pass in NO for  
animation. In a future version of BWToolkit, I'll likely make this  
more obvious and base it on the item identifier or the item label  
rather than the index.


Cheers,
Brandon


On 15-Nov-08, at 8:51 PM, Dave DeLong wrote:


Hey everyone,

I've been playing around with Brandon's new BWToolKit, and I was  
wondering if there's any way to hook the ToolbarItems up through  
code.  I've got a window with four different sections, and I want  
to have some NSMenuItems that, when selected, will open the window  
to the appropriate section.


The closest I've come is to grab all the item identifiers and  
select them that way, but I was wondering if anyone's found a more  
robust way to do that.


Thanks,

Dave


I've been playing with this too, and I used -setSelectedIndex: because  
that is in your header and -switchToItemAtIndex:animate: is marked as  
private. I also tried using NSToolbar's -setSelectedItemIdentifier:,  
however that causes the toolbar icon to change but not the view, so  
you may want to override that.


1) add:
- (void)setSelectedItemIdentifier:(NSString *)itemIdentifier
{
selectedIndex = [itemIdentifiers indexOfObject:itemIdentifier];
	[self switchToItemAtIndex:[self  
toolbarIndexFromSelectableIndex:selectedIndex] animate:YES];

}

2) change line 284 in -selectItemAtIndex: to call supers implementation:
[super setSelectedItemIdentifier:identifier];

Using the label to change the toolbar selection is not a good idea  
because the labels may be localized and then they won't match. And  
using the index only works for toolbars that can't be modified. You  
could create a custom NSToolbarItem class in IB and add the identifier  
to the IB inspector, that way developers can set custom identifiers in  
IB like they can when creating the toolbar items in code.


One more thing, any of the headers (like BWSelectableToolbar.h) that  
users of your framework may need to use your classes, should be marked  
as public so that the headers are exported with the framework and then  
we can include them like:

#import BWToolkitFramework/BWSelectableToolbar.h


--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]


Archiving NSError

2008-11-16 Thread Vera Tkachenko

Hello to mac developers :)
If I don't misunderstand things NSError objects can be archived  
because NSError implements NSCoding protocol.

I try to archive it as follows:

NSMutableDictionary * dict = [[NSMutableDictionary alloc] init];
	NSError * error = [[NSError alloc] initWithDomain: @TestDomain  
code: 1 userInfo: nil];


[dict setObject:error forKey:@Error];
[dict setObject:@OperationName forKey:@Operation];
[dict writeToFile:@/Users/ivira/temp atomically:YES];

Without placing error into dict it work's ok. What am I doing wrong?

--  
With regards, Vera Tkachenko

[ICQ#230923300]
[web http://vera.org.ua]




___

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: Archiving NSError

2008-11-16 Thread Jean-Daniel Dupas


Le 16 nov. 08 à 15:41, Vera Tkachenko a écrit :


Hello to mac developers :)
If I don't misunderstand things NSError objects can be archived  
because NSError implements NSCoding protocol.

I try to archive it as follows:

NSMutableDictionary * dict = [[NSMutableDictionary alloc] init];
	NSError * error = [[NSError alloc] initWithDomain: @TestDomain  
code: 1 userInfo: nil];


[dict setObject:error forKey:@Error];
[dict setObject:@OperationName forKey:@Operation];
[dict writeToFile:@/Users/ivira/temp atomically:YES];

Without placing error into dict it work's ok. What am I doing wrong?


You try to serialize it not archiving it.

See this guide for the difference between the two technics:

http://developer.apple.com/documentation/Cocoa/Conceptual/Archiving/Archiving.html


___

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: Archiving NSError

2008-11-16 Thread Mike Abdullah
Have a look at the documentation for -writeToFile:atomically: In  
particular this quote:


This method recursively validates that all the contained objects are  
property list objects (instances of NSData, NSDate, NSNumber,  
NSString, NSArray, or NSDictionary) before writing out the file, and  
returnsNO if all the objects are not property list objects, since the  
resultant file would not be a valid property list.


What is your real goal? Do you want a plist where the Error key is an  
archived NSError object, or just an archived version of the  
dictionarty? I'm going to guess the former in which case you would  
change your code to do:


[dict setObject:[NSKeyedArchiver archivedDataWithRootObject:error]  
forKey:@Error];


On 16 Nov 2008, at 14:41, Vera Tkachenko wrote:


Hello to mac developers :)
If I don't misunderstand things NSError objects can be archived  
because NSError implements NSCoding protocol.

I try to archive it as follows:

NSMutableDictionary * dict = [[NSMutableDictionary alloc] init];
	NSError * error = [[NSError alloc] initWithDomain: @TestDomain  
code: 1 userInfo: nil];


[dict setObject:error forKey:@Error];
[dict setObject:@OperationName forKey:@Operation];
[dict writeToFile:@/Users/ivira/temp atomically:YES];

Without placing error into dict it work's ok. What am I doing wrong?

-- With regards, Vera Tkachenko
[ICQ#230923300]
[web http://vera.org.ua]




___

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/cocoadev%40mikeabdullah.net

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: Layer-backed NSOpenGLView not showing up

2008-11-16 Thread David Duncan

On Oct 3, 2008, at 9:46 AM, Albert Martin wrote:


videoLayer = [[CALayer layer] retain];

NSOpenGLPixelFormatAttribute attributes[] = {
NSOpenGLPFANoRecovery,

   NSOpenGLPFAColorSize, 24,
   NSOpenGLPFAAlphaSize, 8,
   NSOpenGLPFADepthSize, 16,
   NSOpenGLPFADoubleBuffer,
   NSOpenGLPFAAccelerated,
0};

presentationVideoLayer = [[[IWVideoView alloc] initWithFrame:  
NSMakeRect(0, 0, frameRect.size.width, frameRect.size.height)  
pixelFormat: [[NSOpenGLPixelFormat alloc]  
initWithAttributes:attributes]] retain];

[presentationVideoLayer setLayer: videoLayer];
[presentationVideoLayer setWantsLayer: YES];

[[self layer] addSublayer: videoLayer];

[presentationVideoLayer setNeedsDisplay: YES];
[[presentationVideoLayer openGLContext] update];


There are number issues here.

One is as Matt mentioned, your using a plain CALayer when a  
CAOpenGLLayer is called for. A plain CALayer will not render OpenGL  
content. In this simple case, you will likely want to just let AppKit  
create the layer for you (by not calling setLayer:).


Two, your trying to add a layer as a sublayer of itself. That won't  
work for obvious reasons :). But then, you shouldn't be playing with  
this layer anyway.


Third, and this one might not actually be an issue for you, is that  
there is a bug in AppKit that causes layer-backed NSOpenGLViews to use  
the wrong pixel format for their CAOpenGLLayers. Specifically, if you  
really need a depth buffer (and aren't just copying a pixel format  
from elsewhere) then you will need to create your own CAOpenGLLayer  
subclass and do the proper work there. You can see the  
CALayerEssentials sample http://developer.apple.com/samplecode/CALayerEssentials/index.html 
 for details on how to do that.


This is just an aside, but I notice when you create your view you do  
alloc/init.../retain - this usually indicates that you are going to  
leak sometime in the future as you are claiming two counts of  
ownership on the view. This may be what you want, but it usually  
isn't, so thats why I point it out.

--
David Duncan
Apple DTS Animation and Printing

___

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]


NSArrayController bound to an array of strings

2008-11-16 Thread Meik Schuetz

Dear all,
If have seen lots of examples in which a NSTableView is bound to an  
NSArrayController which is bound to an array of entity objects, having  
various properties. However I am now trying to bind a table column to  
an array of strings and I don't seem to get this working. The string  
contents show up correctly, but when I try to modify an existing item,  
or add a new item, I get the error


Error setting value for key path  of object  (from bound object  
NSTableColumn: 0x10bb40(null)): [NSCFString 0xa0609328  
setValue:forUndefinedKey:]: this class is not key value coding- 
compliant for the key .


I got the NSArrayController bound to the NSMutableArray property of my  
AppController class. I set the class to NSMutableString (also tries  
NSString). The NSTableView is bound to the NSArrayController, as well  
as the table column.


Do I really need to create a class which only contains a string  
property to get this working, or is there any trick that I don't know  
about.


Thanks a lot for any suggestions.
Best regards
Meik

___

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]


NSView positioning problems

2008-11-16 Thread Andre Masse

Hi all,

In a nib, I have a view (OutputView) which contains a table view and a  
custom view (OutputToolbarView) which will be loaded from another nib.  
This view will end up in a NSTabView. So in IB, I placed a dummy  
custom view above the table view like this:


-
| custom|
-
|   |
|  table view   |
|   |
|___|

In the window controller -windowDidLoad method, I load the the  
OutputView which loads the OutputToolbarView (each have their own  
NSViewControllers).


Now, I tried to make the replacement in the OutputView's controller  
awakeFromNib method but this puts the custom view on top of the table  
view, positioned at the origin specified for the custom view in the  
nib. That's because the replacement happens before the table view had  
the chance to resize itself according to the window's height (I  
think). If instead of replacing the custom view, I add it as a subview  
of the dummy custom view, the origin is correct but it doesn't fill  
the window's width.


I've read the documentation about NSView and it's companion guide but  
it's a big chunk to swallow and I would like to see a simple example  
on where to put the code for replacing a view.


Thanks,

Andre Masse
___

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: NSArrayController bound to an array of strings

2008-11-16 Thread Chris Suter
On Mon, Nov 17, 2008 at 4:45 AM, Meik Schuetz [EMAIL PROTECTED] wrote:
 Dear all,
 If have seen lots of examples in which a NSTableView is bound to an
 NSArrayController which is bound to an array of entity objects, having
 various properties. However I am now trying to bind a table column to an
 array of strings and I don't seem to get this working. The string contents
 show up correctly, but when I try to modify an existing item, or add a new
 item, I get the error

 Error setting value for key path  of object  (from bound object
 NSTableColumn: 0x10bb40(null)): [NSCFString 0xa0609328
 setValue:forUndefinedKey:]: this class is not key value coding-compliant for
 the key .

 I got the NSArrayController bound to the NSMutableArray property of my
 AppController class. I set the class to NSMutableString (also tries
 NSString). The NSTableView is bound to the NSArrayController, as well as the
 table column.

 Do I really need to create a class which only contains a string property to
 get this working, or is there any trick that I don't know about.

The only trick I can think of is to use string as the model key and
then, because NSString doesn't have a string method, you need to add
a category method to NSString:

- (NSString *)string
{
  return self;
}

Having said that, it's not a particularly nice way of doing things and
you need to make sure you use mutable strings (which you might not
need otherwise). If I were you, I'd create a new object. You might
find that you want to add more columns to the table in future.

-- 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]


Re: NSView positioning problems

2008-11-16 Thread Iceberg-Dev


On Nov 16, 2008, at 7:25 PM, Andre Masse wrote:


Hi all,

In a nib, I have a view (OutputView) which contains a table view  
and a custom view (OutputToolbarView) which will be loaded from  
another nib. This view will end up in a NSTabView. So in IB, I  
placed a dummy custom view above the table view like this:


-
| custom|
-
|   |
|  table view   |
|   |
|___|

In the window controller -windowDidLoad method, I load the the  
OutputView which loads the OutputToolbarView (each have their own  
NSViewControllers).


Now, I tried to make the replacement in the OutputView's controller  
awakeFromNib method but this puts the custom view on top of the  
table view, positioned at the origin specified for the custom view  
in the nib. That's because the replacement happens before the table  
view had the chance to resize itself according to the window's  
height (I think). If instead of replacing the custom view, I add it  
as a subview of the dummy custom view, the origin is correct but it  
doesn't fill the window's width.


I've read the documentation about NSView and it's companion guide  
but it's a big chunk to swallow and I would like to see a simple  
example on where to put the code for replacing a view.


In both cases, you can't just replace or insert a view and hope its  
frame will be correct.


If you want to replace the custom view, you need to:

1) Get the frame of the custom view

2) Set this frame to be the one of your replacement view (better if  
done before adding the view)


If you want to insert your view inside the custom view, you need to:

1) Get the bounds of the custom view

2) Set these bounds to be the frame of your view (better if done  
before adding the view).



___

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: NSView positioning problems

2008-11-16 Thread Quincey Morris

On Nov 16, 2008, at 10:25, Andre Masse wrote:

In a nib, I have a view (OutputView) which contains a table view and  
a custom view (OutputToolbarView) which will be loaded from another  
nib. This view will end up in a NSTabView. So in IB, I placed a  
dummy custom view above the table view like this:


-
| custom|
-
|   |
|  table view   |
|   |
|___|

In the window controller -windowDidLoad method, I load the the  
OutputView which loads the OutputToolbarView (each have their own  
NSViewControllers).


Now, I tried to make the replacement in the OutputView's controller  
awakeFromNib method but this puts the custom view on top of the  
table view, positioned at the origin specified for the custom view  
in the nib. That's because the replacement happens before the table  
view had the chance to resize itself according to the window's  
height (I think). If instead of replacing the custom view, I add it  
as a subview of the dummy custom view, the origin is correct but it  
doesn't fill the window's width.


There's not quite enough information here to be certain what's going  
on, but in a sense it shouldn't matter *when* you do the replacement,  
as long as it's an *exact* replacement at the time when you do it. In  
particular, that means:


-- setting the OutputToolbarView's frame to DummyToolbarView's frame  
just before you add it to OutputView's subviews


-- making sure that OutputToolbarView's autoresize flags are identical  
to DummyToolbarView's autoresize flags, which have presumably been set  
up in IB to get the resizing behavior your want.


I suspect that #2 is the problem here.


___

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]


Core data save error with multiple persistent stores

2008-11-16 Thread Arthur C .

In my application I have two managed object contexts, as I need to be able to 
save two subsets of my Core Data setup separately. 
These are both using one and the same persistent store coordinator; the 
coordinator has two stores. 
 
I take care that every object instance gets inserted into the right 
managedObjectContext, by using [NSEntityDescription 
insertNewObjectForEntityForName: ...]. And it gets assigned to the right 
persistent store by using
 
- (void) awakeFromInsert
{
   ...
   [managedObjectContext assignObject:self toPersistentStore: 
[persistentStoreCoordinator persistentStoreForURL: url]];
}.
There are no relationships between objects in different persistent stores, as 
it should be.
 
This seems to work OK on one system, but leads to a strange error on two other 
systems (for the same program).
 
When a change has been made to the Core Data objects (e.g. adding an instance), 
the 'save' action of the managedObjectContext gives an exception (no error 
screen) saying 'can't reassign object to a different store once it has been 
saved'. 
This means the Core Data stack cannot be saved anymore, which is of course a 
serious problem. 
 
Do you know what causes this error? Do I need to use a different setup for the 
managedObjectContext - persistentStoreCoordinator - persistentStores system?
 
 
Thanks for your time,
Arthur C.
 
 
_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/___

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: NSArrayController bound to an array of strings

2008-11-16 Thread Andy Lee

On Nov 16, 2008, at 1:45 PM, Chris Suter wrote:

The only trick I can think of is to use string as the model key and
then, because NSString doesn't have a string method, you need to add
a category method to NSString:

- (NSString *)string
{
 return self;
}


I don't know bindings, but it might help to know there is aleady a - 
self method that returns self.


--Andy


___

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: NSView positioning problems

2008-11-16 Thread Andy Lee

On Nov 16, 2008, at 2:41 PM, Quincey Morris wrote:
There's not quite enough information here to be certain what's going  
on, but in a sense it shouldn't matter *when* you do the  
replacement, as long as it's an *exact* replacement at the time when  
you do it. In particular, that means:


-- setting the OutputToolbarView's frame to DummyToolbarView's frame  
just before you add it to OutputView's subviews


-- making sure that OutputToolbarView's autoresize flags are  
identical to DummyToolbarView's autoresize flags, which have  
presumably been set up in IB to get the resizing behavior your want.


Does -[NSView replaceSubview:with:] take care of these?

--Andy

___

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: Core data save error with multiple persistent stores

2008-11-16 Thread Quincey Morris

On Nov 16, 2008, at 12:02, Arthur C. wrote:

I take care that every object instance gets inserted into the right  
managedObjectContext, by using [NSEntityDescription  
insertNewObjectForEntityForName: ...]. And it gets assigned to the  
right persistent store by using


- (void) awakeFromInsert
{
  ...
  [managedObjectContext assignObject:self toPersistentStore:  
[persistentStoreCoordinator persistentStoreForURL: url]];

}.
There are no relationships between objects in different persistent  
stores, as it should be.


This seems to work OK on one system, but leads to a strange error on  
two other systems (for the same program).


When a change has been made to the Core Data objects (e.g. adding an  
instance), the 'save' action of the managedObjectContext gives an  
exception (no error screen) saying 'can't reassign object to a  
different store once it has been saved'.
This means the Core Data stack cannot be saved anymore, which is of  
course a serious problem.


Do you know what causes this error? Do I need to use a different  
setup for the managedObjectContext - persistentStoreCoordinator -  
persistentStores system?


The example in the documentation:

	http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdCreateMOs.html#/ 
/apple_ref/doc/uid/TP40001654-SW2


does the assignment immediately after the  
insertNewObjectForEntityForName call, not in awakeFromInsert.


I'm wondering if undo is what's causing your problem. If not undo,  
then some other circumstances that leads to awakeFromInsert being  
called when the object is not really brand-new.


Have you tried doing it the way Apple's example shows?


___

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]


Using NSDateFormatter on NSPopUpButton in IB

2008-11-16 Thread Mikael Wämundson

Hi all experienced developers!

It is possible to apply a NSDateFormatter on a NSPopUpButton in IB,  
but whatever settings I do with the formatter I can't get it to format  
the date. The PopUpButton is connected to an ArrayController using  
binding. The array contains objects with a NSCalendarDate variable.  
This variable is used in the binding.


Any suggestions?

/wamund
___

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: NSView positioning problems

2008-11-16 Thread Quincey Morris

On Nov 16, 2008, at 12:16, Andy Lee wrote:


Does -[NSView replaceSubview:with:] take care of these?


IDK, but I see nothing in the documentation to suggest that it does  
anything but deal with the subview ordering. If it does, that would be  
useful information to know.

___

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: NSView positioning problems

2008-11-16 Thread Andy Lee

On Nov 16, 2008, at 3:30 PM, Quincey Morris wrote:

On Nov 16, 2008, at 12:16, Andy Lee wrote:


Does -[NSView replaceSubview:with:] take care of these?


IDK, but I see nothing in the documentation to suggest that it does  
anything but deal with the subview ordering.


Which makes me realize, if I had to ask even after checking the docs,  
the docs could be more clear.  I've submitted feedback.


--Andy


___

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]


XML Datasource question on persistence

2008-11-16 Thread Mark McCray
Hey there,I'm wondering if anyone has any guidance on something.

I'm getting an xml datafeed every so often that should populate data for my
iphone app.

I could keep this file local and read every time the app starts up and
update it every so often from the web. I could also parse the xml into a
sqlite db and use the sqlite db as the datasource for the app.

I just wonder if anyone has any opinion on how best to persist the data.

Thanks,
Mark
___

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: NSView positioning problems

2008-11-16 Thread Andre Masse
Quincey you were right on the money: the new view had a wrong flag  
(anchored to the bottom).


Thanks a lot to everyone,

Andre Masse

On Nov 16, 2008, at 14:41, Quincey Morris wrote:

There's not quite enough information here to be certain what's going  
on, but in a sense it shouldn't matter *when* you do the  
replacement, as long as it's an *exact* replacement at the time when  
you do it. In particular, that means:


-- setting the OutputToolbarView's frame to DummyToolbarView's frame  
just before you add it to OutputView's subviews


-- making sure that OutputToolbarView's autoresize flags are  
identical to DummyToolbarView's autoresize flags, which have  
presumably been set up in IB to get the resizing behavior your want.


I suspect that #2 is the problem here.

___

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: Core data save error with multiple persistent stores

2008-11-16 Thread Arthur C .





From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Core data save error with multiple 
persistent storesDate: Sun, 16 Nov 2008 21:02:37 +0100

In my application I have two managed object contexts, as I need to be able to 
save two subsets of my Core Data setup separately. These are both using one and 
the same persistent store coordinator; the coordinator has two stores.  I take 
care that every object instance gets inserted into the right 
managedObjectContext, by using [NSEntityDescription 
insertNewObjectForEntityForName: ...]. And it gets assigned to the right 
persistent store by using - (void) awakeFromInsert{   ...   
[managedObjectContext assignObject:self toPersistentStore: 
[persistentStoreCoordinator persistentStoreForURL: url]];}.There are no 
relationships between objects in different persistent stores, as it should be. 
This seems to work OK on one system, but leads to a strange error on two other 
systems (for the same program). When a change has been made to the Core Data 
objects (e.g. adding an instance), the 'save' action of the 
managedObjectContext gives an exception (no error screen) saying 'can't 
reassign object to a different store once it has been saved'. This means the 
Core Data stack cannot be saved anymore, which is of course a serious problem.  
Do you know what causes this error? Do I need to use a different setup for the 
managedObjectContext - persistentStoreCoordinator - persistentStores system?  
Thanks for your time,Arthur C.  
 
 The example in the documentation:   
 http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdCreateMOs.html#/
  /apple_ref/doc/uid/TP40001654-SW2does the assignment immediately after 
 the  insertNewObjectForEntityForName call, not in awakeFromInsert.
All right, but that does not cover the case of an object being added using the 
'add' button linked to the array controller (which btw is bound to the correct 
managedObjectContext). Then you end up directly in awakeFromInsert, which at 
least should be OK if it is executed only once.
I'm wondering if undo is what's causing your problem. If not undo,  then some 
other circumstances that leads to awakeFromInsert being  called when the 
object is not really brand-new.
I'll check that. Undo is probably not the problem, we can trigger the error 
without doing an undo operation.
 
Have you tried doing it the way Apple's example shows? 
 
I'll do that, but as said, it's incomplete and the awakeFromInsert will still 
be needed...
 
 
Thanks so far,
Arthur C.
_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/___

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]


NSExpression and CAST (NSPredicate)

2008-11-16 Thread Chris Idou

NSExpression contains the following mysterious information:

All methods must take 0 or more id arguments and return an id value, although 
you can use the CAST expression to convert datatypes with lossy string 
representations (for example, CAST(, NSDate)). The CAST
expression is extended in Mac OS X v10.5 to provide support for casting
to classes for use in creating receivers for function expressions.

The Predicate programming guide doesn't seem to shed any more light on it.

Can anybody tell me any more about the mysterious CAST expressions?




  Make the switch to the world#39;s best email. Get Yahoo!7 Mail! 
http://au.yahoo.com/y7mail
___

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: XML Datasource question on persistence

2008-11-16 Thread Chris Idou

I would say it depends on how big the dataset is. If the data is small and/or 
you have to slurp it all into memory anyway, then I like the simplicity of just 
keeping it as XML. But if the data is arbitrarily large and/or you don't want 
it all in memory at once, then going to sqlite becomes somewhat of a necessity.


--- On Sun, 16/11/08, Mark McCray [EMAIL PROTECTED] wrote:
From: Mark McCray [EMAIL PROTECTED]
Subject: XML Datasource question on persistence
To: cocoa-dev@lists.apple.com
Received: Sunday, 16 November, 2008, 1:18 PM

Hey there,I'm wondering if anyone has any guidance on something.

I'm getting an xml datafeed every so often that should populate data for my
iphone app.

I could keep this file local and read every time the app starts up and
update it every so often from the web. I could also parse the xml into a
sqlite db and use the sqlite db as the datasource for the app.

I just wonder if anyone has any opinion on how best to persist the data.

Thanks,
Mark
___

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/idou747%40yahoo.com

This email sent to [EMAIL PROTECTED]



  Make the switch to the world#39;s best email. Get Yahoo!7 Mail! 
http://au.yahoo.com/y7mail
___

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]


newbie NSMutable dictionary subclass question

2008-11-16 Thread Bob Sabiston
Can the value part of a key-value pair in an NSMutableDictionary be a  
literal NSString, like @name?


It would seem so, because this works or at least doesn't crash:

NSMutableDictionary *bobo;
bobo = [[NSMutableDictionary alloc] init];
[bobo setValue:@root forKey:@name];


However, I have a class derived from NSMutableDictionary, and it is  
crashing when I try to do the same thing:



@interface myClass : NSMutableDictionary {
}
@end

myClass *tree;
tree = [[myClass alloc] init];
[tree setValue:@root forKey:@name];


Why does that crash when the first does not?  Are subclasses required  
to have member variables, or can they just have new functions?  Mine  
don't have any variables, maybe that is the problem?


Thanks for any replies!
Bob

___

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: newbie NSMutable dictionary subclass question

2008-11-16 Thread Chris Suter
 Why does that crash when the first does not?  Are subclasses required to
 have member variables, or can they just have new functions?  Mine don't have
 any variables, maybe that is the problem?

See:


http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_9.html#//apple_ref/doc/uid/TP40002974-CH4-DontLinkElementID_105

-- 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]


Fetch value from field editor during editing?

2008-11-16 Thread Russ

I need to be able to find the current value of a NSTextField even if it is 
being edited. I have the following code to check if it is being edited, and get 
the value from the field editor instead:

fresp = [[txtf window] firstResponder];
if ([fresp isKindOfClass:[NSTextView class]]  [(NSTextView*)fresp 
delegate] == txtf)
str = [(NSTextView*)fresp string];// being edited, 
get from field editor
else
str = [txtf stringValue];// not being edited, get from 
textfield itself

When the text field (txtf) is being edited, the first case is definitely used, 
but the wrong value still results. Ie suppose the original textfield contained 
100, I click on it to edit it and change the value to 140. Now the code above 
runs (while the text field is still being edited). The result is the original 
100, not the current 140, even though it is the field editor that is being 
queried. 

How do I get the correct current value? This is a generic query, it can't end 
editing on the field or otherwise change the state. Needless to say, I'm more 
than a little surprised by this behavior. The whole field editor thing is kind 
of like hanging your underwear to dry in the living room to start with. Now the 
actual state seems to be even more opaque.

Thanks.



  
___

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]


Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

Greetings.

I'm having a weird behaviour, i have 2 arrays declared in the same  
controller, and for some reason they both share the same memory space.
well actually in debug they share the same pointer, witch is not  
something I asked for.


the bonjourservices and the mounts array's are the ones geting the  
same pointer.


here is my code.

NSMutableArray *bonjourServices;
NSMutableArray *mounts;


		transportTypes = [NSArray  
arrayWithObjects:@afp,@smb,@cifs,@nfs,nil];


mounts = [[NSMutableArray alloc] init];
		[mounts initWithContentsOfFile:[[self applicationSupportFolder]  
stringByAppendingPathComponent:@Bonjour Mounter.plist]];	


		// the bonjourScanner sends a notification when the content of the  
passed array is modified, we will pick it up here.

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(bonjourServiceNotigficationUpdate)
 name:SERVICE_ADD_REMOVE_NOTIFICATION
 object:nil];

bonjourServices = [[NSMutableArray alloc]init];

AFPScanner = [[BonjourScanner alloc]init];
SMBScanner = [[BonjourScanner alloc]init];
NFSScanner = [[BonjourScanner alloc]init];
AFPScanner.bonjourServices = bonjourServices;
SMBScanner.bonjourServices = bonjourServices;
NFSScanner.bonjourServices = bonjourServices;

[AFPScanner searchForService:@_afpovertcp._tcp. domain:nil];
[SMBScanner searchForService:@_smb._tcp. domain:nil];
[NFSScanner searchForService:@_nfs._tcp. domain:nil];

did anyone ever have that kind of problem ? i'm a little puzzled,
thank you ...

Sandro Noel.

___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
I just declared a third NSMutableArray to see if that one would have a  
different pointer, and well it had the same pointer somehow...

what is this ?

is it some type of setting ?

Sandro Noel.

On 16-Nov-08, at 11:22 PM, Sandro Noel wrote:


Greetings.

I'm having a weird behaviour, i have 2 arrays declared in the same  
controller, and for some reason they both share the same memory space.
well actually in debug they share the same pointer, witch is not  
something I asked for.


the bonjourservices and the mounts array's are the ones geting the  
same pointer.


here is my code.

NSMutableArray *bonjourServices;
NSMutableArray *mounts;


		transportTypes = [NSArray  
arrayWithObjects:@afp,@smb,@cifs,@nfs,nil];


mounts = [[NSMutableArray alloc] init];
		[mounts initWithContentsOfFile:[[self applicationSupportFolder]  
stringByAppendingPathComponent:@Bonjour Mounter.plist]];	


		// the bonjourScanner sends a notification when the content of the  
passed array is modified, we will pick it up here.

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(bonjourServiceNotigficationUpdate)
 name:SERVICE_ADD_REMOVE_NOTIFICATION
 object:nil];

bonjourServices = [[NSMutableArray alloc]init];

AFPScanner = [[BonjourScanner alloc]init];
SMBScanner = [[BonjourScanner alloc]init];
NFSScanner = [[BonjourScanner alloc]init];
AFPScanner.bonjourServices = bonjourServices;
SMBScanner.bonjourServices = bonjourServices;
NFSScanner.bonjourServices = bonjourServices;

[AFPScanner searchForService:@_afpovertcp._tcp. domain:nil];
[SMBScanner searchForService:@_smb._tcp. domain:nil];
[NFSScanner searchForService:@_nfs._tcp. domain:nil];

did anyone ever have that kind of problem ? i'm a little puzzled,
thank you ...

Sandro Noel.

___

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/sandro.noel%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: Two arrays sharing the same adress space.

2008-11-16 Thread Markus Spoettl

On Nov 16, 2008, at 8:22 PM, Sandro Noel wrote:

mounts = [[NSMutableArray alloc] init];
		[mounts initWithContentsOfFile:[[self applicationSupportFolder]  
stringByAppendingPathComponent:@Bonjour Mounter.plist]];	



You are initializing mounts twice, and you're also throwing away  
what the second initialization returns (which may be different from  
the first because init can cause new objects to be returned). I  
suppose your code should be:


mounts = [[NSMutableArray alloc] initWithContentsOfFile:[[self  
applicationSupportFolder] stringByAppendingPathComponent:@Bonjour  
Mounter.plist]];


Regards
Markus
--
__
Markus Spoettl



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: Two arrays sharing the same adress space.

2008-11-16 Thread Scott Ribe
At what point in the code are you checking? Is this a release build, or a
debug build in which you've gone  enabled some optimizations?

In the code you posted mounts is init'd (twice actually, which is
unecessary), then never used. It's perfectly possible that the two variables
mounts  bonjourServices will be stored in the same register--depending on
compiler settings.

In other words, the two arrays would certainly have different addresses. But
since you're not referring to mounts after it's initialized, the space where
the pointer to mounts is stored can be reused to store the different pointer
to bonjourServices.

Step it line by line, and watch the values of those variables. Or actually
do something with mounts later in the method. Or get rid of mounts if you're
not going to use it.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

Scott.

thank you for your explanation.

Mounts is being used, but just not in the init function.
it is being used later in the code.

that is why i was geting confused because the 2 arrays, are not meant  
to hold the same type of data.

and right now, they contain mixed data type.

witch makes my other functions crash.

On 16-Nov-08, at 11:37 PM, Scott Ribe wrote:

At what point in the code are you checking? Is this a release build,  
or a

debug build in which you've gone  enabled some optimizations?

In the code you posted mounts is init'd (twice actually, which is
unecessary), then never used. It's perfectly possible that the two  
variables
mounts  bonjourServices will be stored in the same register-- 
depending on

compiler settings.

In other words, the two arrays would certainly have different  
addresses. But
since you're not referring to mounts after it's initialized, the  
space where
the pointer to mounts is stored can be reused to store the different  
pointer

to bonjourServices.

Step it line by line, and watch the values of those variables. Or  
actually
do something with mounts later in the method. Or get rid of mounts  
if you're

not going to use it.

--
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

Forgot to answer the first question.

This is a debug built, and I'm checking in the code where mounts is  
being assigned objects


I have not enabled any optimization that I know of ...

Sandro Noel.

On 16-Nov-08, at 11:37 PM, Scott Ribe wrote:

At what point in the code are you checking? Is this a release build,  
or a

debug build in which you've gone  enabled some optimizations?

In the code you posted mounts is init'd (twice actually, which is
unecessary), then never used. It's perfectly possible that the two  
variables
mounts  bonjourServices will be stored in the same register-- 
depending on

compiler settings.

In other words, the two arrays would certainly have different  
addresses. But
since you're not referring to mounts after it's initialized, the  
space where
the pointer to mounts is stored can be reused to store the different  
pointer

to bonjourServices.

Step it line by line, and watch the values of those variables. Or  
actually
do something with mounts later in the method. Or get rid of mounts  
if you're

not going to use it.

--
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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: Core data save error with multiple persistent stores

2008-11-16 Thread Quincey Morris

On Nov 16, 2008, at 13:30, Arthur C. wrote:

The example in the documentation:   http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdCreateMOs.html#/ 
/apple_ref/doc/uid/TP40001654-SW2does the assignment immediately  
after the  insertNewObjectForEntityForName call, not in  
awakeFromInsert.
All right, but that does not cover the case of an object being added  
using the 'add' button linked to the array controller (which btw is  
bound to the correct managedObjectContext). Then you end up directly  
in awakeFromInsert, which at least should be OK if it is executed  
only once.


Using -[NSArrayController add:] as an action is often suitable only  
for the simplest cases. In your case, it would not be unreasonable to  
write your own action (in, say, the window controller) to create the  
object and insert it in the right place with the right characteristics.




I'm wondering if undo is what's causing your problem. If not undo,   
then some other circumstances that leads to awakeFromInsert  
being  called when the object is not really brand-new.
I'll check that. Undo is probably not the problem, we can trigger  
the error without doing an undo operation.



Have you tried doing it the way Apple's example shows?


I'll do that, but as said, it's incomplete and the awakeFromInsert  
will still be needed...


It might also be worth putting a test in awakeFromInsert -- first  
check if the object has been assigned to a persistent store, and only  
assign if it has not.



___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Scott Ribe
 This is a debug built, and I'm checking in the code where mounts is
 being assigned objects

Which, if I recall correctly, is before bonjourServices is allocated. What
do you think the problem is?

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

I'm actually checking here in this function.

- (IBAction)mountSomeServers:(id)sender
{

NSDictionary *mountDictionary;

mountDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
   [server stringValue], ServerNameKey,
   [share stringValue], VolumeNameKey,
   [type title], TransportNameKey,
   @, MountDirectoryKey,
   [user stringValue], UserNameKey,
   [password stringValue], PasswordKey,
   [NSNumber numberWithBool:YES], 
AsyncKey, NULL];
[mounts addObject:mountDictionary];

this is the only place where objects are being added to the mount array.

I checked the init function and as soon as the bonjourServices array  
is initialized witch is after the mounts array
it is assigned the same pointer as the mounts array, and from what i  
can deduce it's because the mounts array is empty

at the time, because the file it is trying to load does not exist yet.

I'm just guessing here, I've never encountered that kind of problem in  
17 years of programing in any language.
mind you i'm quite new to cocoa, but i did not face that problem in  
any of my other cocoa programs.


Sandro Noel.

On 17-Nov-08, at 12:04 AM, Scott Ribe wrote:


This is a debug built, and I'm checking in the code where mounts is
being assigned objects


Which, if I recall correctly, is before bonjourServices is  
allocated. What

do you think the problem is?

--
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Charles Steinman
Have you fixed the [mounts initWithContentsOfFile:...] bug and it still happens?

Cheers,
Chuck



- Original Message 
 From: Sandro Noel [EMAIL PROTECTED]
 To: Scott Ribe [EMAIL PROTECTED]
 Cc: cocoa-dev@lists.apple.com
 Sent: Sunday, November 16, 2008 9:16:15 PM
 Subject: Re: Two arrays sharing the same adress space.
 
 I'm actually checking here in this function.
 
 - (IBAction)mountSomeServers:(id)sender
 {
 
 NSDictionary *mountDictionary;
 
 mountDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
[server stringValue], ServerNameKey,
[share stringValue], VolumeNameKey,
[type title], TransportNameKey,
@, MountDirectoryKey,
[user stringValue], UserNameKey,
[password stringValue], PasswordKey,
[NSNumber numberWithBool:YES], AsyncKey, NULL];
 [mounts addObject:mountDictionary];
 
 this is the only place where objects are being added to the mount array.
 
 I checked the init function and as soon as the bonjourServices array is 
 initialized witch is after the mounts array
 it is assigned the same pointer as the mounts array, and from what i can 
 deduce 
 it's because the mounts array is empty
 at the time, because the file it is trying to load does not exist yet.
 
 I'm just guessing here, I've never encountered that kind of problem in 17 
 years 
 of programing in any language.
 mind you i'm quite new to cocoa, but i did not face that problem in any of my 
 other cocoa programs.
 
 Sandro Noel.
 
 On 17-Nov-08, at 12:04 AM, Scott Ribe wrote:
 
  This is a debug built, and I'm checking in the code where mounts is
  being assigned objects
  
  Which, if I recall correctly, is before bonjourServices is allocated. What
  do you think the problem is?
  
  --Scott Ribe
  [EMAIL PROTECTED]
  http://www.killerbytes.com/
  (303) 722-0567 voice
  
  
 
 ___
 
 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/acharlieblue%40yahoo.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]


Set user agent for NSURL

2008-11-16 Thread Mr. Gecko
Hello I am working on a website crawler and I am needing to make a  
user agent string so people who monitoring who visits can know that my  
crawler visited.


Thanks for the help,
Mr. Gecko
___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
as it turns out. with the bug fixed the mounts array is left null  
because the file does not exist yet.

so further in the program is i try to add to the array, nothing happens.

and if i try mounts = [[NSMutableArray alloc] init]; only the two  
arrays get the same pointer.


	transportTypes = [NSArray  
arrayWithObjects:@afp,@smb,@cifs,@nfs,nil];


		mounts = [[NSMutableArray alloc] initWithContentsOfFile:[[self  
applicationSupportFolder] stringByAppendingPathComponent:@Bonjour  
Mounter.plist]];	


bonjourServices = [[NSMutableArray alloc]init];

AFPScanner = [[BonjourScanner alloc]init];
SMBScanner = [[BonjourScanner alloc]init];
NFSScanner = [[BonjourScanner alloc]init];

AFPScanner.bonjourServices = bonjourServices;
SMBScanner.bonjourServices = bonjourServices;
NFSScanner.bonjourServices = bonjourServices;

[AFPScanner searchForService:@_afpovertcp._tcp. domain:nil];
[SMBScanner searchForService:@_smb._tcp. domain:nil];
[NFSScanner searchForService:@_nfs._tcp. domain:nil];

}
return self;
}

On 17-Nov-08, at 12:47 AM, Charles Steinman wrote:

Have you fixed the [mounts initWithContentsOfFile:...] bug and it  
still happens?


Cheers,
Chuck



- Original Message 

From: Sandro Noel [EMAIL PROTECTED]
To: Scott Ribe [EMAIL PROTECTED]
Cc: cocoa-dev@lists.apple.com
Sent: Sunday, November 16, 2008 9:16:15 PM
Subject: Re: Two arrays sharing the same adress space.

I'm actually checking here in this function.

- (IBAction)mountSomeServers:(id)sender
{

   NSDictionary *mountDictionary;

   mountDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
  [server stringValue], ServerNameKey,
  [share stringValue], VolumeNameKey,
  [type title], TransportNameKey,
  @, MountDirectoryKey,
  [user stringValue], UserNameKey,
  [password stringValue], PasswordKey,
  [NSNumber numberWithBool:YES], AsyncKey, NULL];
   [mounts addObject:mountDictionary];

this is the only place where objects are being added to the mount  
array.


I checked the init function and as soon as the bonjourServices  
array is

initialized witch is after the mounts array
it is assigned the same pointer as the mounts array, and from what  
i can deduce

it's because the mounts array is empty
at the time, because the file it is trying to load does not exist  
yet.


I'm just guessing here, I've never encountered that kind of problem  
in 17 years

of programing in any language.
mind you i'm quite new to cocoa, but i did not face that problem in  
any of my

other cocoa programs.

Sandro Noel.

On 17-Nov-08, at 12:04 AM, Scott Ribe wrote:


This is a debug built, and I'm checking in the code where mounts is
being assigned objects


Which, if I recall correctly, is before bonjourServices is  
allocated. What

do you think the problem is?

--Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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/acharlieblue%40yahoo.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: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel

OK.
the double initialization was the problem.
the first init was giving me a pointer, and the second one was  
returning nothing because the file did not exist,

and i guess the compiler was reusing it...

the problem was fixed like this, sorry for the confusion guy's and  
thanks for the help.

I guess it's past my bed time...

NSFileManager *fileManager;
fileManager = [NSFileManager defaultManager];
		if ( [fileManager fileExistsAtPath:[[self applicationSupportFolder]  
stringByAppendingPathComponent:@Bonjour Mounter.plist]  
isDirectory:NULL] ) {
			mounts = [[NSMutableArray alloc] initWithContentsOfFile:[[self  
applicationSupportFolder] stringByAppendingPathComponent:@Bonjour  
Mounter.plist]];

}
else{
mounts = [[NSMutableArray alloc] init];
}


On 17-Nov-08, at 12:52 AM, Sandro Noel wrote:

as it turns out. with the bug fixed the mounts array is left null  
because the file does not exist yet.
so further in the program is i try to add to the array, nothing  
happens.


and if i try mounts = [[NSMutableArray alloc] init]; only the two  
arrays get the same pointer.


	transportTypes = [NSArray  
arrayWithObjects:@afp,@smb,@cifs,@nfs,nil];


		mounts = [[NSMutableArray alloc] initWithContentsOfFile:[[self  
applicationSupportFolder] stringByAppendingPathComponent:@Bonjour  
Mounter.plist]];	


bonjourServices = [[NSMutableArray alloc]init];

AFPScanner = [[BonjourScanner alloc]init];
SMBScanner = [[BonjourScanner alloc]init];
NFSScanner = [[BonjourScanner alloc]init];

AFPScanner.bonjourServices = bonjourServices;
SMBScanner.bonjourServices = bonjourServices;
NFSScanner.bonjourServices = bonjourServices;

[AFPScanner searchForService:@_afpovertcp._tcp. domain:nil];
[SMBScanner searchForService:@_smb._tcp. domain:nil];
[NFSScanner searchForService:@_nfs._tcp. domain:nil];

}
return self;
}

On 17-Nov-08, at 12:47 AM, Charles Steinman wrote:

Have you fixed the [mounts initWithContentsOfFile:...] bug and it  
still happens?


Cheers,
Chuck



- Original Message 

From: Sandro Noel [EMAIL PROTECTED]
To: Scott Ribe [EMAIL PROTECTED]
Cc: cocoa-dev@lists.apple.com
Sent: Sunday, November 16, 2008 9:16:15 PM
Subject: Re: Two arrays sharing the same adress space.

I'm actually checking here in this function.

- (IBAction)mountSomeServers:(id)sender
{

  NSDictionary *mountDictionary;

  mountDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
 [server stringValue], ServerNameKey,
 [share stringValue], VolumeNameKey,
 [type title], TransportNameKey,
 @, MountDirectoryKey,
 [user stringValue], UserNameKey,
 [password stringValue], PasswordKey,
 [NSNumber numberWithBool:YES], AsyncKey, NULL];
  [mounts addObject:mountDictionary];

this is the only place where objects are being added to the mount  
array.


I checked the init function and as soon as the bonjourServices  
array is

initialized witch is after the mounts array
it is assigned the same pointer as the mounts array, and from what  
i can deduce

it's because the mounts array is empty
at the time, because the file it is trying to load does not exist  
yet.


I'm just guessing here, I've never encountered that kind of  
problem in 17 years

of programing in any language.
mind you i'm quite new to cocoa, but i did not face that problem  
in any of my

other cocoa programs.

Sandro Noel.

On 17-Nov-08, at 12:04 AM, Scott Ribe wrote:

This is a debug built, and I'm checking in the code where mounts  
is

being assigned objects


Which, if I recall correctly, is before bonjourServices is  
allocated. What

do you think the problem is?

--Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice




___

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/acharlieblue%40yahoo.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/sandro.noel%40mac.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing 

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Stephen J. Butler
On Sun, Nov 16, 2008 at 11:52 PM, Sandro Noel [EMAIL PROTECTED] wrote:
 as it turns out. with the bug fixed the mounts array is left null because
 the file does not exist yet.
 so further in the program is i try to add to the array, nothing happens.

 and if i try mounts = [[NSMutableArray alloc] init]; only the two arrays
 get the same pointer.

Well, then what's happening is obvious. initWithContentsOfFile: fails
because the file doesn't exist, so it performs cleanup (aka, call
release) and returns null. Your next alloc then just happens to grab
the same memory block. So two things to learn from this:

1) never call the init* methods twice on the same object.
2) always use the value returned from an init* method.
___

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: Two arrays sharing the same adress space.

2008-11-16 Thread Kyle Sluder
On Mon, Nov 17, 2008 at 1:03 AM, Stephen J. Butler
[EMAIL PROTECTED] wrote:
 2) always use the value returned from an init* method.

This isn't strictly necessary.  If you need a singleton object that
lives for the duration of your app, for example, there's no reason you
can't just alloc/init one and let it go (unless, of course, you're
using garbage collection, in which case it might matter).  I can't
imagine a likely scenario for this outside of misapplication of an
idiom, but that doesn't make it illegal to ignore the return value of
-init.

--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]


NSTokenField fails to tokenize with mixed text

2008-11-16 Thread Kyle Sluder
Hi list,

I'm writing an Automator action that will allow users to insert
properties of the input object into a format string to produce new
strings.  So, for example, if the input to the action is a list of
iTunes tracks, the user can generate filenames of the pattern
«artist» - «album» - «name».mp3.  The logical choice for the UI is
an NSTokenField, in which certain tokens are displayed as plain text,
while others are displayed as default tokens.

Unfortunately, the only way to determine the represented object for a
token is by examining the editing string, so the only way to tell if a
user's input is a token is by some form of sentinel -- I have chosen @
for now because it's simple.  So when the user enters text and hits
Return, the NSTokenField sends its delegate
-tokenField:representedObjectForEditingString:, which just returns the
token as-is to avoid the whitespace-chomping behavior on 10.5.2+.
Then the delegate gets -tokenField:styleForRepresentedObject:, which
just does the following:

-(NSTokenStyle)tokenField:(NSTokenField *)tokenField
styleForRepresentedObject:(NSString *)representedObject {
  if([representedObject hasPrefix:@@])
return NSDefaultTokenStyle;
  else
return NSPlainTextTokenStyle;
}

Now, if a user's first token is plain text (does not begin with @),
the user can't enter any more tokens, because the NSTokenField doesn't
see the @ as part of a new token.  This happens even if the user
explicitly hits the Return key to tokenize the plain text input they
have already entered.  What's worse is that I must include the @
character in the editing representation, and if the user deletes it
(which is easy to do because it's part of the selection when the user
double-clicks a token to edit it), it becomes part of the plain text
in the field with no way to convert it back into a token.

Does anyone have a solution to this issue?

Thanks,
--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]


Writing a more usable AppleEvent logger

2008-11-16 Thread Ken Tozier

Hi

I've been working with AppleEvents and discovering their internals by  
setting the following in the terminal


 export AEDebugSends=1; export AEDebugReceives=1

What I'd like to be able to do is observe apple events exactly like  
this tool but format them into an NSDictionary so they can be used to  
easily build complex events. Since the above tool observes events, it  
must be possible, but how would I capture these events in my own tool?  
Is this something that needs to be a kernel extension? Or is there a  
higher level way to do it?



___

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]


How to implement float min(float x, ...) ?

2008-11-16 Thread Oleg Krupnov
I apologize, this is plain old C, not Cocoa-specific question, but the
fastest way to get the answer.

I want to create a function that finds the minimum out of a
variable-length list of simple float arguments. In other words, I want
this function:

float min(float x, ...);

Can anyone suggest the implementation?

I have read this: http://developer.apple.com/qa/qa2005/qa1405.html
but it seems to address arguments of type id, not sure it will work
for simple integral types like float.

Thanks!
___

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: How to implement float min(float x, ...) ?

2008-11-16 Thread Andrew Farmer

On 16 Nov 08, at 23:38, Oleg Krupnov wrote:

I apologize, this is plain old C, not Cocoa-specific question, but the
fastest way to get the answer.

I want to create a function that finds the minimum out of a
variable-length list of simple float arguments. In other words, I want
this function:

float min(float x, ...);

Can anyone suggest the implementation?


It's not possible. There's no way to determine the length of an  
argument list - you need either a delimiter, or an extra argument to  
signal the number of arguments.


See 'man stdarg' for what you've got, and what it can do.
___

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]