Re: simple string to NSData question

2008-08-07 Thread Chris Suter
On Fri, Aug 8, 2008 at 3:49 PM, Ken Thomases <[EMAIL PROTECTED]> wrote:

> On Aug 7, 2008, at 2:15 PM, phil swenson wrote:
>
>  I'm trying to parse an xml file, so to get started I put the xml in a
>> String:
>>
>> NSString *xml = @">
>> encoding=\"UTF-8\"?>LarryFurg";
>>
>>
>> Now I need to move this to a NSXMLDocument, which takes an NSData.
>>
>> Looking at NSData, I see there is a method initWithBytes but I'm not
>> sure how to put it in there from my NSString.
>>
>
> Rather than thinking about how to create an NSData yourself, ask the string
> to do it.  The easiest way would be [xml dataUsingEncoding:
> NSUTF8StringEncoding].
>

Looks like -[NSXMLDoucment initWithXMLstring:options:error:] might also do
the trick or if it's coming from a file, why use a string at all, use
-[NSXMLDocument initWithContentsOfURL:options:error].

-- 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: simple string to NSData question

2008-08-07 Thread Ken Thomases

On Aug 7, 2008, at 2:15 PM, phil swenson wrote:


I'm trying to parse an xml file, so to get started I put the xml in a
String:

NSString *xml = @"encoding=\"UTF-8\"?>LarryFurgperson>";



Now I need to move this to a NSXMLDocument, which takes an NSData.

Looking at NSData, I see there is a method initWithBytes but I'm  
not

sure how to put it in there from my NSString.


Rather than thinking about how to create an NSData yourself, ask the  
string to do it.  The easiest way would be [xml dataUsingEncoding:  
NSUTF8StringEncoding].


Cheers,
Ken
___

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 get array of characters from NSString

2008-08-07 Thread Nick Zitzmann


On Aug 7, 2008, at 10:27 PM, SridharRao M wrote:

Hi,I want to retrieve characters from NSString Can any one guide me  
how to

do it.



What do you mean by that? If you want to translate an NSString into a  
C char array, then use -UTF8String. If you want to get a range of 2- 
byte characters from an NSString, then use -getCharacters:range:.


Nick Zitzmann





___

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: Cocoa Dev Style: Using Class versus Object Methods

2008-08-07 Thread Graham Cox


On 8 Aug 2008, at 3:08 am, Lee, Frederick wrote:


Greetings:

   I just came across a NSObject subclass written by someone, that
contains a couple of date/Time-processing methods (stringToDate,
visa-versa).

The methods were all class-level methods (+) vs (-); and hence, didn't
require the familiar alloc & init instantiation methods.



I've been writing NSObjects via instantiation (requiring alloc & init)
that I use to model business logic (packing XML data vectors, etc.)  
and

hold a lot of common methods to use.



I can see a project using class methods instead of instantiated  
methods;

and hence, avoid the alloc/init memory hassles.



My question (which is ELEMENTARY), is

1)  why use instantiated objects versus classes (via class  
methods)?\


Because you might need more than one of something.


2)  Are classes stored in the stack & instatiated objects on the
heap?


They are all on the heap. Classes are in fact object instances  
themselves (though I wouldn't dwell on this, judging by your question  
this is probably a bit advanced).



Seems to me that your basic understanding of OOP needs a few gaps  
filling in. If you don't really "get" why object instances exist  
you've probably missed one of the most fundamental points of OOP.


Maybe if you never need more than one example of any "thing" while  
exploring programming you'll probably manage with class methods only,  
but in reality, class methods are a convenience for some situations  
rather than the usual way to get things done. The point of an object  
instance is that it carries some data that is unique to that object as  
well as providing a set of methods for operating on that data. By  
contrast, a class's data (if it has any) is common to all instances of  
that class.


To illustrate the difference, consider an example from the real world.  
A class 'cat' exists which represents the species. Instances of cat  
could be 'Tom', 'Dick' and 'Harry', all of which are particular  
examples of cats. Since all cats have four legs, the class 'cat' could  
implement +numberOfLegs to always return 4 - that data is the same for  
all cats. But each cat could have different colours, so you'd have an  
instance method -colour that might return black for Tom, ginger for  
Dick and grey for Harry. You couldn't get away with a class method  
+colour because not all cats are the same colour - you need an  
instance to store each different colour.


Sometimes you might use a class that only has class methods to provide  
some general-purpose functionality, such as the date/time methods you  
mention. There is little difference between doing that and just having  
some ordinary functions that do the same job, but once you get into  
the object way of thinking, it's common to do this to keep code  
manageable, consistent, flexible and future-proofed and so on. Classes  
that only have class methods are pretty unusual though, so I doubt  
you'll come across them too often.


You could write a project using only class methods - in fact that's  
what everyone did, before OOP was invented. It's called procedural  
programming. However, for the (very minor) "memory hassles" of alloc/ 
init, you are talking about throwing away nearly all of the baby to  
get rid of a tiny bit of bathwater.



hth,

Graham
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Basic Obj-C Question on Memory and Strings

2008-08-07 Thread Matt Keyes
Hello again,

I have two basic Obj-C string question, please see the code below:

//.h file

@interface SomeClass : NSObject {

@private 
 NSMutableString *_someString;
}

@property (nonatomic, retain) NSMutableString *someString;

-(void)DoTheStringThing:(NSString *)aString;
@end

//.m file: 

#import "SomeClass.h"

@implementation SomeClass

@synthesize someString = _someString;

-(void)DoTheStringThing:(NSString *)aString {
 _someString = [[NSString alloc] initWithString:aString];
}

//in some other class...

-(void)foo {
 SomeClass *cls = [[SomeClass alloc] init];
 [cls DoTheStringThing:@"Here's a fun string."];

//HERE IS THE QUESTION:
//This causes a halt in the debugging and will sometimes give a 
_BAD_ADDRESS or something... simply checking the NSString pointer causes it
//I am having a hard time I guess understanding Obj-C memory management b/c 
in traditional C/C++ this would be fine to do 
if(cls.someString)
{
  self.txtMyTextBox.text = [[NSString alloc] cls.someString];
}
}

-(void) dealloc {
 [txtMyTextBox release];
 [super dealloc];
}

_
Get Windows Live and get whatever you need, wherever you are.  Start here.
http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home_082008___

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: Cocoa Dev Style: Using Class versus Object Methods

2008-08-07 Thread Nick Zitzmann


On Aug 7, 2008, at 11:08 AM, Lee, Frederick wrote:

1)  why use instantiated objects versus classes (via class  
methods)?


Because class methods other than +new return autoreleased objects,  
which makes non-GC memory management a little bit easier.



2)  Are classes stored in the stack & instatiated objects on the
heap?



In Mac OS X, everything (including classes) is stored in memory except  
for function/method arguments, which are either stored in the stack or  
in one or more CPU registers, depending on the CPU architecture and  
the size of the data structure.


Nick Zitzmann





___

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 tell whether an executable supports GC?

2008-08-07 Thread Chris Suter
On Fri, Aug 8, 2008 at 2:48 PM, André Pang <[EMAIL PROTECTED]> wrote:

> Hi all, is there a reasonably easy way to programmatically determine
> whether a particular executable on-disk supports garbage collection?  Cocoa
> methods aren't necessary; all C functions are welcome.  Poking around in an
> executable's Mach-O headers is fine too, but I'm not sure what to look for.
>
> My usage scenario is that we're intending to ship an experimental GC
> version of our app to some customers, but we have a lot of plugins for our
> app, and they won't work under the GC version unless they're compiled
> GC-supported.  I'd like to display a sheet in the regular, non-GC version of
> the app that tells the user which plugins aren't GC-supported, so I can't
> simply attempt to preflight the bundle and see if that fails, since the
> preflight check would be running on the non-GC version.  Any hints?
>

You want to look at the __image_info section in the __OBJC segment:

struct objc_image_info  {
  uint32_t version; // initially 0
  uint32_t flags;
};

#define OBJC_IMAGE_SUPPORTS_GC   2
#define OBJC_IMAGE_GC_ONLY   4

Have a look at the linker source code in MachOReaderDylib.hpp. You'll have
to check what needs to be swapped.

I don't know if there's an easier way of figuring it out.

-- 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: packed NSTextfield and NSFormatter in IB3 plugin...

2008-08-07 Thread Jonathan Hess

Hey Cyril -

How are you adding the formatter to the text field? After you add the  
formatter, does it appear as a child of the text field in the document  
outline view? If not, that's your problem. Interface Builder maintains  
a tree of all of the objects in the document. If you do something like  
call '[textField setFormatter:myFormatter]' where textField is a text  
field in an Interface Builder document, but formatter hasn't been  
added to the same document, then you'll run into this sort of issue.  
Just make sure to invoke -[IBDocument addObject:myFormatter  
toParent:myTextField] before calling [myTextField  
setFormatter:myForamtter].


Hope that clears up your issue -
Jon Hess

On Aug 7, 2008, at 2:02 AM, Cyril Kardassevitch wrote:


hi,

I have designed customs NSTextField and NSFormatter objects that I  
have tried to pack in an interface builder 3 plugin...


This works fine (can drag and drop the field, can access field  
inspector), except that when I select the formatter, interface  
builder generates an assertion failure with :


Backtrace:
 1. Interface Builder0x6620 [IBApplication  
handleAssertion:inFile:onLine:]
 2. InterfaceBuilderKit  0x0021bed4 [IBObjectContainer  
objectIDForObject:]
 3. InterfaceBuilderKit  0x0021c0ec [IBObjectContainer  
metadataForKey:ofObject:]
 4. InterfaceBuilderKit  0x00224e84 [IBDocument  
customClassNameForObject:]
 5. InterfaceBuilderKit  0x00224e0c [IBDocument  
classNameForObject:]
 6. InterfaceBuilderKit  0x0023f210 [IBDocument  
commonCustomClassNameOfObjects:]
 7. InterfaceBuilderKit  0x0023f15c [IBInspectorController  
computeTitle]
 8. InterfaceBuilderKit  0x0023f08c [IBInspectorController  
refresh]
 9. InterfaceBuilderKit  0x0023b630 [IBInspectorController  
rebuildInspectorStack]
10. InterfaceBuilderKit  0x0023b4c0 [IBInspectorController  
validate:]

...

The NSTextField and NSFormatter child have their own working  
plugins, and there is absolutely no problem if I combine the 2 above  
objects manually in interface builder. The field and its formatter  
are then fully accessible and designable.


I've tried various things without success. Has anyone got a tip on  
how to expose a programmatically attached formatter ?


Thanks.
Cyril.


___

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/jhess%40apple.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]


Need pointers on web service communication from the iPhone

2008-08-07 Thread Matt Keyes
Hello, this is my first post.  I am a C/C++ developer that has only recently 
begun to explore Obj-C and its nuances.  The need at hand is to develop an 
application on the iPhone that will be able to communicate to a SOAP XML web 
service on a Microsoft .NET server.

In .NET, the SOAP communication is hidden from the developer under the hood, as 
it were.  However, with Obj-C and the iPhone, I know I need to do quite a bit 
of the legwork myself.  Can anyone provide any pointers, tutorials, etc.?  I 
have been banging my head against a wall on this for about a week now.  Nothing 
in particular seems to work.  I've looked through the SeismicXML example (which 
is not really a tutorial for SOAP in Obj-C, even though I saw it listed as 
such).

Please help, and thanks in advance!!!
Matt

_
Get more from your digital life.  Find out how.
http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home2_082008___

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 get array of characters from NSString

2008-08-07 Thread Andrew Merenbach
Not to reply to myself, but -- erm -- that second one should be - 
[NSString getCharacters:range:] -- with a second colon (this one after  
"range").  Also, sorry for top-posting, but I had to since I neglected  
to bottom post in my original reply.


Cheers,
Andrew

On Aug 7, 2008, at 9:53 PM, Andrew Merenbach wrote:


Hi!

Would -[NSString getCharacters:] or -[NSString getCharacters:range]  
(both of which return a unichar array), or better yet -[NSString  
getCString:maxLength:encoding:] work for your purposes?


Even better still, perhaps one of

- [NSString cStringUsingEncoding:]
- [NSString UTF8String]
- [NSString fileSystemRepresentation]

might work for you.

Cheers,
Andrew

On Aug 7, 2008, at 9:27 PM, SridharRao M wrote:

Hi,I want to retrieve characters from NSString Can any one guide me  
how to

do it.
Ex:
NSString *ob=@"TEST Object";

Now how to retrieve the "Test Object " value into my Char Array.

Regards,
Sri.
___

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/andrew.merenbach%40ucla.edu

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/andrew.merenbach%40ucla.edu

This email sent to [EMAIL PROTECTED]




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: How to get array of characters from NSString

2008-08-07 Thread Andrew Merenbach

Hi!

Would -[NSString getCharacters:] or -[NSString getCharacters:range]  
(both of which return a unichar array), or better yet -[NSString  
getCString:maxLength:encoding:] work for your purposes?


Even better still, perhaps one of

- [NSString cStringUsingEncoding:]
- [NSString UTF8String]
- [NSString fileSystemRepresentation]

might work for you.

Cheers,
Andrew

On Aug 7, 2008, at 9:27 PM, SridharRao M wrote:

Hi,I want to retrieve characters from NSString Can any one guide me  
how to

do it.
Ex:
NSString *ob=@"TEST Object";

Now how to retrieve the "Test Object " value into my Char Array.

Regards,
Sri.
___

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/andrew.merenbach%40ucla.edu

This email sent to [EMAIL PROTECTED]




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]

How to tell whether an executable supports GC?

2008-08-07 Thread André Pang
Hi all, is there a reasonably easy way to programmatically determine  
whether a particular executable on-disk supports garbage collection?   
Cocoa methods aren't necessary; all C functions are welcome.  Poking  
around in an executable's Mach-O headers is fine too, but I'm not sure  
what to look for.


My usage scenario is that we're intending to ship an experimental GC  
version of our app to some customers, but we have a lot of plugins for  
our app, and they won't work under the GC version unless they're  
compiled GC-supported.  I'd like to display a sheet in the regular,  
non-GC version of the app that tells the user which plugins aren't GC- 
supported, so I can't simply attempt to preflight the bundle and see  
if that fails, since the preflight check would be running on the non- 
GC version.  Any hints?


Thanks!


--
% Andre Pang : trust.in.love.to.save  

___

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 debug a corrupted stack

2008-08-07 Thread Gerriet M. Denkmann


On 8 Aug 2008, at 09:04, Sean McBride wrote:


Gerriet M. Denkmann ([EMAIL PROTECTED]) on 2008-8-8 9:49 PM said:


some_type a;
NSValue *data = [ NSValue value: &a withObjCType: @encode
(some_type) ];  
followed by:
some_type b;
[ data getValue: &b ];
is unsafe, dangerous and strictly to be avoided - especially if the
definiton of "some_type" is buried in some frameworks.

Instead one must use:
some_type *bPointer = [ data bytes ];
The only problem: NSValue has no method "bytes".


Note that the docs say that value:withObjCType: and objCType "may be
deprecated in a future release".  Also, I suspect objCType would be
problematic in GC apps (see archive discussion of NSData's btyes  
method).


On the other hand NSData will definitely have problems if it is sent  
via Distributed Object to another application with another endian-ness.
But this not something which I will do with this app. And I am also  
not sure whether NSValue will do the right thing with DO.




What is your ultimate goal?  Could you use NSData instead of NSValue?
Just to transport data. In the case which caused me so much trouble  
144 bytes of FSCatalogInfo.

But, now that you mention it, I could use NSData instead.
And probably will, as I am tired of fighting with NSValue.
Thanks for this suggestion. I was kind of hooked on NSValue for - as  
I see now - no good reason.



Kind regards,

Gerriet.

___

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 get array of characters from NSString

2008-08-07 Thread SridharRao M
Hi,I want to retrieve characters from NSString Can any one guide me how to
do it.
Ex:
NSString *ob=@"TEST Object";

Now how to retrieve the "Test Object " value into my Char Array.

Regards,
Sri.
___

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]


[Moderator] Moderation times should be back to normal

2008-08-07 Thread Scott Anguish
The moderation delays over the past three days should no longer be an  
issue.


Thanks again for you patience.

sctot [moderator]
___

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]


shouldShowHelp in cocoa pde does not work in Tiger

2008-08-07 Thread Ronaly Agdeppa
hi,

I'm creating a cocoa pde.
You can see in the print dialog, a question mark button which opens the help
viewer when clicked.
We can display our custom help there using shouldShowHelp method, provided
that we have succesfully
registered the help. That method works fine in Leopard but not in Tiger. It
seems that Tiger cannot
identify shouldShowHelp.Does anyone know why?

Please help how I may catch the help button in Tiger so I can display my own
help page
instead of the default mac help?

Thanks in advance.
___

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]


NSMultipleTextSelectionPboardType not working

2008-08-07 Thread André Pang

Hi,

I'm trying to read some NSMultipleTextSelectionPboardType data off the  
pasteboard:


NSData* data = [pboard dataForType:NSMultipleTextSelectionPboardType];

I've verified that the pasteboard is holding the data using - 
[NSPasteboard availableTypeFromArray:], but I'm encountering two  
oddities.  First, I expected the data to be in an NSArchiver format,  
as is the standard for pasteboard data, but it seems to be a property  
list instead.  If I write out the raw data to a file, the actual data  
on the pasteboard looks like this if you dump it to a file:




http://www.apple.com/DTDs/
PropertyList-1.0.dtd">


  1
  1
  1




which seems a little bizarre.  (It's not even a binary plist?)

Second, no matter what text is selected on the pasteboard, the only  
elements in the array for the multiple selection is an NSNumber of 1.   
I get one NSNumber for each selection.  So, if I have the text


foo bar

and select the "foo" and "bar" separately, I receive an array of two  
NSNumbers, both of which are 1.  If I have four text selections on the  
pasteboard, no matter what the original text is, I receive an array of  
four NSNumbers, all of which are 1.  I've been using TextEdit and  
Xcode as the source applications for the pasteboard selections, and  
both of them exhibit this behaviour.


I'm presuming this is a bug in NSTextView (it doesn't write  
NSMultipleTextSelectionPboardType to the paste board properly) and  
that I should file a radar, but I thought I'd double-check to make  
sure I'm not doing anything very silly first.  Googling for  
NSMultipleTextSelectionPboardType turns up nothing helpful.


Thanks all!


--
% Andre Pang : trust.in.love.to.save  



___

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: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Mark Allan
Which "options" argument are you talking about?  I just do the 
following and it works as advertised.


[[NSWorkspace sharedWorkspace] 
performFileOperation:NSWorkspaceRecycleOperation 
source:parentDirOfFile destination:@"" files:[NSArray 
arrayWithObject:@"fileName"] tag:nil]


The only slightly irritating bit is that you have to supply the file 
name and the parent directory.  You can't just pass it a path for 
some reason.


Keep destination as the empty string (not nil) and your file will be 
renamed as required when it hits the trash.


Mark


At 3:12 pm -0500 07/08/2008, Nate Weaver wrote:
I'd say just try the default options and see what happens. You might 
also look at -[NSWorkspace 
performFileOperation:source:destination:files:tag:] with 
NSWorkspaceRecycleOperation as the first argument.


On Aug 7, 2008, at 2:03 PM, Randall Meadows wrote:

The description for FSMoveObjectToTrashSync says: "This function 
moves a file or directory to the Trash, adjusting the object's name 
if necessary."  (Meaning, I suppose, it appends a number to the 
filename to make it unique in the Trash directory.)


Lovely, *exactly* what I need to do.  Happy happy, joy joy!

However, when I get into actually writing the code, I get to the 
"options" argument, which are described as:


"kFSFileOperationDefaultOptions
Use the following default options:

*If the destination directory contains an object with the same name 
as a source object, abort the operation.


kFSFileOperationOverwrite
If the destination directory contains an object with the same name 
as a source object, overwrite the destination object."



Um, what happened to that part about "adjusting the object's name 
if necessary"?  According to the options flags, that is not 
possible; it's either abort the operation or overwrite.


Anyone know the skinny on this actually works?  The way I want to 
use this function is to move a file that resides in a document 
bundle into the Trash directory that resides on the same volume as 
the document bundle (and yes, I understand that not all volumes 
support Trash folders, I can handle 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]


simple string to NSData question

2008-08-07 Thread phil swenson
I'm a newbie (haven't done C in years, been using Java, Ruby mostly), so
sorry if this is a dumb question.

I'm trying to parse an xml file, so to get started I put the xml in a
String:

NSString *xml = @"LarryFurg";


Now I need to move this to a NSXMLDocument, which takes an NSData.

Looking at NSData, I see there is a method initWithBytes but I'm not
sure how to put it in there from my NSString.

thanks for any help
phil
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Does [NSApp setApplicationIconImage] leak memory?

2008-08-07 Thread Mark Allan

Hi all,

Before I file a bug report against this, I just thought I'd check I'm 
not being monumentally stupid first!


I'm trying to animate my app's Dock icon, which works fine and looks 
great, but unfortunately, it appears to leak memory like crazy. 
Every time I call [NSApp setApplicationIconImage:(NSImage *)] and 
pass it pointer to an existing image, it leaks more memory.


My init method sets up 8 frames of the animation like so:
	frame1 = [[NSArray arrayWithObjects:  [NSImage 
imageNamed:@"menu_frame1"], [NSImage imageNamed:@"dock_frame1"], nil] 
retain];
	frame2 = [[NSArray arrayWithObjects:  [NSImage 
imageNamed:@"menu_frame2"], [NSImage imageNamed:@"dock_frame2"], nil] 
retain];

and so on...

I'm using an NSArray there as I may alternatively need to animate a 
menubar icon depending on the user's preferences, and the images have 
different dimensions accordingly.


The method which does the drawing looks like this:

- (void) setMenuAndDockTile:(NSArray *)theNewImage {
[NSApp setApplicationIconImage:[theNewImage objectAtIndex:1]];
}

and it gets called in a loop containing something like this:
[self setMenuAndDockTile:frame1];
usleep(10);
[self setMenuAndDockTile:frame2];
usleep(10);
<...and so on for 8 frames...>

Each frame is only a fraction over 1KB, yet after 5 times round the 
loop (ie changing the Dock tile 40 times) it has managed to eat 27 MB 
and the memory usage increases every time I tell it to animate.


Am I doing something wrong, or is there a leak in NSApp's 
setApplicationIconImage code?


Many thanks

PS. I can post the full source and images if that would help.

___

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 create the special modal dialog

2008-08-07 Thread pan xuan

Thanks for your link.
 
It helped.
 
Pan> CC: cocoa-dev@lists.apple.com> From: [EMAIL PROTECTED]> To: [EMAIL 
PROTECTED]> Subject: Re: how to create the special modal dialog> Date: Wed, 6 
Aug 2008 20:33:33 -0400> > Pan,> > I think you're referring to are "sheets".> > 
See:> 
http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Sheets.html> > 
Good luck =]> > - Andy> > > On Aug 6, 2008, at 8:41 AM, pan xuan wrote:> > >> > 
Hi,> >> > In some of Preferences's pane, when clicking a "+" sign, a modal > > 
dialog comes up not separately but as a child shadowed dialog > > sticking out 
from the bottom of the tool bar. What is that kind of > > dialog called? and 
how to program it?> >> > Thanks for the help.> >> > Pan> > 
_> > Get more 
from your digital life. Find out how.> > 
http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home2_082008___>
 >> > 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/andy%40mrox.net> >> > This 
email sent to [EMAIL PROTECTED]> 
_
Get more from your digital life.  Find out how.
http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home2_082008___

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: Command Line Argument - Choosing a Style

2008-08-07 Thread hac
On Wed, Aug 6, 2008 at 9:00 PM, Jonathan deWerd <[EMAIL PROTECTED]>wrote:

> I would make plugins of a different type: standard cocoa bundles (there are
> a handful of tutorials on google). This way, people could install and
> uninstall using the finder (a little known but helpful feature of the info
> box), you could use standard cocoa APIs, you wouldn't have to deal with the
> overhead of spawning a new process, and you could provide a template to get
> devs started. Then I'd just pass configuration info in a dictionary.


Okay. That looks like a much better solution (If only I had used it from the
beginning). It definitely looks worthwhile to look into, as I'm a newbie at
making plug-ins. Thank you.


> If that isn't an option, I would pass a bunch of --key value pairs to
> retain some semblance of standard-ness :)
>
> On Aug 6, 2008, at 4:33 PM, hac wrote:
>
>  Hi,
>> I'm developing an application to support third-party extensions that
>> filter
>> text. Each filter consists mainly of a property list and an executable.
>> The
>> idea is that the text of the current document goes into the executable
>> along
>> with settings specified in the property list (as arguments); text to
>> replace
>> the document text comes out as the standard output.
>>
>> Right now I am stuck trying to decide how I should pass both the document
>> text and the settings to the executable. I see three options:
>>
>>  1. Have the first argument be the document text, and the second an XML
>>  string containing the settings as key-value pairs.
>>  2. Have the first argument be the docucument text, the second a setting
>>  key, the third a setting value, the fourth a setting key, etc...
>>  3. Have the first argument be the docucument text, have each successive
>>  argument be a setting value, in an order specified in the property list
>> so
>>  as to determine the key for each.
>>
>> I can easily set up the application to support any of these methods. My
>> problem is that each one seems to have some inconveniences for the
>> developer
>> of the filter, and I would like to make this as convenient as possible for
>> anyone who makes a filter. Could someone tell me which method would be the
>> most appropriate?
>>
>> 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 use a button to update an application with a text field value

2008-08-07 Thread Tron Thomas
I attempted to try out what you were suggesting to see how well I 
understood it.  I got a compiler warning that said my controller class 
may not respond to -selection.


Also, in the case where a controller might have selector that take 
multiple arguments, I'm not sure how I could provide the arguments.  
Suppose the selector wanted access to the text field, I'm not sure how I 
could specify that object as an argument in the button's binding.


Ron Lue-Sang wrote:
Hmmm... 
In no particular order (sorry)


 - Even if the user hasn't typed into the textfield, the property that 
the textfield is bound /to/ will have a value that matches. This means 
that if I have a textField bound to MyArrayController.selection.name 
. When I want that name, I 
just do [MyArrayController valueForKeyPath:@"selection.name 
"]. That will match the value that is in the 
textField. The textField is reflecting that value. 

- You can use the target/argument bindings for this case if you want. 
This has the advantage that your "action" method won't have to do the 
commitEditing step itself. Also you won't have to expose the method as 
an IBAction or anything. The target binding invokes the commitEditing 
(or commitEditing with delegate) method on the the bound-to object, 
which in this case is your NSController. NSControllers implement the 
whole set of NSEditor and NSEditorRegistration methods. That's why 
this all works. If you bind to an object that doesn't implement the 
full set of methods, you have to do more work. 

- To establish a target binding, the "to" object is just the 
controller (in this case). The keypath can be self. The selector is an 
option in the binding editor in IB. If you method is 


- (void)doWork;

type "doWork" (without the quotes) into the selector field in the 
binding editor. 



If your method takes arguments, you'll have to change the selector. 
Instead of "doWork", you'd have "doWorkWithObject:" - note the colon. 
Or "doWorkWithObject:usingNeighborsHedgeClippers:returnWhenDone:"


For each argument you have, you'll need to bind the argument binding 
to provide… an argument. 

If you've followed what I've outlined here, you can just implement 
doWork like this  
- (void)doWork {
NSString *name = [[self selection] valueForKeyPath:@"name"]; // 
note, won't matter whether user's typed yet

NSLog(@"here's the name! %@", name);
}


Make sense?



___

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: NSOperationQueue Memory Leak

2008-08-07 Thread Brock Batsell
Inside your for loop you are allocating 10,000 NSInvocationOperation
objects without adding them to your autorelease pool.  Adding
[processor autorelease]; as the last line of the for loop killed
memory leakage for me.  Without it my real memory would jump 10 MB
each time queueOperations: ran, with it I had a high-water mark of
12.02 MB, and I extended it to run through 10 iterations.

Brock
___

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]


Application control

2008-08-07 Thread falcon

Hello,

I am trying to repeat my question in other words. :)

I have application written using Qt library. I have a network of about  
40 mac minis. Now I have to connect to each of these macs using ARD  
and change one parameter on main window of the application.  I have  
tried to use UI scripting, but it doesn't work because it is not a  
cocoa application.

Is there any way to make that from another application?


Thanks,
Vlad

___

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]


Cocoa Dev Style: Using Class versus Object Methods

2008-08-07 Thread Lee, Frederick
Greetings:

I just came across a NSObject subclass written by someone, that
contains a couple of date/Time-processing methods (stringToDate,
visa-versa).

The methods were all class-level methods (+) vs (-); and hence, didn't
require the familiar alloc & init instantiation methods.

 

I've been writing NSObjects via instantiation (requiring alloc & init)
that I use to model business logic (packing XML data vectors, etc.) and
hold a lot of common methods to use.

 

I can see a project using class methods instead of instantiated methods;
and hence, avoid the alloc/init memory hassles.

 

My question (which is ELEMENTARY), is

1)  why use instantiated objects versus classes (via class methods)?

2)  Are classes stored in the stack & instatiated objects on the
heap?

 

 

Ric.

 

___

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 display an NSArray of NSStrings as a single NSString?

2008-08-07 Thread Hamish Allan
On Wed, Aug 6, 2008 at 3:27 AM, Erik Buck <[EMAIL PROTECTED]> wrote:

> Um, why not just bind to "values.description"  the -description method of
> NSArray will return a string containing comma separated descriptions of the
> contained objects.  It will even work if the contained objects aren't all
> strings.

Well, I almost suggested that by way of pointing out that he probably
didn't just want any old amalgamation of his array of strings. But
then I thought I might as well just cut to the chase :)

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: How to debug a corrupted stack

2008-08-07 Thread Brian Stern


On Aug 7, 2008, at 9:49 PM, Gerriet M. Denkmann wrote:


Or does anyone have a better idea?



Define your own struct or Objective-C class that has the same members  
as UTCDateTime.  Copy the values from a UTCDateTime to your struct or  
class. Encode/Decode your struct or class from NSValue.  With a few  
utility routines to handle this for you this should be simple and safe.


Or:

Use NSData, add a category to NSData containing: dataWithUTCDateTime:,  
add the appropriate accesor for UTCDateTime and/or for the members of  
UTCDateTime.


--
Brian Stern
[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: how to have a pop up menu from an ordinary button?

2008-08-07 Thread Rua Haszard Morris

On Aug 7, 2008, at 2:53 PM, Rua Haszard Morris wrote:
I am trying to implement a mini-size, square bevel button that pops  
up a menu, i.e. a popup button with a square appearance and mini  
size, but have not found a way to achieve this.


NSPopupButton does not support square button appearance, and  
doesn't support setControlSize: (though it can of course be an  
arbitrary size).


In Leopard, NSPopUpButton supports any bezel style that NSButton  
supports (excluding uninteresting cases like Disclosure or Help).   
NSPopUpButton also supports setControlSize:.  Are these not working  
for you?
Right you are! I think I was forgetting to call setControlSize: on the  
cell rather than on the popup itself. I have not tested on 10.4 yet  
(am building against 10.4 SDK).


The other thing I needed to do to make it look appropriate was set the  
font to a smaller size:
[popup setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize] -  
1]];


It seems I still have a drawing issue, when the window first appears,  
there's a whiteish rectangle drawn above the button. I think this is  
due to the parent view not being notified about the menu invalidating  
the area - the rectangle is similar to the width of the menu and  
protrudes vertically by the same amount.


thanks
Rua HM.
___

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]


Problem with friend function and gcc 4.2 with objective-c++

2008-08-07 Thread Ken Worley

Hi all,

I'm using Xcode 3.1 and just switched to gcc 4.2 from 4.0, but I've  
run into a problem with friend functions when compiling in objective-c+ 
+. I contrived an example that illustrates the problem:


1. Created new Cocoa project
2. Forced compilation of all files to use objective-c++
3. Changed content of main.m to below...

This project builds fine using gcc 4.0, but when I switch the compiler  
setting to use gcc 4.2, I get the errors listed below. Any clues would  
certainly be appreciated if I'm doing something wrong. If not, I guess  
I'll file a bug...


Here's main.m:

#import 

class test1
{
public:

friend test1* newtest1(int x)
{
test1* anobj = new test1();
anobj->finishinit(x);
return anobj;
}

virtual ~test1()
{
}

private:

int avalue;

test1()
{
avalue = 0;
}

void finishinit(int x)
{
avalue = x;
}
};

int main(int argc, char *argv[])
{
test1* tobj = newtest1(5);
delete tobj;

return NSApplicationMain(argc,  (const char **) argv);
}


Here's the build log:

Building target “Untitled” of project “Untitled” with configuration  
“Debug” — (1 error)

cd /Users/ken/Desktop/Untitled
/Xcode3.1/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch i386 - 
fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks - 
O0 -Wreturn-type -Wunused-variable -isysroot /Xcode3.1/Developer/SDKs/ 
MacOSX10.5.sdk -mfix-and-continue -fvisibility-inlines-hidden -mmacosx- 
version-min=10.5 -gdwarf-2 -iquote /Users/ken/Desktop/Untitled/build/ 
Untitled.build/Debug/Untitled.build/Untitled-generated-files.hmap -I/ 
Users/ken/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/ 
Untitled-own-target-headers.hmap -I/Users/ken/Desktop/Untitled/build/ 
Untitled.build/Debug/Untitled.build/Untitled-all-target-headers.hmap - 
iquote /Users/ken/Desktop/Untitled/build/Untitled.build/Debug/ 
Untitled.build/Untitled-project-headers.hmap -F/Users/ken/Desktop/ 
Untitled/build/Debug -I/Users/ken/Desktop/Untitled/build/Debug/include  
-I/Users/ken/Desktop/Untitled/build/Untitled.build/Debug/ 
Untitled.build/DerivedSources -include /var/folders/JE/ 
JEJ3RSLHE9uIDGjXTRTisTI/-Caches-/com.apple.Xcode.501/ 
SharedPrecompiledHeaders/Untitled_Prefix-brblicjbwwpqhfahflncgqpvarno/ 
Untitled_Prefix.pch -c /Users/ken/Desktop/Untitled/main.m -o /Users/ 
ken/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Objects- 
normal/i386/main.o

/Users/ken/Desktop/Untitled/main.m: In function 'int main(int, char**)':
/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not  
declared in this scope
		/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not  
declared in this scope

Build failed (1 error)

Thanks,
Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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: Does NSTextField conform to NSEditor (commitEditing specifically)?

2008-08-07 Thread Sean McBride
Joel Norvell ([EMAIL PROTECTED]) on 2008-8-7 7:07 PM said:

>I'm no expert on the "NSEditor informal protocol," but there was a
>recent thread in which Ken Thomases reply (which I've quoted below)
>might be of help to you.
>
>http://www.cocoabuilder.com/archive/message/cocoa/2008/7/25/214002

Joel,

Thanks for your reply.  I searched the archives before posting and did
see that thread.  I have used commitEditing with NSControllers
successfully, but in my current situation I'd like to send it to an
NSTextField, which the docs seem to indicate should work, yet it doesn't
seem to

Sean


___

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: autorelease CGImageRef?

2008-08-07 Thread Peter N Lewis

At 8:24 AM -0700 7/8/08, Chris Hanson wrote:
If you build with the Mac OS X 10.5 SDK, you should be able to use 
NSMakeCollectable since it's declared as an inline function.


The earliest release of Mac OS X you're targeting is a function of 
the Mac OS X Deployment Target build setting, not the SDK.


That's true, but its not safe to do so.

For example, that will allow kCGBlendModeCopy to be used, even though 
its not available in 10.4.


Thanks,
   Peter.

--
  Keyboard Maestro 3 Now Available!
Now With Status Menu triggers!

Keyboard Maestro  Macros for your Mac
   
___

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 debug a corrupted stack

2008-08-07 Thread Sean McBride
Gerriet M. Denkmann ([EMAIL PROTECTED]) on 2008-8-8 9:49 PM said:

>   some_type a;
>   NSValue *data = [ NSValue value: &a withObjCType: @encode
>(some_type) ]; 
>followed by:
>   some_type b;
>   [ data getValue: &b ];
>is unsafe, dangerous and strictly to be avoided - especially if the
>definiton of "some_type" is buried in some frameworks.
>
>Instead one must use:
>   some_type *bPointer = [ data bytes ];
>The only problem: NSValue has no method "bytes".

Note that the docs say that value:withObjCType: and objCType "may be
deprecated in a future release".  Also, I suspect objCType would be
problematic in GC apps (see archive discussion of NSData's btyes method).

What is your ultimate goal?  Could you use NSData instead of NSValue?

Sean


___

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 debug a corrupted stack

2008-08-07 Thread Gerriet M. Denkmann


On 8 Aug 2008, at 01:59, Johannes Fortmann  
<[EMAIL PROTECTED]> wrote:


The problem here is that UTCDateTime is defined with #pragma pack 2 in
effect. That means the compiler packs with an alignment of 2, so the
whole structure has 8 bytes. The proper alignment (4) results in 12
bytes. Since there's nothing in the @encode'd information specifying
the non-standard alignment, NSGetSizeAndAlignment (which NSValue
probably uses internally) will return 12 bytes as the struct's size.

As an example,

#include 

void main()
{
NSUInteger size, align;
NSGetSizeAndAlignment (@encode(UTCDateTime),
   &size,
   &align);
printf("%i, %i, %s\n", sizeof(UTCDateTime), size,
@encode(UTCDateTime));
}

prints "8, 12, {UTCDateTime=SIS}".


Thank you. This explains the problems I had.

So:
some_type a;
	NSValue *data = [ NSValue value: &a withObjCType: @encode 
(some_type) ];	

followed by:
some_type b;
[ data getValue: &b ];
is unsafe, dangerous and strictly to be avoided - especially if the  
definiton of "some_type" is buried in some frameworks.


Instead one must use:
some_type *bPointer = [ data bytes ];
The only problem: NSValue has no method "bytes".

So we have to do:
const char *objCType = [ data objCType ];
unsigned int size;
NSGetSizeAndAlignment (objCType, &size, NULL);
	// The alloca() function is machine and compiler dependent; its use  
is discouraged. Why?

some_type *bPointer = alloca(size);
[ data getValue: bPointer ];
Or does anyone have a better idea?

Another question:
sizeof(UTCDateTime) < NSValue.
Now this begs the question: Can there be some bloated_type with:
sizeof(bloated_type) > NSValue ?
That is: is there some alignment pragma taking more bytes than the  
alignment used by NSValue?


FInal question: May the dangerous and (at least in Tiger)  
undocumented behaviour of getValue: be labeled as a severe design error?



Kind regards,

Gerriet.

___

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: CGImageSourceCreateFromURL failed with error -11

2008-08-07 Thread Nicolas Zinovieff
Well, I can't speak for James, but I have forced the thumbnail  
creation to have at most 10 files opened at the same time, and it  
doesn't make a difference...
I could understand a memory allocation issue, if the app didn't take  
roughly 100 megs of RAM.
And besides, I can see there's a difference between running in debug  
and release mode too...


Does anyone know what -11 means? Let's forget for a minute how we do  
things, I guess James and I don't have the same app, the same goals  
and the same method of getting the images...
If the lib explicitely indicates that it's a -11 error, maybe there's  
a simple explanation?


On 06 Aug 2008, at 23:36, Gary L. Wade wrote:

Off the top of my head, with a number of files being opened so high  
and relatively close to the value you get from getrlimit with a  
parameter of RLIMIT_NOFILE, I'd suggest checking to see if that's  
the problem.


--
Zino



___

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]


Parse an HTTP Query String into a Dictionary

2008-08-07 Thread Jerry Krinock
Before I write the implementation for this NSString category method,  
I'd like to know if it's already already available somewhere:


@interface NSString (URIQuery)

/*!
 @method queryDictionary
 @abstract   Assuming that the receiver is a query string of  
key=value pairs,
of the form "key0=value0&key1=value1&...", with keys and values  
percent-escape

encoded per RFC 2396, returns a dictionary of the keys and values.
 @discussion If I recall correctly, ";" can also be used in place of  
the "&" delimiter

 */
- queryDictionary ;

@end

It seems like it would not be too difficult to implement using  
NSScanner and CFURLCreateStringByReplacingPercentEscapes(), but I've  
done enough things that "seemed like it would not be too difficult" to  
know that tested code is always preferable.


Thanks,

Jerry


___

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: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Peter Ammon


On Aug 7, 2008, at 1:19 PM, Randall Meadows wrote:


On Aug 7, 2008, at 2:12 PM, Nate Weaver wrote:

I'd say just try the default options and see what happens. You  
might also look at -[NSWorkspace  
performFileOperation:source:destination:files:tag:] with  
NSWorkspaceRecycleOperation as the first argument.


Yes, that's actually what I started with, but that doesn't  
(automatically) take into account the volume that the document  
resides on and its related Trash directory.  Which is what I'm  
hoping FSMoveObjectToTrash gives me.


In Leopard, the NSWorkspace method is implemented with  
FSMoveObjectToTrashSync(), so the behavior should be identical.  The  
destination parameter is ignored in this case.


-Peter

___

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 have a pop up menu from an ordinary button?

2008-08-07 Thread Peter Ammon


On Aug 7, 2008, at 2:53 PM, Rua Haszard Morris wrote:

I am trying to implement a mini-size, square bevel button that pops  
up a menu, i.e. a popup button with a square appearance and mini  
size, but have not found a way to achieve this.


NSPopupButton does not support square button appearance, and doesn't  
support setControlSize: (though it can of course be an arbitrary  
size).


In Leopard, NSPopUpButton supports any bezel style that NSButton  
supports (excluding uninteresting cases like Disclosure or Help).   
NSPopUpButton also supports setControlSize:.  Are these not working  
for you?


-Peter

___

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: Modules in Objective-C like e.g. OSGi-Bundles in Java

2008-08-07 Thread Jonathan deWerd

On Aug 7, 2008, at 5:31 PM, Lars Sonchocky-Helldorf wrote:



Am 07.08.2008 um 21:45 schrieb Matthias Luebken:


Hi

I'm new to Cocoa and Objective-C. Please point me to a different  
group

/ forum if this mailing-list isn't appropriate.

I have a fairly basic language question: Is there a module concept in
Objective-C / Cocoa? I'm thinking in terms of OSGi bundles[0]. What
would I do if I would like to encapsulate a certain functionality  
that

consists of several classes? Could I define an API how to use this
module and make sure private classes of this module aren't visible to
the outside?

Thanks in advance.
Looking forward to learn Obj-C and Cocoa
Matthias

[0] http://www.osgi.org/About/Technology#Framework


see:

http://www.google.com/search?ie=utf8&oe=utf8&q=NSBundle

first hit (and links therein)





regards,

Lars


I'm not sure if this is what he was asking for – NSBundle doesn't  
offer the level of encapsulation that OSGi would. All classes are  
still loaded into the flat namespace, and every function and byte of  
memory in the process that loads the bundle is available for the  
bundle's code to access. The only way I am aware of to get "private"  
functionality would be to prefix each classname with something unique  
like the reverse DNS system that's so popular with the kernel  
programmers.


Unless there is a way to automatically isolate loaded classes... I'd  
love to hear it. Magic dyld options are useful to know about :)





___
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list  ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/jjoonathan%40gmail.com

This email sent to [EMAIL PROTECTED]




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]

Framework and NSApplication

2008-08-07 Thread Kiel Gillard
@synthesize greeting;

I'm writing a Cocoa framework that links with an old Carbon application. The
Carbon application indirectly interacts with it through a wrapper framework.
Within the Cocoa framework, I want to observe the
NSApplicationWillTerminateNotification notification, posted by the
NSApplication to the default NSNotificationCenter. However, my method does
not seem to be invoked.

Figuring there was some incompatibility with NSApplication and the fact the
framework is being dynamically linked to an old Carbon application, I
installed a Carbon event handler for the application quitting. The callback
does not seem be invoked by the Carbon Event Manager.

Any suggestions as to how I could code the framework to notice when the
application it's linked to is quitting?

Thanks,

Kiel

PS: Sorry, I couldn't resist the nerdy salutation ;-)
___

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: Does NSTextField conform to NSEditor (commitEditing specifically)?

2008-08-07 Thread Joel Norvell
Hello Sean,

I'm no expert on the "NSEditor informal protocol," but there was a recent 
thread in which Ken Thomases reply (which I've quoted below) might be of help 
to you.

http://www.cocoabuilder.com/archive/message/cocoa/2008/7/25/214002

Sincerely,
Joel


On Jul 25 06:13 AM, Ken Thomases wrote:

> You don't mention if you're using bindings.  If you are, you should  
> send one of the -commitEditing... messages to the NSController-derived  
> mediating controllers.  This is part of the NSEditor information  
> protocol.




  
___

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: Preventing deselection of NSOutlineView item

2008-08-07 Thread Markus Spoettl

On Aug 7, 2008, at 2:34 PM, Markus Spoettl wrote:
Basically I'd like the outline view only to change selection to  
other items, but not completely deselect all items. Is there a way  
to do this?



Sometimes things are really simple but I still fail to see them:

  [outlineView setAllowsEmptySelection:NO];

does exactly what I needed. Sorry for the noise and thanks to  
Chaitanya Pandit for pointing it out to me.


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]

Does NSTextField conform to NSEditor (commitEditing specifically)?

2008-08-07 Thread Sean McBride
Hi all,

Maybe it's just time to go home, but...

The NSEditor docs say: "The NSEditor informal protocol is implemented by
controllers and user interface elements. [...] These methods are
typically invoked on user interface elements [...] NSController provides
an implementation of this protocol, as do the Application Kit user
interface elements that support binding."

So shouldn't NSTextField respond to commitEditing?  And yet I get:

"-[NSTextField commitEditing]: unrecognized selector sent to instance"

Huh?

--

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: locale of embedded frameworks

2008-08-07 Thread Torsten Curdt


On Aug 7, 2008, at 23:59, Douglas Davidson wrote:



On Aug 7, 2008, at 2:55 PM, Torsten Curdt wrote:

More details about the problem.  For example, what the code looks  
like in your framework at the point at which the localized strings  
are being retrieved,


Just NSLocalizedString(@"text", nil)


There's your problem.  That obtains localized strings from the main  
bundle--that is, your app bundle, not the framework bundle.  You  
want NSLocalizedStringFromTableInBundle() with the appropriate  
bundle, obtained via bundleForClass: or bundleWithIdentifier:.


Aaaah I see.
Thanks, Douglas!

cheers
--
Torsten
___

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: locale of embedded frameworks

2008-08-07 Thread Douglas Davidson


On Aug 7, 2008, at 2:55 PM, Torsten Curdt wrote:

More details about the problem.  For example, what the code looks  
like in your framework at the point at which the localized strings  
are being retrieved,


Just NSLocalizedString(@"text", nil)


There's your problem.  That obtains localized strings from the main  
bundle--that is, your app bundle, not the framework bundle.  You want  
NSLocalizedStringFromTableInBundle() with the appropriate bundle,  
obtained via bundleForClass: or bundleWithIdentifier:.


Douglas Davidson

___

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: locale of embedded frameworks

2008-08-07 Thread Torsten Curdt

On Aug 7, 2008, at 23:01, Douglas Davidson wrote:

On Aug 7, 2008, at 1:54 PM, Torsten Curdt wrote:
Hm ...so my application is localized and uses the correct nib  
depending on the locale.


Now the application also includes a framework. That framework also  
is localized.
All files (in this case only string files - no nib) are in the  
Resources folder (*.framework/Resources/*.lproj)


But somehow the framework still just sticks with English.

Any pointers? What am I missing?


More details about the problem.  For example, what the code looks  
like in your framework at the point at which the localized strings  
are being retrieved,


Just NSLocalizedString(@"text", nil)

what the exact hierarchy of files in your app and framework looks  
like, etc.


Hierarchy is here

http://vafer.org/gitweb/FeedbackReporter.git?a=tree;h=830fa92fc35a5cbf6965b515d69c1034ab688c07;hb=830fa92fc35a5cbf6965b515d69c1034ab688c07

Or a full snapshot here

http://vafer.org/gitweb/FeedbackReporter.git?a=snapshot;h=830fa92fc35a5cbf6965b515d69c1034ab688c07

cheers
--
Torsten
___

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 have a pop up menu from an ordinary button?

2008-08-07 Thread Rua Haszard Morris
I am trying to implement a mini-size, square bevel button that pops up  
a menu, i.e. a popup button with a square appearance and mini size,  
but have not found a way to achieve this.


NSPopupButton does not support square button appearance, and doesn't  
support setControlSize: (though it can of course be an arbitrary size).


I have seen some suggestions for how to achieve this, for example  
making a NSPopupButton over the top of a square NSButton and setting  
the NSPopupButton transparent. This works but there are draw issues;  
sometimes a rounded white area appears around the NSButton (note that  
I have set the size & location of the popup button to match the  
button, so the clicks are handled appropriately). I also had a look at  
NSMenu popUpContextMenu:, but this did not seem appropriate, as it  
seems solely for right-click/context menus.


How can I do this? I want to avoid having to write the mouse tracking  
code if at all possible, so the popup behaves exactly like a system  
one. I'm not clear on how to do this either..


thanks
Rua HM.
___

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]


Key Binding action methods not declared in public headers

2008-08-07 Thread Ross Carter
The StandardKeyBinding plist binds named action methods to numerous  
key combinations. Many of those action methods are declared in  
NSResponder.h. Many others are not found in AppKit. For example,  
moveToEndOfDocument: (command-down) is an NSResponder method, but  
moveToEndOfDocumentAndModifySelection: (shift-command-down) is not  
declared in any public header that I have found.


That means it’s easy to do this:
- (void) moveToEndOfDocument:(id)sender {
// do some necessary things
[super moveToEndOfDocument:sender];
// do other necessary things
}

But what is the prudent way to do the equivalent for  
moveToEndOfDocumentAndModifySelection: ?


I am mighty tempted to use  
performSelector:@selector(moveToEndOfDocumentAndModifySelection:);  
after all, the action method is right there in  
StandardKeyBinding.plist for all the world to see. On the other hand,  
it is not in a public header and when the roll is called up yonder I  
don’t want to confess that I have used private methods. I suppose it  
will be no use arguing that it wasn’t fair for OS X to publicize those  
methods, bind keystrokes to them, and then implement them in a private  
API.


Thanks,

Ross___

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: Strange flipping bug in Core Animation?

2008-08-07 Thread Matt Long
When you call addSubLayer, you are in essence telling the layer to  
animate so any properties you changed in the layer will animate after  
adding the layer. You are doing this in your awakeFromNib which is  
likely why you don't see the animation when it runs--not sure though.  
You might want to hook it to a button click instead to see it run  
after everything has loaded.


It might help if you explain what you are trying to do. It's not clear  
from your code.


-Matt


On Aug 7, 2008, at 3:53 AM, Moray Taylor wrote:


Dear list,

I first posted this to the quartz list, but I'm starting to think  
I'm the only person on it, some hopefully a Cocoa list reader can  
help...


I think I've stumbled upon a bug/undocumented feature in Core  
Animation, I've made a quick app to demonstrate the issue.


http://s3.amazonaws.com/TempStuff/LayerDebug.zip

Once the app runs, make sure you are in 'tab1', you can resize the  
window, scroll around, all is well (apart from the disappearing blue  
sublayer, but lets ignore that for now, unless anyone knows how to  
fix this?)


You switch to 'tab2' and back again, fine.

BUT, if I switch to 'tab2', resize the window (even a 1 pixel  
tweak), then go back to 'tab1', the layers are now upside down!


I want to use Core Anim in a shipping app, but obviously cannot  
until I sort this out, so I'd really appreciate any input.


Cheers

Moray





 __
Not happy with your email address?.
Get the one you really want - millions of new email addresses  
available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.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/matt.long%40matthew-long.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]


NSTypesetter setLineFragmentRect:

2008-08-07 Thread chaitanya pandit
In my application i have TextView with inLine images/attachments, if i  
try to move the line to a different location using NSTypesetter's  
setLineFragmentRect: forGlyphRange: usedRect: baselineOffset:
the inline attachments don't move with the text, even the drawRect for  
the NSTextAttachmentCell doesn't get called. Any help would be  
appreciated.

Thanks
Chaitanya
___

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]


Preventing deselection of NSOutlineView item

2008-08-07 Thread Markus Spoettl

Hi List,

  I have an app with a bound NSOutlineView (source list style) and  
I'm wondering if there's a way to prevent deselection of a selection  
by the user. The delegate method


- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem: 
(id)item;


is not called when no new item is selected (for example if the user  
clicks in the empty space of the outline view, or when COMMAND-clicks  
the selected item).


Basically I'd like the outline view only to change selection to other  
items, but not completely deselect all items. Is there a way to do this?


The closest thing I came up with is re-setting the selection indexes  
of the tree controller to the last known selected item (via - 
performSelector:withObject:afterDelay:0.0). However, that produces a  
flicker effect because the selection goes away briefly before it comes  
back. Resetting the selection index from within a change notification  
(via observing -selectedObjects of the tree controller) has no effect.


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: packed NSTextfield and NSFormatter in IB3 plugin...

2008-08-07 Thread Cyril Kardassevitch

OK thanks for the tip. But it didn't work.

However the corrected code is :

- (id)initWithCoder:(NSCoder *)decoder
{
  self = [super initWithCoder:decoder];

  if (self)
[self setFormatter: [decoder  
decodeObjectForKey:@"floatFormatter"]];


  return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder
{
  [super encodeWithCoder:encoder];
  [encoder encodeObject:[self formatter] forKey:@"floatFormatter"];
}


So the problem remains the same : why the hell this attached formatter  
inspector can not be accessible and crash interface builder if I try  
so ?

Strangely this formatter is fully functional...

Cyril



Le 7 août 08 à 21:46, Michael Ash a écrit :

On Thu, Aug 7, 2008 at 2:54 PM, Cyril Kardassevitch  
<[EMAIL PROTECTED]> wrote:

hi list,

I've investigated further and try to reproduce the problem with a  
simpler
configuration. So, instead of using my custom objects, I've tried  
to pack
directly NSTextField and NSNumberFormatter into one object  
inherited from
NSTextField. An NSNumberFormatter is generated and become the  
formatter for
the object inherited from NSTextView (testIBView) during its  
initialization.


Here is its implementation :


//  testIBView.m

#import "testIBView.h"

@implementation testIBView

-(id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];

if (self)
  [self setFormatter:[[NSNumberFormatter alloc] init]];

return self;
}

- (id)initWithCoder:(NSCoder *)decoder
{
self = [super initWithCoder:decoder];

if (self)
  [self setFormatter:[[NSNumberFormatter alloc]  
initWithCoder:decoder]];


return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder
{
[super encodeWithCoder:encoder];
[[self formatter] encodeWithCoder:encoder];
}

@end


I don't know if this is the source of your problem, but you really
shouldn't be doing things this way. You should never, ever call
initWithCoder: and encodeWithCoder: directly (unless you're writing a
subclass of NSCoder). If you want to encode and decode sub-objects,
use encodeObject:forKey: and decodeObjectForKey:.

Mike
___

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/cyril%40iluac.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: locale of embedded frameworks

2008-08-07 Thread Douglas Davidson


On Aug 7, 2008, at 1:54 PM, Torsten Curdt wrote:

Hm ...so my application is localized and uses the correct nib  
depending on the locale.


Now the application also includes a framework. That framework also  
is localized.
All files (in this case only string files - no nib) are in the  
Resources folder (*.framework/Resources/*.lproj)


But somehow the framework still just sticks with English.

Any pointers? What am I missing?


More details about the problem.  For example, what the code looks like  
in your framework at the point at which the localized strings are  
being retrieved, what the exact hierarchy of files in your app and  
framework looks like, etc.


Douglas Davidson

___

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]


locale of embedded frameworks

2008-08-07 Thread Torsten Curdt
Hm ...so my application is localized and uses the correct nib  
depending on the locale.


Now the application also includes a framework. That framework also is  
localized.
All files (in this case only string files - no nib) are in the  
Resources folder (*.framework/Resources/*.lproj)


But somehow the framework still just sticks with English.

Any pointers? What am I missing?

cheers
--
Torsten
___

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: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Randall Meadows

On Aug 7, 2008, at 2:36 PM, Nate Weaver wrote:


From the docs:

"NSWorkspaceRecycleOperation
Move file to trash. The file is moved to the trash folder on the  
volume containing the file[...]"


So it's definitely a bug in NSWorkspace if it doesn't work this way.


On Aug 7, 2008, at 2:37 PM, Mark Allan wrote:

My reply to the list hasn't come through yet cos it's awaiting  
moderation, but basically what I said is that you should leave the  
destination directory at the empty string @"" and NSWorkspace works  
out for itself which trash directory to use.


Hmm...so it does.  Some other article I found (cocoadev?) led me  
astray then.



Thanks, guys.
___

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: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Ken Ferry
Part of the confusion may be the 'destination' parameter that
-[NSWorkspace performFileOperation:source:destination:files:tag:]
takes?

The recycle operation doesn't use the destination parameter.  It
calculates the correct trash directory for you.  The docs note that
not all operations use the destination, but it could probably be
clearer.

"Some operations—such as moving, copying, and linking files—require a
destination directory to be specified. If not, destination should be
the empty string (@"")."

-Ken

On Thu, Aug 7, 2008 at 1:36 PM, Nate Weaver <[EMAIL PROTECTED]> wrote:
> From the docs:
>
> "NSWorkspaceRecycleOperation
> Move file to trash. The file is moved to the trash folder on the volume
> containing the file[...]"
>
> So it's definitely a bug in NSWorkspace if it doesn't work this way.
>
> On Aug 7, 2008, at 3:23 PM, Ken Ferry wrote:
>
>> On Thu, Aug 7, 2008 at 1:19 PM, Randall Meadows <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> On Aug 7, 2008, at 2:12 PM, Nate Weaver wrote:
>>>
 I'd say just try the default options and see what happens. You might
 also
 look at -[NSWorkspace
 performFileOperation:source:destination:files:tag:]
 with NSWorkspaceRecycleOperation as the first argument.
>>>
>>> Yes, that's actually what I started with, but that doesn't
>>> (automatically)
>>> take into account the volume that the document resides on and its related
>>> Trash directory.  Which is what I'm hoping FSMoveObjectToTrash gives me.
>>
>> If something about NSWorkspace's behavior doesn't match the Finder,
>> please file a bug.
>>
>> Ken Ferry
>> Cocoa Frameworks
>>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Nate Weaver

From the docs:

"NSWorkspaceRecycleOperation
Move file to trash. The file is moved to the trash folder on the  
volume containing the file[...]"


So it's definitely a bug in NSWorkspace if it doesn't work this way.

On Aug 7, 2008, at 3:23 PM, Ken Ferry wrote:

On Thu, Aug 7, 2008 at 1:19 PM, Randall Meadows <[EMAIL PROTECTED] 
pc.com> wrote:

On Aug 7, 2008, at 2:12 PM, Nate Weaver wrote:

I'd say just try the default options and see what happens. You  
might also
look at -[NSWorkspace  
performFileOperation:source:destination:files:tag:]

with NSWorkspaceRecycleOperation as the first argument.


Yes, that's actually what I started with, but that doesn't  
(automatically)
take into account the volume that the document resides on and its  
related
Trash directory.  Which is what I'm hoping FSMoveObjectToTrash  
gives me.


If something about NSWorkspace's behavior doesn't match the Finder,
please file a bug.

Ken Ferry
Cocoa Frameworks



___

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: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Randall Meadows
[Sending again since I neglected to include the list in the first  
reply.  Tell me again why this list isn't configured with reply-to-all  
by default?]


On Aug 7, 2008, at 2:23 PM, Ken Ferry wrote:

On Thu, Aug 7, 2008 at 1:19 PM, Randall Meadows <[EMAIL PROTECTED] 
pc.com> wrote:

On Aug 7, 2008, at 2:12 PM, Nate Weaver wrote:

I'd say just try the default options and see what happens. You  
might also
look at -[NSWorkspace  
performFileOperation:source:destination:files:tag:]

with NSWorkspaceRecycleOperation as the first argument.


Yes, that's actually what I started with, but that doesn't  
(automatically)
take into account the volume that the document resides on and its  
related
Trash directory.  Which is what I'm hoping FSMoveObjectToTrash  
gives me.


If something about NSWorkspace's behavior doesn't match the Finder,
please file a bug.


It's not that "NSWorkspace's behavior doesn't match the Finder", it's  
that I have to do (lots of?) extra work to determine the correct  
destination Trash directory, depending on the volume where the file  
being moved to the "Trash" lives.  Work that FSMoveObjectToTrashX  
allegedly does for me, but there's the documentation conflict that  
bothers me.  Perhaps that's the real bug?

___

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: Modules in Objective-C like e.g. OSGi-Bundles in Java

2008-08-07 Thread Jonathan deWerd

On Aug 7, 2008, at 1:45 PM, Matthias Luebken wrote:


Hi

I'm new to Cocoa and Objective-C. Please point me to a different group
/ forum if this mailing-list isn't appropriate.

I have a fairly basic language question: Is there a module concept in
Objective-C / Cocoa? I'm thinking in terms of OSGi bundles[0]. What
would I do if I would like to encapsulate a certain functionality that
consists of several classes? Could I define an API how to use this
module and make sure private classes of this module aren't visible to
the outside?

Thanks in advance.
Looking forward to learn Obj-C and Cocoa
Matthias

[0] http://www.osgi.org/About/Technology#Framework


No, there is no module system in ObjC, and there is no concrete way to  
make methods private. We believe in convention over regulation: it  
makes dealing with exceptional cases that much easier.


Class names are prefixed by (usually) two letter codes that identify  
the developer or the project. These are remarkably effective at  
avoiding name conflicts, the idea being that if your identifier +  
classname isn't unique then you should really be extending the other  
person's class or renaming yours more specifically. If you were really  
pedantic I guess you might even give your classes a reverse DNS prefix  
and use macros for convenience.


Similarly, there are no private methods. Convention, however, makes  
anything starting with underscores private. You can also add a  
category whose interface is only visible inside your implementation  
file. That being said, if you really really want private methods, I  
would suggest defining C-like functions (static, inline, or prefixed  
with the class name to avoid conflict) inside your @implementation:  
they can access private variables without warning, like so:

@interface FooClass : NSObject {
int _myVariable;
}
- (void)plusPlus;
@end

//In your .m or .mm file
@implementation FooClass
inline incrementVariable(FooClass* self, int incBy) {
self->_myVariable += incBy;
}
- (void)plusPlus {
incrementVariable(self,1);
}
@end

The overriding philosophy here is that a little verbosity  
simultaneously avoids conflicts  and makes code more understandable,  
while not significantly impacting typing time (this is the age of auto- 
complete and tab-triggers, after all). If you're trying to implement a  
security system (ala OSGi) that tries to sequester code within a  
native process, you're playing a loosing game: since the process is  
native, every piece of code has access (however indirect) to every  
piece of memory and code within the process. If you really wanted to,  
you might be able to mess with the EMMI (see the Kernel Programming  
Guide) enough to change that, but it'd be a chore.


In the OSX (and UNIX) security model, you sandbox things at the  
process level. If you want your program to make a privileged  
modification of the system, for instance, you would probably make a  
small command line utility and include it in your app. You then  
authorize the utility (through the infamous lock dialog) and call it  
from your program to do what you want. You might use IPC (through mach  
or the cocoa IPC mechanism) if you need to control a multi-step  
privileged subprogram.


If you want to run constrained plugins, you might look into a  
scripting language that was designed for such considerations, and  
provide proxies that only allow access to certain parts of the parent  
program.


Sorry if I got derailed on security: your message does'n mention it  
but your link does. In any case, I hope this information was helpful.





___
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list  ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/jjoonathan%40gmail.com

This email sent to [EMAIL PROTECTED]




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: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Ken Ferry
On Thu, Aug 7, 2008 at 1:19 PM, Randall Meadows <[EMAIL PROTECTED]> wrote:
> On Aug 7, 2008, at 2:12 PM, Nate Weaver wrote:
>
>> I'd say just try the default options and see what happens. You might also
>> look at -[NSWorkspace performFileOperation:source:destination:files:tag:]
>> with NSWorkspaceRecycleOperation as the first argument.
>
> Yes, that's actually what I started with, but that doesn't (automatically)
> take into account the volume that the document resides on and its related
> Trash directory.  Which is what I'm hoping FSMoveObjectToTrash gives me.

If something about NSWorkspace's behavior doesn't match the Finder,
please file a bug.

Ken Ferry
Cocoa Frameworks
___

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 do I get those 1 pixel black lines into my app window?

2008-08-07 Thread Ken Ferry
Hi Sumner,

Check out the discussion of -[NSWindow
setContentBorderThickness:forEdge:] in the AppKit release notes.
Here's some of it, but it's probably better to read it in context.

"The behavior of -setContentBorderThickness:forEdge:NSMinYEdge and
-setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge for
non-textured windows will do the following: The top gradient will be
repeated in the bottom border, separator lines will be drawn between
the content and the bottom border, and the bottom corner will be
rounded. Other methods on non-textured windows or unused edges will
return 0.0 or YES."

http://developer.apple.com/releasenotes/Cocoa/AppKit.html#NSWindow

-Ken

On Thu, Aug 7, 2008 at 11:20 AM, Sumner Trammell
<[EMAIL PROTECTED]> wrote:
> Hi, I've notced that in most apps, at the top and bottom, there is a 1
> pixel black line separating the gray window
> from the (usually) white content.
>
> This looks better than stock, which of course is why everybody and
> Apple seems to be doing it. What is the canonical way to do this?  Are
> people using horizontal line NSBox objects to create these?  That
> seems like a kludge.  They also make for Illegal Geometry complaints
> from Interface Builder.
>
>
> Thanks,
> -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/kenferry%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: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Randall Meadows

On Aug 7, 2008, at 2:12 PM, Nate Weaver wrote:

I'd say just try the default options and see what happens. You might  
also look at -[NSWorkspace  
performFileOperation:source:destination:files:tag:] with  
NSWorkspaceRecycleOperation as the first argument.


Yes, that's actually what I started with, but that doesn't  
(automatically) take into account the volume that the document resides  
on and its related Trash directory.  Which is what I'm hoping  
FSMoveObjectToTrash gives me.


___

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 do I get those 1 pixel black lines into my app window?

2008-08-07 Thread Brandon Walkin
Use a non-textured window instead of a textured one. You'll get a  
black line beneath the titlebar (or toolbar). To get a bottom bar with  
a divider line, call this method on your window:


- (void)setContentBorderThickness:(CGFloat)borderThickness forEdge: 
(NSRectEdge)edge


Set the thickness to 34 for a large bar, or 24 for a small one. Edge  
should be NSMinYEdge.


Cheers,
Brandon

On 7-Aug-08, at 2:20 PM, Sumner Trammell wrote:


Hi, I've notced that in most apps, at the top and bottom, there is a 1
pixel black line separating the gray window
from the (usually) white content.

This looks better than stock, which of course is why everybody and
Apple seems to be doing it. What is the canonical way to do this?  Are
people using horizontal line NSBox objects to create these?  That
seems like a kludge.  They also make for Illegal Geometry complaints
from Interface Builder.


Thanks,
-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/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: Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Nate Weaver
I'd say just try the default options and see what happens. You might  
also look at -[NSWorkspace  
performFileOperation:source:destination:files:tag:] with  
NSWorkspaceRecycleOperation as the first argument.


On Aug 7, 2008, at 2:03 PM, Randall Meadows wrote:

The description for FSMoveObjectToTrashSync says: "This function  
moves a file or directory to the Trash, adjusting the object’s name  
if necessary."  (Meaning, I suppose, it appends a number to the  
filename to make it unique in the Trash directory.)


Lovely, *exactly* what I need to do.  Happy happy, joy joy!

However, when I get into actually writing the code, I get to the  
"options" argument, which are described as:


"kFSFileOperationDefaultOptions
Use the following default options:

•If the destination directory contains an object with the same name  
as a source object, abort the operation.


kFSFileOperationOverwrite
If the destination directory contains an object with the same name  
as a source object, overwrite the destination object."



Um, what happened to that part about "adjusting the object’s name if  
necessary"?  According to the options flags, that is not possible;  
it's either abort the operation or overwrite.


Anyone know the skinny on this actually works?  The way I want to  
use this function is to move a file that resides in a document  
bundle into the Trash directory that resides on the same volume as  
the document bundle (and yes, I understand that not all volumes  
support Trash folders, I can handle that).


Thanks!
randy___

___

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: packed NSTextfield and NSFormatter in IB3 plugin...

2008-08-07 Thread Michael Ash
On Thu, Aug 7, 2008 at 2:54 PM, Cyril Kardassevitch <[EMAIL PROTECTED]> wrote:
> hi list,
>
> I've investigated further and try to reproduce the problem with a simpler
> configuration. So, instead of using my custom objects, I've tried to pack
> directly NSTextField and NSNumberFormatter into one object inherited from
> NSTextField. An NSNumberFormatter is generated and become the formatter for
> the object inherited from NSTextView (testIBView) during its initialization.
>
> Here is its implementation :
>
>
> //  testIBView.m
>
> #import "testIBView.h"
>
> @implementation testIBView
>
> -(id)initWithFrame:(NSRect)frame
> {
>  self = [super initWithFrame:frame];
>
>  if (self)
>[self setFormatter:[[NSNumberFormatter alloc] init]];
>
>  return self;
> }
>
> - (id)initWithCoder:(NSCoder *)decoder
> {
>  self = [super initWithCoder:decoder];
>
>  if (self)
>[self setFormatter:[[NSNumberFormatter alloc] initWithCoder:decoder]];
>
>  return self;
> }
>
> - (void)encodeWithCoder:(NSCoder *)encoder
> {
>  [super encodeWithCoder:encoder];
>  [[self formatter] encodeWithCoder:encoder];
> }
>
> @end

I don't know if this is the source of your problem, but you really
shouldn't be doing things this way. You should never, ever call
initWithCoder: and encodeWithCoder: directly (unless you're writing a
subclass of NSCoder). If you want to encode and decode sub-objects,
use encodeObject:forKey: and decodeObjectForKey:.

Mike
___

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: NSOperationQueue Memory Leak

2008-08-07 Thread Michael Ash
On Wed, Aug 6, 2008 at 9:38 AM, Mike Simmons <[EMAIL PROTECTED]> wrote:
> I have an audio application that processes numerous audio streams into
> ten-second clips, compresses the clips, and saves them to disk. Naturally, I
> wanted to move from single-threaded processing to multithreaded processing
> for the clip compression/writing. That was easily done using the
> NSOperationQueue and the NSInvocation classes, and it worked nicely, apart
> from a bad memory leak that I can't seem to eradicate. So I finally wrote a
> small test application to encapsulate what I was doing in the larger
> program, and it too has a leak -- a big one!
>
> The test application simply spawns 1 threads whose sole job is to
> display "Hi, I am thread xx" on the console. It then sleeps and spawns 1
> more. At the end of the run some 38 MB of  real memory has been used, and it
> never goes down.  (I'm not using garbage collection, but I think I'm doing
> things correctly with the autorelease pool.)
>
> Can someone tell me what I'm doing wrong?

Two things:

1) As others have already pointed out, you're managing your memory
incorrectly. This is the main problem, and they've covered it.

2) Expecting your "real memory" usage to decrease. I assume you're
using Activity Monitor or top. These tools display how much memory
your process has requested from the OS. However, requesting memory
from the OS is expensive. Often the allocator, when freeing memory,
will not return it to the OS, but instead just keep it so that it can
be reused for the next allocation. Having your memory usage in these
tools not go down can be a good warning sign (and having it increase
without limit is a definite problem) but you should use a dedicated
tool such as MallocDebug or ObjectAlloc to determine if you're leaking
and why.

Mike
___

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: -[NSBrowser scrollToVisible] not making all of the column

2008-08-07 Thread Martin Redington
Hmmm. Looks like no joy on this one then. A bit of a shame, as it
looks like this should be quite easy to do (although presumably it's
actually not, or else it would have been fixed). Still, at least it's
not *too* bad.

I'll file a bug as well.

If anyone has any pointers to the multiple cells redraw issue
mentioned in my other post, that would be fab ...

On Thu, Aug 7, 2008 at 7:59 PM,  <[EMAIL PROTECTED]> wrote:

> Message: 4
> Date: Thu, 07 Aug 2008 12:37:28 -0400
> From: Bill Cheeseman <[EMAIL PROTECTED]>
> Subject: Re: -[NSBrowser scrollToVisible] not making all of the column
>visible
> To: Cocoa-Dev Mail 
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain;   charset="US-ASCII"
>
> on 2008-08-07 12:06 PM, Martin Redington at
> [EMAIL PROTECTED] wrote:
>
>> [apologies if this is a repost - I sent it a while ago, but didn't see
>> it appear on the list or in the archives]
>
> I guess you didn't see my reply either.
>
> I reported this as a bug about 4 years ago, but I'm not aware that anything
> has been done about it.
>
> --
>
> Bill Cheeseman - [EMAIL PROTECTED]
> Quechee Software, Quechee, Vermont, USA
> www.quecheesoftware.com
>
> PreFab Software - www.prefabsoftware.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]


(no subject)

2008-08-07 Thread Zphofar Ægir Spender G



Zphofar Ægir Spender Gulu___

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]


Confusion over FSMoveObjectToTrashSync docs

2008-08-07 Thread Randall Meadows
The description for FSMoveObjectToTrashSync says: "This function moves  
a file or directory to the Trash, adjusting the object’s name if  
necessary."  (Meaning, I suppose, it appends a number to the filename  
to make it unique in the Trash directory.)


Lovely, *exactly* what I need to do.  Happy happy, joy joy!

However, when I get into actually writing the code, I get to the  
"options" argument, which are described as:


"kFSFileOperationDefaultOptions
Use the following default options:

•If the destination directory contains an object with the same name as  
a source object, abort the operation.


kFSFileOperationOverwrite
If the destination directory contains an object with the same name as  
a source object, overwrite the destination object."



Um, what happened to that part about "adjusting the object’s name if  
necessary"?  According to the options flags, that is not possible;  
it's either abort the operation or overwrite.


Anyone know the skinny on this actually works?  The way I want to use  
this function is to move a file that resides in a document bundle into  
the Trash directory that resides on the same volume as the document  
bundle (and yes, I understand that not all volumes support Trash  
folders, I can handle that).


Thanks!
randy___

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 question

2008-08-07 Thread Sandro Noel

Quincey & Marco,

Thank you guy's, Very helpful information!
:)


Sandro

On 6-Aug-08, at 3:31 PM, Sandro Noel wrote:



Greetings! :)

I'm experimenting with core data, bindings work just fine, I love  
them and it's great and all. :)
but I want to import a massive file into the database. so I'm trying  
to create it programatically.


So far I've been able to insert records in simple entities, using  
some code from the Core Data Documentation.
Where my problem lies, is with relationships, and data types other  
than NSString, so here comes the code.

--
I have entities like this.

TransactionTypes
Atributes : Name:String
Relationships: Transaction

Transactions
Atributes: Amount:Double, Date:Date, Memo:String, Payee:String
Relationships: TransactionType
---
I retrieve/create/insert (not quite sure yet :)) an object from the  
context, and set the values like this.


NSManagedObject *transaction = [NSEntityDescription  
insertNewObjectForEntityForName:@"Transactions"

 inManagedObjectContext:[self 
managedObjectContext]];

[transaction setValue:tr.transactionAmount forKey:@"Amount"];
[transaction setValue:tr.transactionType
forKey:@"TransactionType.Name"];

[transaction setValue:tr.displayName   forKey:@"Name"];
[transaction setValue:tr.memo  forKey:@"Memo"];
[transaction setValue:tr.datePostedforKey:@"Date"];

---
The Transaction(tr) Object Used in the code above is defined like  
this:


@interface OFXTransaction : NSObject {
NSString*transactionType;
	NSDate	  	*datePosted; //-mm-dd / converted from string  
20080201125910

NSNumber*transactionAmount;
NSString*uniqueID;
NSString*displayName;
NSString*memo;
}
@property (readwrite, copy) NSString*transactionType;
@property (readwrite, copy) NSDate  *datePosted;
@property (readwrite, copy) NSNumber*transactionAmount;
@property (readwrite, copy) NSString*uniqueID;
@property (readwrite, copy) NSString*displayName;
@property (readwrite, copy) NSString*memo;
-
Now, when I try to set the value for the [date] or [Amount] or  
[TransactionType], of the ManagedObject, i get an error:
*** -[NSCFString managedObjectContext]: unrecognized selector sent  
to instance 0xXeXX
The only thing that really works fine are the strings, I don't get  
it... must be a simple mistake from my part here.

or something I missed in the documentation...:S

another thing I would like to understand, do relationships work like  
constraints in SQL ?
in the sense that if there is no transactionType defined in the  
TransactionTypes Entity,
I would not be able to insert a value in the transactionType field  
of the transactions entity?


do I have to first select/fetch an object from the transactionsType  
entety, and assign that to the transactionType atribute of the

transactions entety...?


Again, thank you guy's for being there, and helping out the  
newcomers :)

Sandro.


___

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: packed NSTextfield and NSFormatter in IB3 plugin...

2008-08-07 Thread Cyril Kardassevitch

hi list,

I've investigated further and try to reproduce the problem with a  
simpler configuration. So, instead of using my custom objects, I've  
tried to pack directly NSTextField and NSNumberFormatter into one  
object inherited from NSTextField. An NSNumberFormatter is generated  
and become the formatter for the object inherited from NSTextView  
(testIBView) during its initialization.


Here is its implementation :


//  testIBView.m

#import "testIBView.h"

@implementation testIBView

-(id)initWithFrame:(NSRect)frame
{
  self = [super initWithFrame:frame];

  if (self)
[self setFormatter:[[NSNumberFormatter alloc] init]];

  return self;
}

- (id)initWithCoder:(NSCoder *)decoder
{
  self = [super initWithCoder:decoder];

  if (self)
[self setFormatter:[[NSNumberFormatter alloc]  
initWithCoder:decoder]];


  return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder
{
  [super encodeWithCoder:encoder];
  [[self formatter] encodeWithCoder:encoder];
}

@end


tesIBView is the main object of the interface builder 3 plugin project  
that is generated via XCode. Interface builder generates the same  
error and the same backtrace when I tried to click on the formatter  
button (bottom right of the text field)


Obviously, I have missed something... Any idea ?

Thanks,
Cyril.


Le 7 août 08 à 11:02, Cyril Kardassevitch a écrit :


hi,

I have designed customs NSTextField and NSFormatter objects that I  
have tried to pack in an interface builder 3 plugin...


This works fine (can drag and drop the field, can access field  
inspector), except that when I select the formatter, interface  
builder generates an assertion failure with :


Backtrace:
 1. Interface Builder0x6620 [IBApplication  
handleAssertion:inFile:onLine:]
 2. InterfaceBuilderKit  0x0021bed4 [IBObjectContainer  
objectIDForObject:]
 3. InterfaceBuilderKit  0x0021c0ec [IBObjectContainer  
metadataForKey:ofObject:]
 4. InterfaceBuilderKit  0x00224e84 [IBDocument  
customClassNameForObject:]
 5. InterfaceBuilderKit  0x00224e0c [IBDocument  
classNameForObject:]
 6. InterfaceBuilderKit  0x0023f210 [IBDocument  
commonCustomClassNameOfObjects:]
 7. InterfaceBuilderKit  0x0023f15c [IBInspectorController  
computeTitle]
 8. InterfaceBuilderKit  0x0023f08c [IBInspectorController  
refresh]
 9. InterfaceBuilderKit  0x0023b630 [IBInspectorController  
rebuildInspectorStack]
10. InterfaceBuilderKit  0x0023b4c0 [IBInspectorController  
validate:]

...

The NSTextField and NSFormatter child have their own working  
plugins, and there is absolutely no problem if I combine the 2 above  
objects manually in interface builder. The field and its formatter  
are then fully accessible and designable.


I've tried various things without success. Has anyone got a tip on  
how to expose a programmatically attached formatter ?


Thanks.
Cyril.


___

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/cyril%40iluac.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: Saving Outline View Column Widths

2008-08-07 Thread Gerriet M. Denkmann


On 8 Aug 2008, at 01:21, Corbin Dunn wrote:



On Aug 7, 2008, at 10:06 AM, Gerriet M. Denkmann wrote:


I have an OutlineView, which has an Autosave Name set in IB.
Works fine. I change a column width, close the document, open  
another document: the columns are just as they should be.

Let's say, I want the first column to be 2 cm wide.

Now I click on some disclosure triangle, new rows come up and the  
first column gets 5.64 mm wider (= 16 pixels). Make sense, because  
these new rows are indented by 5.6 mm.


Now, close the document; open new document - but this time the  
first column (although no disclosure triangle is open)  is 2.56 cm  
wide.


So, obviously not the basic column-width gets stored, but the  
current column-width including the shifts added by opening a  
disclosure triangle.


Is this behaviour correct?
Anyway: I don't like it.
So: how can it be turned off ? How can one tell the Outline View  
to save the basic column-widths?

Using Tiger 10.4.11.


The difficulty here is that it is restoring the exact last width  
that it had. It is debatable as to whether or not this is correct;  
feel free to log a bug for it.


Your best bet is to call setAutoresizesOutlineColumn:NO.


Or collapse all items in windowWillClose:. Works very nicely for me.

Kind regards,

Gerriet.

___

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: Properties, read only and bindings

2008-08-07 Thread Steven W Riggins

Excellent, even cleaner!

Thanks so much,

Steve

On Aug 6, 2008, at 11:00 PM, Negm-Awad Amin wrote:



Am Do,07.08.2008 um 07:32 schrieb Roland King:

If your isCloning is a property itself, can you use the dependent  
key registration logic instead?


[ self setKeys:[ NSArray arrayWithObjects:@"isCloning", nil ]  
triggerChangeNotificationsForDependentKey:@"cloningLable" ];


I've never tried this, but it's documented here and I recall  
reading about it.
It works and this is what - 
setKeys:triggerChangeNotificationForDependentKey: is for - running  
under tiger.


The dependent keys mechanism changed in leopard:
+keyPathsForValuesAffectingValueForKey:
+keyPathsForValuesAffecting

// Simple sample
+ (NSArray*)keyPathForValuesAffectingButtonTitle {
  return [NSArray arrayWithObject:@"myState"];
}

Amin



http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/DependentKeys.html#/ 
/apple_ref/doc/uid/20002179


Rols

Steven W Riggins wrote:


Aha!

I was missing the willChangeForKey: call.

- (IBAction) toggleIsCloning: (id) sender
{
  [self willChangeValueForKey:@"cloningLabel"];
  self.isCloning = !self.isCloning;
  [self didChangeValueForKey:@"cloningLabel"];
}

Now it works fine, thanks!

On Aug 6, 2008, at 10:07 PM, Bill Bumgarner wrote:


On Aug 6, 2008, at 9:51 PM, Steven W Riggins wrote:


I'm winding my way through KVO, readonly properties and bindings.

I have an object which has a bool state.  I have a method that   
toggles that state.


I have a button that calls the method that toggles the state.   
The  button has a title, which I've bound to a readonly  
property, which  has a getter that returns a localized label  
based on the state.


So when I change the state, obviously the readonly property  
doesn't  change, and thus the button label does not change.


Changing the readonly property to a normal ivar works fine.

Is there a way to use a synthesized property in this manner, or  
is  it even proper?



You can solve this in the following two ways (amongst others):

(1) Redeclare the property as readwrite in a class extension in   
your .m file and then use dot syntax or the synthesized setter/  
getter to set the value.


I.e.

.h:
@interface Foo : NSObject
{
  BOOL f;
}

@property(readonly, nonatomic) BOOL f;
@end

.m
@interface Foo()
@property(readwrite, nonatomic) BOOL f;
@end

@implementation Foo
@synthesize f;
// ... use the setter and getter as needed
@end

(2) Call willChange/didChange before/after you change the value:

- (void) toggle: sender
{
   logic ...
  [self willChangeValueForKey: @"f"];
  f = ... new state ...;
  [self didChangeValueForKey: @"f"];
}

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/rols%40rols.org

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


Xcode and Cocoa docs and the Preview sidebar TOC

2008-08-07 Thread P Teeson

I recently installed Leopard 10.5.4 and Xcode 3.1.1.
Reading the docs launches Preview by default. To see the TOC one  
opens the sidebar.

However I can't get it to open on the lhs of the doc - only the rhs.

Yes I tried moving the window to the rhs of the screen and then  
opening it.

Which is the way it works in Mail and in Preview under Tiger.
Can't see anything in the Preview prefs for this.

So how do I get the Sidebar (a.k.a. Drawer) to open on the lhs of the  
doc?
I did Google and asked in the Leopard forum but no relevant answer so  
far.


(I feel foolish asking this but I havn't yet discovered a way to do it.
Yes the coffee has kicked in. I ask in these groups because it's  
related to their docs.)


respect

Peter
___

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: Saving Outline View Column Widths

2008-08-07 Thread Corbin Dunn


On Aug 7, 2008, at 10:06 AM, Gerriet M. Denkmann wrote:


I have an OutlineView, which has an Autosave Name set in IB.
Works fine. I change a column width, close the document, open  
another document: the columns are just as they should be.

Let's say, I want the first column to be 2 cm wide.

Now I click on some disclosure triangle, new rows come up and the  
first column gets 5.64 mm wider (= 16 pixels). Make sense, because  
these new rows are indented by 5.6 mm.


Now, close the document; open new document - but this time the first  
column (although no disclosure triangle is open)  is 2.56 cm wide.


So, obviously not the basic column-width gets stored, but the  
current column-width including the shifts added by opening a  
disclosure triangle.


Is this behaviour correct?
Anyway: I don't like it.
So: how can it be turned off ? How can one tell the Outline View to  
save the basic column-widths?

Using Tiger 10.4.11.


The difficulty here is that it is restoring the exact last width that  
it had. It is debatable as to whether or not this is correct; feel  
free to log a bug for it.


Your best bet is to call setAutoresizesOutlineColumn:NO.

corbin
___

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 do I get those 1 pixel black lines into my app window?

2008-08-07 Thread Sumner Trammell
Hi, I've notced that in most apps, at the top and bottom, there is a 1
pixel black line separating the gray window
from the (usually) white content.

This looks better than stock, which of course is why everybody and
Apple seems to be doing it. What is the canonical way to do this?  Are
people using horizontal line NSBox objects to create these?  That
seems like a kludge.  They also make for Illegal Geometry complaints
from Interface Builder.


Thanks,
-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: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-07 Thread JongAm Park

Hello.

I implemented it to reduce # of disk I/O and used valloc and realloc. 
Because it should accumulate data between each callback from the FCP, I 
tried realloc them. And the result was... it is much faster than the 
original code. I even remove intermediate codes for threading!


Thank you very much for the information!

Best regards,
JongAm Park

James Bucanek wrote:
That probably won't gain you that much. Fractional page writes will 
still requires FSWRriteFork to first copy the data into its file 
buffer, which is where I suspect much of your current overhead is.


Writing your data into a local, aligned, buffer shouldn't be too 
difficult to re-engineer. I assume that it's your code that's 
performing the FSWriteFork calls. Replace that with a subroutine to 
copy the fractional block into your own buffer. When you have some 
multiple of getpagesize() bytes copied, write that and repeat.


The solution for my application was only a little more sophisticated. 
My code maintains a set of circular buffers and the data is written to 
the file on a separate thread. My main thread can continue to assemble 
new data while the first buffer's worth is being written concurrently.


Also consider asking this question on the filesystem-dev list. There's 
some serious filesystem knowledge on that list that often doesn't have 
time to monitor Cocoa-dev.


James

JongAm Park  wrote 
(Sunday, August 3, 2008 8:55 PM -0700):



Thank you very much for the valuable information.

I will try the 1st and the 3rd options, because the 2nd option will 
not be easily applicable withouth refactoring the current code a lot.


- Align the data to be written in memory to page boundaries (man 
valloc).

- Write data in multiples of page size blocks (man getpagesize)
- Turn off caching (see Cache Constants of FSWriteFork)


___

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]


Saving Outline View Column Widths

2008-08-07 Thread Gerriet M. Denkmann

I have an OutlineView, which has an Autosave Name set in IB.
Works fine. I change a column width, close the document, open another  
document: the columns are just as they should be.

Let's say, I want the first column to be 2 cm wide.

Now I click on some disclosure triangle, new rows come up and the  
first column gets 5.64 mm wider (= 16 pixels). Make sense, because  
these new rows are indented by 5.6 mm.


Now, close the document; open new document - but this time the first  
column (although no disclosure triangle is open)  is 2.56 cm wide.


So, obviously not the basic column-width gets stored, but the current  
column-width including the shifts added by opening a disclosure  
triangle.


Is this behaviour correct?
Anyway: I don't like it.
So: how can it be turned off ? How can one tell the Outline View to  
save the basic column-widths?

Using Tiger 10.4.11.


Kind regards,

Gerriet.
___

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 debug a corrupted stack

2008-08-07 Thread Johannes Fortmann
The problem here is that UTCDateTime is defined with #pragma pack 2 in  
effect. That means the compiler packs with an alignment of 2, so the  
whole structure has 8 bytes. The proper alignment (4) results in 12  
bytes. Since there's nothing in the @encode'd information specifying  
the non-standard alignment, NSGetSizeAndAlignment (which NSValue  
probably uses internally) will return 12 bytes as the struct's size.


As an example,

#include 

void main()
{
   NSUInteger size, align;
   NSGetSizeAndAlignment (@encode(UTCDateTime),
  &size,
  &align);
   printf("%i, %i, %s\n", sizeof(UTCDateTime), size,  
@encode(UTCDateTime));

}

prints "8, 12, {UTCDateTime=SIS}".

HTH,
Johannes Fortmann
___

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]


NSBrowser redraw issues with multiple selection

2008-08-07 Thread Martin Redington
Here's another NSBrowser issue (this is on Leopard, BTW)

I'm allowing multiple selection in my NSBrowser.

When my NSBrowser loses focus, the multiple selected cells correctly
change to have a grey background, but when it regains focus, only the
last selected cell gets updated correctly to the active selection
colour.

If I scroll the browser or switch apps, the selected cells are
correctly redrawn.

I've tried forcing redrawing by calling setNeedsDisplay on the matrix,
or  -[NSMatrix drawCellAtRow:column:]  for each cell, but this seems
to make no difference.

Quartz Debug shows that the last selected cell is getting redrawn, but
that the other cells never do, as though the Browser never realises
that the cells are dirty and need redrawing too.

Any suggestions for how to ensure that all of the selected cells
redraw would be great ...


-- 
http://www.mildmanneredindustries.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: -[NSBrowser scrollToVisible] not making all of the column visible

2008-08-07 Thread Bill Cheeseman
on 2008-08-07 12:06 PM, Martin Redington at
[EMAIL PROTECTED] wrote:

> [apologies if this is a repost - I sent it a while ago, but didn't see
> it appear on the list or in the archives]

I guess you didn't see my reply either.

I reported this as a bug about 4 years ago, but I'm not aware that anything
has been done about it.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.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: -[NSBrowser scrollToVisible] not making all of the column visible

2008-08-07 Thread Negm-Awad Amin


Am Do,07.08.2008 um 18:06 schrieb Martin Redington:


[apologies if this is a repost - I sent it a while ago, but didn't see
it appear on the list or in the archives]

I've got an app with a NSOutlineView and NSBrowser view of the same
data (the file system).

I preserve the user's selection between when switching between views.

A lot of the time, the NSBrowser scrolls to show the entire selected
column. However, sometimes, only a portion of the selected column gets
shown, even when I call -[NSBrowser scrollColumnToVisible] explicitly.

I get the impression that NSBrowser is checking to see whether any of
the selected column is visible, and if so, not scrolling at all.

What I'd hoped would happen is that it would scroll to show all of the
column - it seems that forcing this behaviour programmatically is
difficult, as NSBrowser only allows scrolling by column indexes.

Is the behaviour I'm seeing (not all column made visible if any is
already visible) the expected behaviour?
No explanation, no solution, but maybe a specific behaviour of the  
finder related to browsers may help you to find a work-around:



1. Switch to browser-view in finder and select an item deep inside the  
file system, so a part of the path is visible:

http://www.cocoading.de/webspace/ScrollStart.tiff

2. Than select the partial visible item, which is a part of the path  
(grey background): Everything is nice, scrolled correctly!

http://www.cocoading.de/webspace/ScrollInsidePath.tiff

3. Try steps 1+2 again, but select a partial visible item, which is  
*not* a part of the path (white background). No Scrolling is applied!

http://www.cocoading.de/webspace/ScrollOutsidePath.tiff

4. Even worse: There is no scrolling, when you edit the item:
http://www.cocoading.de/webspace/ScrollEdit.tiff

Maybe it is a work-around to select a subitem of the selected item and  
then return to the selected item.



Amin




--
http://www.mildmanneredindustries.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/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]


Good luck

2008-08-07 Thread Fritz Anderson


Hey just click on the below link and register ... it will take only  
not more than 2 mins of your time.. take a chance...Really true..


Hey Guys,

Check for free gift!! It’s true…

Click on this url:

http://mac.incentive-network.co.uk/?referral=21256


Regards,
Sachin Kumar T.




The information contained in this email and any attachments is  
confidential and may be subject to copyright or other intellectual  
property protection. If you are not the intended recipient, you are  
not authorized to use or disclose this information, and we request  
that you notify us by reply mail or telephone and delete the original  
message from your mail system.

___

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/fritza%40manoverboard.org

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]


-[NSBrowser scrollToVisible] not making all of the column visible

2008-08-07 Thread Martin Redington
[apologies if this is a repost - I sent it a while ago, but didn't see
it appear on the list or in the archives]

I've got an app with a NSOutlineView and NSBrowser view of the same
data (the file system).

I preserve the user's selection between when switching between views.

A lot of the time, the NSBrowser scrolls to show the entire selected
column. However, sometimes, only a portion of the selected column gets
shown, even when I call -[NSBrowser scrollColumnToVisible] explicitly.

I get the impression that NSBrowser is checking to see whether any of
the selected column is visible, and if so, not scrolling at all.

What I'd hoped would happen is that it would scroll to show all of the
column - it seems that forcing this behaviour programmatically is
difficult, as NSBrowser only allows scrolling by column indexes.

Is the behaviour I'm seeing (not all column made visible if any is
already visible) the expected behaviour?

-- 
http://www.mildmanneredindustries.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: How to debug a corrupted stack

2008-08-07 Thread Kyle Sluder
On Thu, Aug 7, 2008 at 11:28 AM, Gerriet M. Denkmann
<[EMAIL PROTECTED]> wrote:
> Maybe someone would want to check this on Leopard.

File a bug (http://bugreport.apple.com).  That's the quickest way to
make sure that 1) if it's a problem, it gets fixed or 2) if it's not a
problem someone from Apple will tell you.

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


Apology

2008-08-07 Thread Fritz Anderson
In the course of redirecting a spam email to a junkmail-training  
address, I accidentally redirected it to the scores of original  
recipients.


I apologize, and will not repeat the error.

— F

___

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 debug a corrupted stack

2008-08-07 Thread Gerriet M. Denkmann


On 6 Aug 2008, at 21:56, Shawn Erickson wrote:


On Tue, Aug 5, 2008 at 7:51 PM, Gerriet M. Denkmann
<[EMAIL PROTECTED]> wrote:

I have a document based app which works perfectly with -O0 or -O1 but
crashes with -O2 or higher.

When the crash occurs the debugger comes up and says: "Previous frame
identical to this frame (corrupt stack?)"

When I try to step through the function (which is kind of  
difficult, as the
optimization has shuffled the lines a lot) at some time the top  
frame of the

stack gets duplicated.

The faulty method starts with:
   NSString *path = @"/Users/gerriet/Desktop/some  
alias";  //  error

with -O2

If it starts with:
   NSString *path = @"/Users/gerriet/Desktop/some  
file";   //  ok

with -O2
then everything works perfectly.

When I comment out the place where the error seems to occur, it  
will just

occur at some earlier place.


You are moving things around in memory by chaning the length of your
string above and commenting out things. Additionally changing
optimizer settings shuffles things around.
I admit that the alias-thing was a red herring. Not a question of  
files, aliases or strings, but of different paths through my code.



I have a feeling you are hitting an issue cause by an uninitialized
value or something similar in your code that is being hidden in some
situations by the code emitted.



Your feeling is absolutely right. No compiler bug. I have to  
apologize to the compiler - I spoke rashly.


The problem is NSValue. Here is a small code sample:

unsigned int ss = sizeof(FSCatalogInfo);//  144 bytes
ss /= 4;//  36 words

FSCatalogInfo   catalogInfo1;   
memset( &catalogInfo1, 0xab, sizeof(FSCatalogInfo) );

FSCatalogInfo   catalogInfo2;
memset( &catalogInfo2, 0xcd, sizeof(FSCatalogInfo) );

unsigned int *p = (unsigned int *)&catalogInfo1;
for(unsigned int i = 0; i < 2 * ss; i +=12)
{
		for(unsigned int j = i; j < i + 12; j++) fprintf(stderr,"%#010x ", p 
[j]);

fprintf(stderr,"\n");
};
fprintf(stderr,"\n");

	NSValue *data = [ NSValue value: &catalogInfo1 withObjCType: @encode 
(FSCatalogInfo) ];	//	reads 36 + 5 words -- very naughty

const char *objCType = [ data objCType ];   //  correct 
fprintf(stderr,"objCType = %s\n", objCType);

memset( &catalogInfo2, 0, sizeof(FSCatalogInfo) );

	[ data getValue: &catalogInfo1 ];	//	writes 36 + 5 words and  
destroys parts of catalogInfo2


for(unsigned int i = 0; i < 2 * ss; i +=12)
{
		for(unsigned int j = i; j < i + 12; j++) fprintf(stderr,"%#010x ", p 
[j]);

fprintf(stderr,"\n");
};

When I run this, I see that NSValue reads (and writes) not 36 words  
(as it should, as instructed by @encode ) but 36 + 5 words.
And subsequently overwrites 5 words, which in my case were 2  
unimportant words + 3 stored registers (r20.. r22) which then upon  
return lead to a crash.


How can it be that such a fundamental thing like NSValue does not  
work correctly? At least not on Tiger 10.4.11.


Maybe someone would want to check this on Leopard.


Also are you sure you are getting any runtime exceptions logged?
I believe that all non-caught exceptions are logged in the Xcode Run  
Log. And there were none.



Kind regards,

Gerriet.

___

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 debug a corrupted stack

2008-08-07 Thread Gerriet M. Denkmann


On 7 Aug 2008, at 01:16, Sean McBride wrote:


On 8/6/08 9:51 AM, Gerriet M. Denkmann said:


So it is kind of difficult to see where and why the stack gets
corrupted.


Have you tried 'stack canaries'?



I have not. Seems this is a Xcode 3.0 thing. I have Xcode 2.4.



On 8/6/08 7:59 PM, Gerriet M. Denkmann said:


If someone wants to check whether it really is a compiler bug (and
not just some stupidity on my side) I can send the whole project.
10.4.11 - not tested on 10.5


Xcode 3.1 comes with 3 compilers: gcc 4.0, gcc 4.2, llvm-gcc 4.2...  
you

could try all 3 if you suspect a compiler bug.


I am under the impression that Xcode 3.x is Leopard only (please  
correct me if I am wrong).

And due to hardware constraints I can run only Tiger.


Kind regards,

Gerriet.

___

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: autorelease CGImageRef?

2008-08-07 Thread Chris Hanson

On Aug 6, 2008, at 7:44 PM, Peter N Lewis wrote:

This email sent to [EMAIL PROTECTED] 2:26 PM +0200 6/8/08,  
Jean-Daniel Dupas wrote:

If I'm not wrong, it should be something like this:

[NSMakeCollectable(aCGImageRef) autorelease];


This appears correct, except for the fact that, for reasons known  
only to Apple, although CFMakeCollectable is available in 10.4, the  
trivial NSMakeCollectable macro is available only in 10.5.


If you build with the Mac OS X 10.5 SDK, you should be able to use  
NSMakeCollectable since it's declared as an inline function.


The earliest release of Mac OS X you're targeting is a function of the  
Mac OS X Deployment Target build setting, not the SDK.


 -- 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: autorelease CGImageRef?

2008-08-07 Thread Sean McBride
On 8/7/08 10:44 AM, Peter N Lewis said:

>>[NSMakeCollectable(aCGImageRef) autorelease];
>
>This appears correct, except for the fact that, for reasons known
>only to Apple, although CFMakeCollectable is available in 10.4, the
>trivial NSMakeCollectable macro is available only in 10.5.

Yes, quite annoying.

>So expanding the NSMakeCollectable macro gives:
>
>return [(id)CFMakeCollectable(aCGImageRef) autorelease];

True, but that cast can cause warnings, and so having it in a system
header is nice.  If you can, use the NS version.  Consider:


#import 

int main (void)
{
CFStringRef foo = nil;

[NSMakeCollectable(foo) autorelease];
[(id)CFMakeCollectable(foo) autorelease]; //line 8

return 0;
}


$ gcc-4.2 -Wcast-qual /Users/sean/Desktop/test.m
/Users/sean/Desktop/test.m: In function 'main':
/Users/sean/Desktop/test.m:8: warning: cast discards qualifiers from
pointer target type

I suspect that's why the NS version was later added.

--

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: IKSlideshow Question

2008-08-07 Thread j o a r


On Aug 5, 2008, at 5:37 PM, Robert McCullough wrote:

The IKSlideshowDataSource protocol for IKSlideshow includes several  
optional methods, one of which is "nameOfSlideshowItemAtIndex".  
However, this method NEVER seems to be called. Anyone know why?



I think that it's simply a bug - most likely a very well known bug.
You might still want to file a bug report to indicate interest in  
getting this API fixed for some future release.


j o a r


___

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: Application's Help menu ignores first click

2008-08-07 Thread Mattias Arrelid
On Thu, Aug 7, 2008 at 11:53 AM, Mattias Arrelid <[EMAIL PROTECTED]> wrote:
> Hi list,
>
> I've got a strange problem that I cannot figure out how to solve. When
> starting up my application, and choosing Help from the application's
> menu, trying to perform _any_ of the items listed doesn't work.
> Re-opening the Help a second time, clicking on any item works as
> expected. Strange!?! I tried how a few other applications behave, and
> came to the conclusion that most applications don't have this problem.
> Two other the applications that _do_ have this problem are Real Player
> Version 11.0.0 (884) and Flickr Uploadr 3.0.5.

Sorry for the abrupt ending, Gmail's "Send" and "Save now" are way to similar...

My application does not have a nib file, and hence I create the
application's window and main menu myself. Could I be missing
something somewhere?

Best
Mattias
___

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]


Application's Help menu ignores first click

2008-08-07 Thread Mattias Arrelid
Hi list,

I've got a strange problem that I cannot figure out how to solve. When
starting up my application, and choosing Help from the application's
menu, trying to perform _any_ of the items listed doesn't work.
Re-opening the Help a second time, clicking on any item works as
expected. Strange!?! I tried how a few other applications behave, and
came to the conclusion that most applications don't have this problem.
Two other the applications that _do_ have this problem are Real Player
Version 11.0.0 (884) and Flickr Uploadr 3.0.5.
___

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]


Strange flipping bug in Core Animation?

2008-08-07 Thread Moray Taylor
Dear list,

I first posted this to the quartz list, but I'm starting to think I'm the only 
person on it, some hopefully a Cocoa list reader can help...

I think I've stumbled upon a bug/undocumented feature in Core Animation, I've 
made a quick app to demonstrate the issue.

http://s3.amazonaws.com/TempStuff/LayerDebug.zip

Once the app runs, make sure you are in 'tab1', you can resize the window, 
scroll around, all is well (apart from the disappearing blue sublayer, but lets 
ignore that for now, unless anyone knows how to fix this?)

You switch to 'tab2' and back again, fine.

BUT, if I switch to 'tab2', resize the window (even a 1 pixel tweak), then go 
back to 'tab1', the layers are now upside down!

I want to use Core Anim in a shipping app, but obviously cannot until I sort 
this out, so I'd really appreciate any input.

Cheers

Moray





  __
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at 
Yahoo! http://uk.docs.yahoo.com/ymail/new.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]


packed NSTextfield and NSFormatter in IB3 plugin...

2008-08-07 Thread Cyril Kardassevitch

hi,

I have designed customs NSTextField and NSFormatter objects that I  
have tried to pack in an interface builder 3 plugin...


This works fine (can drag and drop the field, can access field  
inspector), except that when I select the formatter, interface builder  
generates an assertion failure with :


Backtrace:
  1. Interface Builder0x6620 [IBApplication  
handleAssertion:inFile:onLine:]
  2. InterfaceBuilderKit  0x0021bed4 [IBObjectContainer  
objectIDForObject:]
  3. InterfaceBuilderKit  0x0021c0ec [IBObjectContainer  
metadataForKey:ofObject:]
  4. InterfaceBuilderKit  0x00224e84 [IBDocument  
customClassNameForObject:]
  5. InterfaceBuilderKit  0x00224e0c [IBDocument  
classNameForObject:]
  6. InterfaceBuilderKit  0x0023f210 [IBDocument  
commonCustomClassNameOfObjects:]
  7. InterfaceBuilderKit  0x0023f15c [IBInspectorController  
computeTitle]
  8. InterfaceBuilderKit  0x0023f08c [IBInspectorController  
refresh]
  9. InterfaceBuilderKit  0x0023b630 [IBInspectorController  
rebuildInspectorStack]
 10. InterfaceBuilderKit  0x0023b4c0 [IBInspectorController  
validate:]

...

The NSTextField and NSFormatter child have their own working plugins,  
and there is absolutely no problem if I combine the 2 above objects  
manually in interface builder. The field and its formatter are then  
fully accessible and designable.


I've tried various things without success. Has anyone got a tip on how  
to expose a programmatically attached formatter ?


Thanks.
Cyril.


___

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 question

2008-08-07 Thread Marco Masser

This may not be strictly related to your problem, but maybe it helps:


Transactions
Atributes: Amount:Double, Date:Date, Memo:String, Payee:String
Relationships: TransactionType


If these are the attributes of the entity you created in Xcode's  
editor and you can set the class of this entity to a custom subclass  
of NSManagedObject, then you can do something that is extremely  
helpful: you can get the compiler to give you warnings about passing  
wrong types for attributes and (to-one) relationships. Instead of  
using -setValue:ForKey:, you can then use the dot syntax for all of  
the properties and relationships.


Just create an NSManagedObject subclass that has no ivars, but a  
property for every attribute and relationship (I never did it for to- 
many relationships, but those *should* simply be properties of type  
NSSet). In the implementation, just add an @dynamic myProp; for every  
property. Then, set this custom class as the class of the Entity. Now,  
instead of


[transaction setValue:tr.transactionAmount forKey:@"Amount"]; // the  
value is of type id -> no type checking possible


you do

transaction.amount = tr.transactionAmount; // compiler knows that  
"amount" is of type NSNumber and can emit warnings


(Keep the coding guidelines in mind: attributes should begin with a  
lower letter)


Of course, the KVC stuff still works. And because you have your own  
subclass, you can easily add properties and methods to get things like  
compound values, like when you have an Person entity with the  
attributes firstName and lastName, you can implement a -fullName  
readonly property that returns [NSString stringWithFormat:@"%@ %@",  
self.firstName, self.lastName];

Very handy.


another thing I would like to understand, do relationships work like  
constraints in SQL ?
in the sense that if there is no transactionType defined in the  
TransactionTypes Entity,
I would not be able to insert a value in the transactionType field  
of the transactions entity?


You mean whether you can can set values for attributes that are not  
defined in the entity? That's not possible, you'll get an  
NSUnknownKeyException and by default, your applications crashes.
By the way, the approach with the defined properties described above  
prevents this, because the compiler would throw a warning that you  
sent a message without a matching method signature.
If you really need it, you could even do some trick and implement - 
setValue:forUndefinedKey: in your NSManagedObject subclass to prevent  
the exception from being thrown. There are classes out there (one  
written by Mike Abdullah, if I'm not mistaken) that do just that: they  
take an unknown key and store it along with its value in a  
NSMutableDictionary ivar and every time you try to set/get a value for  
an unknown key (unknown to the entity, at least), instead of throwing  
an exception and crashing, the class happily lets you store/retrieve  
the value. This way, you don't have to change the model if you want to  
add a property, which can be useful if you want to add some tiny thing  
in a future version of your application (changing the model breaks  
compatibility with old models, unless you implement a mapping model).  
I don't recommend relying on this heavily, though.



Marco
___

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]