Re: NSTableColumn setHidden: and IB

2009-04-25 Thread David Scheidt


On Apr 26, 2009, at 12:54 AM, Steven Riggs wrote:

Make a class with IBOutlets to each tableColumn and in code, tell  
the tableColumns if they should be hidden. I'm not aware of an IB  
only solution for this one.




That's a better solution than the one that had occurred to me, which  
was to subclass NSTableColumn to add an action.


Is there a deep reason that there's not an IB action for this?


Steven Riggs

On Apr 26, 2009, at 12:42 AM, David Scheidt   
wrote:


I've got a 10.5 app, which has a bunch of NSTableViews.  I'd like  
to allow the user to choose which columns appear in the tableviews,  
using a popup contextual menu.  so, that should be a simple matter  
of defining the NSTableColumns, establishing their bindings, making  
a menu of the table view's header, and hooking that up to the  
setHidden: method of the NSTableColumns; however, there doesn't  
appear to be a way to do that in IB.  Am I missing something?  (I  
hope I am.)  How do I do this? 
___


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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/steven.riggs 
%40me.com


This email sent to steven.ri...@me.com




___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSTableColumn setHidden: and IB

2009-04-25 Thread Steven Riggs
Make a class with IBOutlets to each tableColumn and in code, tell the  
tableColumns if they should be hidden. I'm not aware of an IB only  
solution for this one.


Steven Riggs

On Apr 26, 2009, at 12:42 AM, David Scheidt  wrote:

I've got a 10.5 app, which has a bunch of NSTableViews.  I'd like to  
allow the user to choose which columns appear in the tableviews,  
using a popup contextual menu.  so, that should be a simple matter  
of defining the NSTableColumns, establishing their bindings, making  
a menu of the table view's header, and hooking that up to the  
setHidden: method of the NSTableColumns; however, there doesn't  
appear to be a way to do that in IB.  Am I missing something?  (I  
hope I am.)  How do I do this? 
___


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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/steven.riggs%40me.com

This email sent to steven.ri...@me.com

___

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

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

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

This email sent to arch...@mail-archive.com


NSTableColumn setHidden: and IB

2009-04-25 Thread David Scheidt
I've got a 10.5 app, which has a bunch of NSTableViews.  I'd like to  
allow the user to choose which columns appear in the tableviews, using  
a popup contextual menu.  so, that should be a simple matter of  
defining the NSTableColumns, establishing their bindings, making a  
menu of the table view's header, and hooking that up to the setHidden:  
method of the NSTableColumns; however, there doesn't appear to be a  
way to do that in IB.  Am I missing something?  (I hope I am.)  How do  
I do this? 
 
___


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

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

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

This email sent to arch...@mail-archive.com


Re: parsing a string into words

2009-04-25 Thread Jeffrey Oleander

NSArray * tokens = [string componentsSeparatedByCharactersInSet: 
whitespaceCharacterSet];


  
___

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

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

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

This email sent to arch...@mail-archive.com


Editable PopUpButtons

2009-04-25 Thread Arun
Hi

Is the any control which is similar to NSPopUpButtonCell but still editable?

Thanks
Arun KA
___

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

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

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

This email sent to arch...@mail-archive.com


Multiple cell in a table column

2009-04-25 Thread Arun
Hi All,

Is it possible to have multiple Cells in a single table column?
I need to have NSTextFiledCell and NSPopUpButtonCell in a single table
column.

Thanks
Arun KA
___

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

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

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

This email sent to arch...@mail-archive.com


Re: parsing a string into words

2009-04-25 Thread Ken Thomases

On Apr 25, 2009, at 10:06 PM, Gerriet M. Denkmann wrote:

One question though: why are "version4", "ปี2009" or "ทีมA"  
all parsed as one word?
I would think that the change from letters to numbers, or from Thai  
to Latin would indicate a word-break.


I haven't read it, myself, but the docs for CFStringTokenizer have a  
link all the way at the bottom to this page:


http://www.unicode.org/reports/tr29/#Word_Boundaries

That's presumably the governing document for how it does its work.

I also suspect that CFStringTokenizer, like some other parts of  
CoreFoundation, are using ICU  under the  
hood.  So, any documentation of the ICU implementation  would probably be relevant to CFStringTokenizer.


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


Re: parsing a string into words

2009-04-25 Thread Gerriet M. Denkmann


On 26 Apr 2009, at 02:09, Aki Inoue wrote:

In AppKit land, -[NSAttributedString doubleClickAtIndex:] would help  
you.


Thanks a lot!

I tested all three methods and found that:

1. NSTextView takes about 900 μsec to parse a Thai sentence into 17  
words.

2. NSAttributedString took only 530 μsec for the same result.
3a. CFStringTokenizer took 60 μsec for a similar result (option = Word  
Break).

3b. Using option = Word takes 225 μsec for a slightly better result.

One question though: why are "version4", "ปี2009" or "ทีมA"  
all parsed as one word?
I would think that the change from letters to numbers, or from Thai to  
Latin would indicate a word-break.


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


Re: NSButtonCell binds only readonly; Non-bool bindings OK.

2009-04-25 Thread Kyle Sluder
Thanks, Jean-Daniel!

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


Re: Clicking through a NSView with CALayers

2009-04-25 Thread Rowan Nairn
On Sat, 25 Apr 2009 at 17:26 AM, Bill Cheeseman  wrote:
> I have an identical setup on an application I'm currently working on,
> and clickthrough works just fine for me.

Really?  I hope we're talking about the same thing here.  I just
created a new blank Cocoa Application, and changed the window to a
custom class with this initialization code:

@implementation MyWindow

- (void)awakeFromNib {
[self setOpaque:NO];
[self setBackgroundColor:[NSColor clearColor]];

[[self contentView] setLayer:[CALayer layer]];
[[self contentView] setWantsLayer:YES];

CALayer* layer = [CALayer layer];
layer.frame = CGRectMake(10, 10, 100, 100);
layer.borderWidth = 3;

[[[self contentView] layer] addSublayer:layer];
}

@end


The transparent areas of the window intercept clicks.  Do you see
different behavior?  How would you change the above code to make the
transparent areas also transparent to clicks?

> My window is borderless and transparent, its entire area is covered by
> an empty contentview and also by a CALayer with various sublayers.
> When I turn clickthrough on and off, the application behaves as
> expected. My contentview is set up as a layer-hosted view, not a layer-
> backed view, in case that makes a difference.

What do you mean by "turn clickthrough on and off"?  Just to
reiterate, I'm talking about clicking through to *other* application
windows beneath my window.  I'm not talking about [view
acceptsFirstMouse:YES] type of click-through.

Thanks for the help,
Rowan
___

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

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

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

This email sent to arch...@mail-archive.com


Re: which technologie for layered sketch/vector-modelling ?

2009-04-25 Thread Peter Zegelin

Have you looked @DrawKit?

http://apptree.net/drawkit.htm

regards,

Peter


On 25/04/2009, at 4:48 AM, Stefan wrote:


Hi,

i need some kind of modelling / sketch "graffling" (like  
omnigraffle, but simple)

and i'm not sure which technologie seems to be the best.
what i want to build is a tool to sketch something trivial  
(textboxes, rectangles, etc)
but with different layers and: the objects have to be editable (e.g.  
resizing, moving, ...)


I've played something with Quartz, OpenGL and CoreAnimation and have  
no idea

which way might be the right direction.
it have to be performant and X10.5 can be the required system. (no  
backward comp.)


There are a lot of Sample apps around (like CIAnnotations,  
Sketch-112, Son of a grab, Dicey, and more),

they use different approaches and different technologies.

Maybe somebody give me a hint which technologie or approach could be  
the right one?


Thanks,
Stefan
___

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/peter%40fracturedsoftware.com

This email sent to pe...@fracturedsoftware.com


___

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

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

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

This email sent to arch...@mail-archive.com


which technologie for layered sketch/vector-modelling ?

2009-04-25 Thread Stefan

Hi,

i need some kind of modelling / sketch "graffling" (like omnigraffle,  
but simple)

and i'm not sure which technologie seems to be the best.
what i want to build is a tool to sketch something trivial (textboxes,  
rectangles, etc)
but with different layers and: the objects have to be editable (e.g.  
resizing, moving, ...)


I've played something with Quartz, OpenGL and CoreAnimation and have  
no idea

which way might be the right direction.
it have to be performant and X10.5 can be the required system. (no  
backward comp.)


There are a lot of Sample apps around (like CIAnnotations, Sketch-112,  
Son of a grab, Dicey, and more),

they use different approaches and different technologies.

Maybe somebody give me a hint which technologie or approach could be  
the right one?


Thanks,
Stefan
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Ken Thomases

On Apr 25, 2009, at 8:03 PM, Erg Consultant wrote:


On Apr 25, 2009, at 7:48 PM, Stephen J. Butler wrote:


On Sat, Apr 25, 2009 at 7:28 PM, Erg Consultant
 wrote:
I was using CFURLGetFSRef passing in the NSString which works fine  
as long as the path contains no special chars. If it does,  
CFURLGetFSRef returns nil.


CFURLGetFSRef is great if what you have originally is a CF/NSURL. But
if you just have an NSString, you might as well use FSPathMakeRef  
with

[aString fileSystemRepresentation]. No reason to create an
intermediary NSURL.


When I do that, the conversion from NSString to const UInt8 * path  
mangles the special characters in the path.


What do you mean mangles?  I suspect you're misinterpreting "encodes"  
as mangles.  Asking a file path string for its - 
fileSystemRepresentation is asking it to encode the string into the  
form expected by various APIs which take file paths in C strings (of 8- 
bit characters).  Of course this won't look like the original Unicode  
string contents; Unicode can't fit into 8-bit characters without being  
encoded somehow.


But the question is, why do you care?  Did FSPathMakeRef work, when  
passed such a string?  It should, which is all you're interested in.


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


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Michael Ash
On Sat, Apr 25, 2009 at 8:28 PM, Erg Consultant
 wrote:
> I was using CFURLGetFSRef passing in the NSString which works fine as long as 
> the path contains no special chars. If it does, CFURLGetFSRef returns nil.

That's unlikely. CFURLGetFSRef needs a CFURLRef or NSURL, not an NSString.

If you want help with your code, *post your code*. It is pointless to
try to describe in English what your code does. You already have a
perfectly good textual description of what your code does, written in
a language that everybody on this mailing list can read: your code
itself.

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


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Ken Thomases

On Apr 25, 2009, at 7:28 PM, Erg Consultant wrote:

I was using CFURLGetFSRef passing in the NSString which works fine  
as long as the path contains no special chars. If it does,  
CFURLGetFSRef returns nil.


File path strings aren't URLs.  Even a string which looks a bit URL- 
ish (for example, if you just tack "file://" on the front of a path)  
isn't a URL.  It's not a valid URL string; it is especially not a  
CFURL or NSURL object!


If you've got a path string and you want to make a URL referencing the  
same file, you have to do it the right way.  As mentioned,  
+fileURLWithPath: is one good way.  CFURLCreateWithFileSystemPath also  
works.


Wrong ways include +URLWithString: (and the other ...WithString...  
methods of NSURL) and CFURLCreateWithString.  Those are only  
appropriate if your have a proper URL string (with characters that  
aren't legal in a URL escaped).  Passing an NSString to a function  
which expects a CFURLRef is asking for trouble.  Having it work or  
return nil is luck; it was just as like to crash your program.


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


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Steve Christensen
You'd said in an earlier thread that the file path characters are coming from a 
text file and that you're then storing those in a STL string. The STL string 
doesn't care what the encoding is since it's just a storage construct. When you 
try to create a CFString or NSString from those characters, you need to know 
what the character encoding is, particularly for the case where a path contains 
special (non-ASCII) characters, otherwise the CFStringCreate*() or [NSString 
stringWith*:] calls will fail. If those fail then you won't be able to 
successfully create a CFURL/NSURL, so CFURLGetFSRef will naturally fail.

Since you haven't been able (so far) to determine what the character encoding 
is, have you thought about reading in the characters from the file, displaying 
each character in hex, and finding the value(s) that represent one of the 
non-ASCII characters? With those values in hand you should be able to do some 
online research to determine what the character encoding actually is. Once you 
get past that part, everything else should just work.

 
On Saturday, April 25, 2009, at 05:28PM, "Erg Consultant" 
 wrote:
>I was using CFURLGetFSRef passing in the NSString which works fine as long as 
>the path contains no special chars. If it does, CFURLGetFSRef returns nil.
>
>Erg
>
>
>From: Nick Zitzmann 
>To: Erg Consultant 
>Cc: cocoa-dev@lists.apple.com
>Sent: Saturday, April 25, 2009 4:41:20 PM
>Subject: Re: Why is NSString->FSRef so hard?
>
>
>On Apr 25, 2009, at 5:33 PM, Erg Consultant wrote:
>
>> Isn't there some easy way to get an FSRef from an NSString that is a path 
>> containing special characters?
>
>
>What, specifically, have you tried? I don't think I've ever had 
>+fileURLWithPath: fail on me with a path string, even if the string contained 
>non-ASCII characters.

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Erg Consultant
When I do that, the conversion from NSString to const UInt8 * path mangles the 
special characters in the path.





From: Stephen J. Butler 
To: Cocoa-Dev List 
Sent: Saturday, April 25, 2009 5:48:09 PM
Subject: Re: Why is NSString->FSRef so hard?

On Sat, Apr 25, 2009 at 7:28 PM, Erg Consultant
 wrote:
> I was using CFURLGetFSRef passing in the NSString which works fine as long as 
> the path contains no special chars. If it does, CFURLGetFSRef returns nil.

CFURLGetFSRef is great if what you have originally is a CF/NSURL. But
if you just have an NSString, you might as well use FSPathMakeRef with
[aString fileSystemRepresentation]. No reason to create an
intermediary NSURL.
___

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

This email sent to erg_consult...@yahoo.com



  
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Stephen J. Butler
On Sat, Apr 25, 2009 at 7:28 PM, Erg Consultant
 wrote:
> I was using CFURLGetFSRef passing in the NSString which works fine as long as 
> the path contains no special chars. If it does, CFURLGetFSRef returns nil.

CFURLGetFSRef is great if what you have originally is a CF/NSURL. But
if you just have an NSString, you might as well use FSPathMakeRef with
[aString fileSystemRepresentation]. No reason to create an
intermediary NSURL.
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Erg Consultant
I was using CFURLGetFSRef passing in the NSString which works fine as long as 
the path contains no special chars. If it does, CFURLGetFSRef returns nil.

Erg





From: Nick Zitzmann 
To: Erg Consultant 
Cc: cocoa-dev@lists.apple.com
Sent: Saturday, April 25, 2009 4:41:20 PM
Subject: Re: Why is NSString->FSRef so hard?


On Apr 25, 2009, at 5:33 PM, Erg Consultant wrote:

> Isn't there some easy way to get an FSRef from an NSString that is a path 
> containing special characters?


What, specifically, have you tried? I don't think I've ever had 
+fileURLWithPath: fail on me with a path string, even if the string contained 
non-ASCII characters.

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


Re: Auxiliary background executable without dock icon but with some UI

2009-04-25 Thread Ken Thomases

On Apr 25, 2009, at 3:52 AM, Oleg Krupnov wrote:


The problem #1 is that although the desired UI window appears, it does
not accept mouse and keyboard input. I guess I haven't properly set up
the run loop, or window server, but I don't know how to do this for
such an auxiliary executable. Any hints would be welcome!


This is typical of a GUI program which isn't bundled into an  
application bundle.


If you write a Cocoa program in such a way that it doesn't require any  
resources (e.g. it builds its GUI programatically and doesn't use  
nibs) and extract the executable from the application bundle and run  
it, you might expect it to work the same as when it's in the bundle,  
but it doesn't.  You could overcome this using TransformProcessType(),  
but the better solution is to just make your aux task a bundled  
LSUIElement application.  That is, your main application bundle will  
contain another application bundle among its contents.  That second  
application bundle will have LSUIElement="1" in its Info.plist.


That said, I'm leery of having a root auxiliary task presenting a  
GUI.  A central principal of security is to minimize the attack  
surface of privileged tasks.  Linking in the GUI frameworks massively  
increases the attack surface.  Can't your third party provide two  
plugins, one for the aux task and another to present the related GUI  
in the main task?


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


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Stephen J. Butler
On Sat, Apr 25, 2009 at 6:33 PM, Erg Consultant
 wrote:
> I am trying to convert an NSString containing a path to a file directly to an 
> FSRef. If there are no special characters in the path, it's easy - I can go 
> from NSString to CFURL to FSRef.
>
> But if the path contains any special characters at all, both CFURL and NSURL 
> creation routines fail. No matter what I do, or which routines I use, it 
> won't work.
>
> Unfortunately I am stuck with some 3rd party apps that have special 
> characters like (tm) in their bundle names and I can't change them.
>
> Isn't there some easy way to get an FSRef from an NSString that is a path 
> containing special characters?

Works for me. My suspicion is that you aren't properly creating your
NSString in the first place.

#import 

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

if (argc != 2) {
NSLog( @"usage: " );
[pool drain];
return 1;
}

NSString *filePath = [NSString stringWithCString:argv[ 1 ]
encoding:NSUTF8StringEncoding];
NSLog( @"filePath = %@", filePath );

NSURL *fileURL = [NSURL fileURLWithPath:filePath];
NSLog( @"fileURL = %@", [fileURL absoluteURL] );

FSRef fileFSRef;
if (CFURLGetFSRef( (CFURLRef)fileURL, &fileFSRef )) {
NSLog( @"Created FSRef!" );
} else {
NSLog( @"Failed to create FSRef." );
}

[pool drain];
return 0;
}
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Michael Ash
On Sat, Apr 25, 2009 at 7:33 PM, Erg Consultant
 wrote:
> I am trying to convert an NSString containing a path to a file directly to an 
> FSRef. If there are no special characters in the path, it's easy - I can go 
> from NSString to CFURL to FSRef.
>
> But if the path contains any special characters at all, both CFURL and NSURL 
> creation routines fail. No matter what I do, or which routines I use, it 
> won't work.
>
> Unfortunately I am stuck with some 3rd party apps that have special 
> characters like (tm) in their bundle names and I can't change them.
>
> Isn't there some easy way to get an FSRef from an NSString that is a path 
> containing special characters?

Yes, using the technique you described.

If it's not working for you, then it's because you're doing something
wrong. However, since you have not posted your code, it is impossible
to say just what it is that you're doing wrong.

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


Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Nick Zitzmann


On Apr 25, 2009, at 5:33 PM, Erg Consultant wrote:

Isn't there some easy way to get an FSRef from an NSString that is a  
path containing special characters?



What, specifically, have you tried? I don't think I've ever had  
+fileURLWithPath: fail on me with a path string, even if the string  
contained non-ASCII characters.


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


Re: undoMenuTitleForUndoActionName

2009-04-25 Thread Nor
Keary,
Thank you very much.
As you said, I didn't want my app to show the expression on those menu
items: Undo and Redo by using -setActionName:.

I could make it with your kind message.
Let me thank you again.

Norio

2009/4/26 Keary Suska 

> On Apr 25, 2009, at 10:49 AM, norio ota wrote:
>
>  I need to localize the undo menu title.
>> I made the subclass of NSUndoManager and overrode two methods:
>> undoMenuTitleForUndoActionName and redoMenuTitleForUndoActionName.
>>
>> Bun they don't get called.
>>
>> Would you tell me who calls the functions and , if possible,
>> how I should do to localize the titles instead of general ones?
>>
>
> The issue, in your particular case, is probably more of an issue of how to
> get various parts of Cocoa to use your NSUndoManager subclass. Is there a
> reason that -setActionName: won't work? I imagine it could be rather awkward
> grammar in some languages, but it would be a lot easier.
>
> Otherwise, IIRC, all controls will use the Window's undo manager, so if you
> have the window delegate implement -windowWillReturnUndoManager:, you can
> force the use of your subclass.
>
> Best,
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
>
___

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

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

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

This email sent to arch...@mail-archive.com


Why is NSString->FSRef so hard?

2009-04-25 Thread Erg Consultant
I am trying to convert an NSString containing a path to a file directly to an 
FSRef. If there are no special characters in the path, it's easy - I can go 
from NSString to CFURL to FSRef.

But if the path contains any special characters at all, both CFURL and NSURL 
creation routines fail. No matter what I do, or which routines I use, it won't 
work.

Unfortunately I am stuck with some 3rd party apps that have special characters 
like (tm) in their bundle names and I can't change them.

Isn't there some easy way to get an FSRef from an NSString that is a path 
containing special characters?

Thanks,

Erg



  
___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSButtonCell binds only readonly; Non-bool bindings OK.

2009-04-25 Thread Jean-Daniel Dupas


Le 26 avr. 09 à 00:00, Jerry Krinock a écrit :



On 2009 Apr 25, at 14:29, Kyle Sluder wrote:

There's been some discussion on this list in the recent past  
regarding
whether it was more useful to file bugs in radar  
(bugreport.apple.com)

or use the documentation feedback thingy.




it gave me some hard time, but I found it:

http://lists.apple.com/archives/Cocoa-dev/2008/Nov/msg01486.html

Yes, I'd imagine that a bug report is better.  But since I don't see  
any cash coming into my register for spiffing up Apple's bug  
reports, I look at it as only 3 minutes vs. 10 minutes of lost  
time.  I usually put my name and email at the bottom and hope for  
the best.



___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSButtonCell binds only readonly; Non-bool bindings OK.

2009-04-25 Thread Jerry Krinock


On 2009 Apr 25, at 14:29, Kyle Sluder wrote:


There's been some discussion on this list in the recent past regarding
whether it was more useful to file bugs in radar (bugreport.apple.com)
or use the documentation feedback thingy.


Yes, I'd imagine that a bug report is better.  But since I don't see  
any cash coming into my register for spiffing up Apple's bug reports,  
I look at it as only 3 minutes vs. 10 minutes of lost time.  I usually  
put my name and email at the bottom and hope for the best.


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Best technology to use for overlays?

2009-04-25 Thread Daniel Vollmer


On Apr 24, 2009, at 14:34 , Mike Abdullah wrote:

Just position your overlay view as a sibling to the scrollview. If  
you're using NSCollectionView, you're targeting Leopard+, where  
overlapping views are properly supported.


True, but I just remembered I don't see how I can support  
NSCollectionView's animation (e.g. when removing or adding a new  
item / row), but that's probably true for any overlay solution. Bah!

Back to the drawing board...

Daniel.
___

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

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

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

This email sent to arch...@mail-archive.com


Reporting bugs, doc enhancements, API suggestions (was: NSButtonCell binds only readonly; Non-bool bindings OK.)

2009-04-25 Thread WT

On Apr 25, 2009, at 11:29 PM, Kyle Sluder wrote:


There's been some discussion on this list in the recent past regarding
whether it was more useful to file bugs in radar (bugreport.apple.com)
or use the documentation feedback thingy.  I can't seem to find the
actual discussion now, but remember that you have two options for
submitting your feedback.

Perhaps Scott can come by and clarify again?


May I suggest that the folks in charge add an entry in

http://lists.apple.com/mailman/listinfo/cocoa-dev

specifically dealing with the most effective ways to report bugs,  
documentation enhancements, and API suggestions/enhancements? If for  
no other reason, it's a centralized location for this kind of  
information.


Wagner
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Auxiliary background executable without dock icon but with some UI

2009-04-25 Thread Jerry Krinock


On 2009 Apr 25, at 01:52, Oleg Krupnov wrote:


In my app's bundle I have two executables - the main one and an
auxiliary one, launched by the main executable



Now I want to use the aux executable additionally to show some UI
window.



I added the corresponding function to the vended object interface, but
the result is not satisfactory.


I've read a little about Distributed Objects but don't understand what  
you mean by that.



The problem #1 is that although the desired UI window appears, it does
not accept mouse and keyboard input. I guess I haven't properly set up
the run loop, or window server, but I don't know how to do this for
such an auxiliary executable. Any hints would be welcome!


Well, since your run loop is running, I don't believe that is the  
problem.  As far as the window server, I've never had to set one up.   
The system takes care of this and if there is such an API, it probably  
wouldn't be much fun to use.


To show a window from a background process you should use  
CFUserNotificationDisplayAlert().  (No, there is no Cocoa  
equivalent.)  The UI widgets available in this function are quite  
limited.  But I believe that if you require more, since you know how  
to use Distributed Objects, you could message your main app to show  
the window and then retrieve the user's reply.



The problem #2 is that another application icon (the same as the main
app's) appears in the dock, and begins jumping.


This may be due to a bug in Launch Services.  Read this thread:

http://www.cocoabuilder.com/archive/message/cocoa/2009/3/26/233141

I worked around the bug I found by using Jim Correia's suggestion,  
putting my auxiliary executable in Contents/Helpers instead of  
Contents/MacOS.


How do I provide another Info.plist file for the auxiliary  
executable in the same bundle?


I may be wrong, but I don't believe you can do that.

Below, I've pasted in a little category which makes using Contents/ 
Helpers for auxiliary executables a little more handy.


-

#import 


/*!
 @briefProvides support for finding helper tools in
 a bundle's Contents/Helpers/

 @details  You can add a Copy Files Build Phase in Xcode for putting  
things
 in Contents/Helpers by setting the Destination popup to 'Wrapper'  
and then

 below that giving path "Contents/Helpers".

 The reason why you'd want to put helper tools in
 Contents/Helpers is explained in

 http://www.cocoabuilder.com/archive/message/cocoa/2009/3/26/233141

*/
@interface NSBundle (HelperPaths)

/*
 @briefReturns a path for a given tool name in the receiving bundle
 in directory Contents/Helpers/
*/
- (NSString*)pathForHelper:(NSString*)helperName ;

@end

--

#import "NSBundle+HelperPaths.h"


@implementation NSBundle (HelperPaths)

- (NSString*)pathForHelper:(NSString*)helperName {
NSString* bundlePath = [self bundlePath] ;
NSString* path = [[bundlePath  
stringByAppendingPathComponent:@"Contents"]  
stringByAppendingPathComponent:@"Helpers"] ;


return path ;
}

@end
___

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

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

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

This email sent to arch...@mail-archive.com


Re: NSButtonCell binds only readonly; Non-bool bindings OK.

2009-04-25 Thread Kyle Sluder
On Sat, Apr 25, 2009 at 5:15 PM, Jerry Krinock  wrote:
> I have now.  Thanks, Kyle! -- It took me less than 15 minutes to add that 10
> lines of code and trash a whole file of crap I had written.  I'm a fan of
> -unbind: now.

To me this just seems like the more logical approach.  Glad to hear it
worked out.

> I've also submitted one of those "It wasn't helpful" thingeys on the
> outdated documentation.

There's been some discussion on this list in the recent past regarding
whether it was more useful to file bugs in radar (bugreport.apple.com)
or use the documentation feedback thingy.  I can't seem to find the
actual discussion now, but remember that you have two options for
submitting your feedback.

Perhaps Scott can come by and clarify again?

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


Re: Clicking through a NSView with CALayers

2009-04-25 Thread Bill Cheeseman

On Apr 25, 2009, at 1:15 PM, Rowan Nairn wrote:


Here's how to reproduce my problem.  Create a fullscreen transparent
window with an empty view and position it over some other app.  You'll
see that when you click on the transparent area the view ignores the
click and lets the app behind be activated.  This is the behavior I
want.  Now change it to call:

[view setWantsLayer:YES]

Now if you click on the transparent region, you get click events in
the view and the background app never gets activated.


I have an identical setup on an application I'm currently working on,  
and clickthrough works just fine for me.


My window is borderless and transparent, its entire area is covered by  
an empty contentview and also by a CALayer with various sublayers.  
When I turn clickthrough on and off, the application behaves as  
expected. My contentview is set up as a layer-hosted view, not a layer- 
backed view, in case that makes a difference.


--

Bill Cheeseman - b...@cheeseman.name
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 arch...@mail-archive.com


Re: NSButtonCell binds only readonly; Non-bool bindings OK.

2009-04-25 Thread Jerry Krinock


On 2009 Apr 23, at 11:27, Kyle Sluder wrote:


Have you instead tried just dynamically unbinding and
rebinding the columns in response to your user input?


I have now.  Thanks, Kyle! -- It took me less than 15 minutes to add  
that 10 lines of code and trash a whole file of crap I had written.   
I'm a fan of -unbind: now.


Then, with less code to read, I was able to find the ^real^ problem.   
Documentation of -[NSTableColumn dataCellForRow:], states that  
"NSTableView always calls this method", implying that -dataCell is not  
invoked directly. [1]  So I'd never bothered to implement -dataCell or  
care about what data cell I had set for a table column in Interface  
Builder, because it was supposed to be ignored.  But in fact, when the  
'value' binding on a table column is bound, Cocoa invokes -dataCell  
directly, quite regularly, bypassing -dataCellForRow:.


Of course, this documentation was written long before Cocoa Bindings  
was introduced with Panther, and one can easily imagine how this  
disparate effect would have gone unnoticed when documentation was  
updated for Panther.


My app works now that I replaced the old-style -dataCellForRow:  
implementation [2] with a revised implementation [3].


I've also submitted one of those "It wasn't helpful" thingeys on the  
outdated documentation.


Jerry


[1]  From the Documentation:

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTableColumn_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSTableColumn/dataCellForRow:


- (id)dataCellForRow:(NSInteger)row

"NSTableView always calls this method. By default, this method just  
calls dataCell.  Subclassers can override if they need to potentially  
use different cells for different rows.  Subclasses should expect this  
method to be invoked with row equal to –1 in cases where no actual row  
is involved but the table view needs to get some generic cell info."



[2]  Old-Style -dataCellForRow: implementation

- (id)dataCellForRow:(int)iRow {
   if (iRow < 0)  {
// OS wants generic cell information
return ([self dataCell]) ;
}

// Assign appropriate cell
NSCell* cell = . ;

// Further modify cell if desired based on -itemAtRow:


// return cell ;
}   


[3]  Updated Implementations, compatible with Cocoa Bindings:

- (id)dataCell {
// Note: NSNotFound is a very large positive number.
return [self dataCellForRow:NSNotFound] ;
}

- (id)dataCellForRow:(int)iRow {
if (iRow < 0)  {
// OS wants generic cell information
return ([self dataCell]) ;
}

// Assign appropriate cell
NSCell* cell = . ;

if (iRow < NSNotFound) {
// Further modify cell if desired based on -itemAtRow:
...
}

return cell ;
}

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Trying to get flagsChanged: to work

2009-04-25 Thread Sean McBride
Dave DeLong (davedel...@me.com) on 2009-04-25 1:46 PM said:

>Interesting.  Coming from the world of iPhone dev, this seems wrong to
>me.  On the iPhone, a view's controller is in the chain by default.

NSViewController was added in 10.5.  Perhaps automatically adding it to
the chain would have caused backwards compatibility problems.  No such
problems on iPhone.  (Yet. :))

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


Re: problems with live resize of NSTextView

2009-04-25 Thread Stuart Malin


On Apr 25, 2009, at 9:17 AM, Keary Suska wrote:


On Apr 25, 2009, at 12:05 PM, Stuart Malin wrote:


On Apr 25, 2009, at 5:08 AM, Keary Suska wrote:


On Apr 24, 2009, at 3:06 PM, Stuart Malin wrote:

I have an NSTextView in a custom view, it is set to resize with  
the containing view only in the horizontal dimension. When I  
resize the window, the text view does resize, and it does re- 
layout its content to fit, both on expanding and shrinking.  
However, the text view not only changes its frame size height,  
but repositions itself (changing the y value of its frame's  
origin). Why does it do this?


You need to read the "Cocoa Drawing Guide" and "View Programming  
Guide for Cocoa". The answer is explicit: the 0,0 coordinate of  
the Cocoa drawing system is the bottom left.


Ah, I wasn't clear, because of course the origin would move down as  
the text expands downward. What I am seeing though is that the  
origin moves down more than the increase in height, so the text  
view isn't just expanding, but expanding and moving downward (that  
is, even its top moves down).


Is the NSTextView anchored to both the top and bottom edges? If not,  
you may get this behavior.


It had been fixed only to the top. I tried changing to fix to both,  
and the behavior remains the same. But this isn't an issue, because in  
my situation, the parent view needs to be resized to accommodate the  
text view's present size (see comments below).


More important to me: where is the best place for me to detect  
this change because I want to change the parent view's height to  
accommodate any increase in height in the text view.


One possible approach is to observe  
NSViewFrameDidChangeNotification coming from the view. See the  
NSView documentation for how to use it.


Thanks for reminding me of this. I need to see whether the  
notification occurs before a redraw cycle. If so, I can propagate  
relevant resizes up the chain of parent views.


It would probably be better to put the textview in a scrollview (or  
make the textview's parent an NSScrollView subclass). You wouldn't,  
for instance, want the window to grow larger than the screen size.


The text view's parent is a custom view. There are an ensemble of  
these custom views in a parent document view (of a scroll view).


What I am now doing (not yet complete, but I think this path will  
work): I've subclassed the text view and have it detect live resizing  
changes to its height. When that happens, it posts a notification. The  
enclosing view is an observer for those notifications. When the text  
view does change size, the parent enclosing view resizes, repositions  
the text view appropriately, and posts its own "didResize"  
notification so the process can proceed up the hierarchy. I've already  
got the text view detecting its live resize height change and posting  
the notification. So far, it seems that this is happening before the  
draw recycle, which is great, but I need to get a bit further to see  
if this is in fact the case.


Thanks for your interest in this, Keary. I appreciate the comments  
you've made.


___

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

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

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

This email sent to arch...@mail-archive.com


Re: problems with live resize of NSTextView

2009-04-25 Thread Keary Suska

On Apr 25, 2009, at 12:05 PM, Stuart Malin wrote:


On Apr 25, 2009, at 5:08 AM, Keary Suska wrote:


On Apr 24, 2009, at 3:06 PM, Stuart Malin wrote:

I have an NSTextView in a custom view, it is set to resize with  
the containing view only in the horizontal dimension. When I  
resize the window, the text view does resize, and it does re- 
layout its content to fit, both on expanding and shrinking.  
However, the text view not only changes its frame size height, but  
repositions itself (changing the y value of its frame's origin).  
Why does it do this?


You need to read the "Cocoa Drawing Guide" and "View Programming  
Guide for Cocoa". The answer is explicit: the 0,0 coordinate of the  
Cocoa drawing system is the bottom left.


Ah, I wasn't clear, because of course the origin would move down as  
the text expands downward. What I am seeing though is that the  
origin moves down more than the increase in height, so the text view  
isn't just expanding, but expanding and moving downward (that is,  
even its top moves down).


Is the NSTextView anchored to both the top and bottom edges? If not,  
you may get this behavior.


More important to me: where is the best place for me to detect  
this change because I want to change the parent view's height to  
accommodate any increase in height in the text view.


One possible approach is to observe  
NSViewFrameDidChangeNotification coming from the view. See the  
NSView documentation for how to use it.


Thanks for reminding me of this. I need to see whether the  
notification occurs before a redraw cycle. If so, I can propagate  
relevant resizes up the chain of parent views.


It would probably be better to put the textview in a scrollview (or  
make the textview's parent an NSScrollView subclass). You wouldn't,  
for instance, want the window to grow larger than the screen size.


Best,

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

___

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

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

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

This email sent to arch...@mail-archive.com


Re: parsing a string into words

2009-04-25 Thread Aki Inoue
In AppKit land, -[NSAttributedString doubleClickAtIndex:] would help  
you.


Aki from iPhone


On 2009/04/25, at 2:15, "Gerriet M. Denkmann"   
wrote:




On 25 Apr 2009, at 09:21, Michael Ash  wrote:


On Fri, Apr 24, 2009 at 9:24 PM, Gerriet M. Denkmann
 wrote:


I want to parse a string into words.
Currently I do:

NSString *theString = 
NSUInteger stringLength = [ theString length ];
NATextView *theTextView = [[NSTextView alloc] initWithFrame:
NSMakeRect(0,0,99,99) ];
[ theTextView setString: theString ];

for( NSUInteger t = 0; t < stringLength;)
{
       NSRange proposedSelRange = NSMakeRange(t,0);
       NSRange wordRange = [ theTextView
selectionRangeForProposedRange: proposedSelRange

   granularity:                          
           NSSelectByWord
                                   
             ];
       NSString *word = [ theString substringWithRange: word 
Range ];

       t = NSMaxRange( wordRange );

       //      do something with 
};

[ theTextView release ];

but this looks rather wasteful. Is there a more elegant way?

Please note that there are lots of languages, where words are not  
separated

by space or punctuation.


If you can require 10.5, use CFStringTokenizer. It is really great,
and is a lot simpler and less evil than this.



Thanks a lot. This was exactly what I was looking for.
But without knowing the term "CFStringTokenizer", it is really hard  
to find.


But this is a general problem:
Cocoa is just the tip of the iceberg, on top of lots of additional C- 
APIs which are needed to solve the not so common problems.


Would it not be a good idea, if e.g. the documentation for NSString  
would mention the C-APIs which can be used for functionality which  
NSString does not offer?

Like CFStringTransform, CFStringTokenizer etc.


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/aki%40apple.com

This email sent to a...@apple.com

___

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

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

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

This email sent to arch...@mail-archive.com


Re: undoMenuTitleForUndoActionName

2009-04-25 Thread Keary Suska

On Apr 25, 2009, at 10:49 AM, norio ota wrote:


I need to localize the undo menu title.
I made the subclass of NSUndoManager and overrode two methods:
undoMenuTitleForUndoActionName and redoMenuTitleForUndoActionName.

Bun they don't get called.

Would you tell me who calls the functions and , if possible,
how I should do to localize the titles instead of general ones?


The issue, in your particular case, is probably more of an issue of  
how to get various parts of Cocoa to use your NSUndoManager subclass.  
Is there a reason that -setActionName: won't work? I imagine it could  
be rather awkward grammar in some languages, but it would be a lot  
easier.


Otherwise, IIRC, all controls will use the Window's undo manager, so  
if you have the window delegate implement - 
windowWillReturnUndoManager:, you can force the use of your subclass.


Best,

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

___

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

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

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

This email sent to arch...@mail-archive.com


Re: figuring out which TableView I am?

2009-04-25 Thread David Scheidt


On Apr 25, 2009, at 1:34 PM, WT wrote:


On Apr 25, 2009, at 7:26 PM, David Scheidt wrote:


On Apr 25, 2009, at 1:13 PM, WT wrote:

NSTableView inherits from NSControl, which has methods -tag and - 
setTag. I would suggest assigning a different tag value to each  
instance of your NSTableView subclass (you'd do that in your  
subclass' initializer or -awakeFromNib method) and use the -tag  
method to identify the instance when you need to do so.


That's perfect.  Thanks!


You're welcome. It's my impression that tags are generally under- 
utilized, though very useful.


Yes, certainly very useful: makes this problem a switch statement.   
(And not fogetting to set them in IB, but I made tag == 0 and the  
default: case different ugly colors, so I'll know that someone forgot  
to set the right tag (default is zero), or set it to an invalid value  
when I see them.)   I've got a couple other places in this project  
where they'll likely make sense to use, for much the same reasons.





It's also possible to set the tag in IB (it's on the Attributes  
Inspector palette, in the "control" tab).  Since I'm not creating  
any dynamically, I can do that.


It's funny... I fired up IB and created a fake app to check if it  
was possible to set the tag through IB before I replied to your  
first message but, in my haste, missed it so I thought you'd have to  
do it in code.


Well, I'd never used them before.  So I looked them up in the  
NSControl class docs, which say " Tag values are not used internally;  
they are only changed by external invocations of setTag:. You  
typically set tag values in Interface Builder and use them at runtime  
in your application", so I figured there had to be a way to set them,  
and just looked until i found it.

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Dividing NSView to subviews

2009-04-25 Thread Uli Kusterer

On 24.04.2009, at 14:02, Naresh Kongara wrote:

Thanks peter for your reply,

Now there is some improvement in the performance , but the image is  
not that much clear as the image we are getting with  
dataWithPDFInsideRect:


is there any way to remove that blur.



Oh, forgot to include a link to a great article on that topic:

http://wincent.com/a/about/wincent/weblog/archives/2007/01/offbyone.php

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





___

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

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

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

This email sent to arch...@mail-archive.com


Re: Dividing NSView to subviews

2009-04-25 Thread Uli Kusterer

On 24.04.2009, at 14:02, Naresh Kongara wrote:

Thanks peter for your reply,

Now there is some improvement in the performance , but the image is  
not that much clear as the image we are getting with  
dataWithPDFInsideRect:


is there any way to remove that blur.



 You're probably drawing the image between pixels instead of on  
pixels. A coordinate like 1.0 goes along the edge of the destination  
pixel, so each pixel in your image will be drawn half on one pixel and  
half on the other. You'll have to offset your coordinate to cause it  
to be right *on* the pixel.


Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





___

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

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

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

This email sent to arch...@mail-archive.com


Re: problems with live resize of NSTextView

2009-04-25 Thread Stuart Malin


On Apr 25, 2009, at 5:08 AM, Keary Suska wrote:



On Apr 24, 2009, at 3:06 PM, Stuart Malin wrote:

I have an NSTextView in a custom view, it is set to resize with the  
containing view only in the horizontal dimension. When I resize the  
window, the text view does resize, and it does re-layout its  
content to fit, both on expanding and shrinking. However, the text  
view not only changes its frame size height, but repositions itself  
(changing the y value of its frame's origin). Why does it do this?


You need to read the "Cocoa Drawing Guide" and "View Programming  
Guide for Cocoa". The answer is explicit: the 0,0 coordinate of the  
Cocoa drawing system is the bottom left.


Ah, I wasn't clear, because of course the origin would move down as  
the text expands downward. What I am seeing though is that the origin  
moves down more than the increase in height, so the text view isn't  
just expanding, but expanding and moving downward (that is, even its  
top moves down).


More important to me: where is the best place for me to detect this  
change because I want to change the parent view's height to  
accommodate any increase in height in the text view.


One possible approach is to observe NSViewFrameDidChangeNotification  
coming from the view. See the NSView documentation for how to use it.


Thanks for reminding me of this. I need to see whether the  
notification occurs before a redraw cycle. If so, I can propagate  
relevant resizes up the chain of parent views.


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Trying to get flagsChanged: to work

2009-04-25 Thread Dave DeLong
Interesting.  Coming from the world of iPhone dev, this seems wrong to  
me.  On the iPhone, a view's controller is in the chain by default.


Putting the following into GroupListController's awakeFromNib made it  
work just fine:


NSResponder * next = [groupList nextResponder];
[groupList setNextResponder:self];
[self setNextResponder:next];

Thanks!

Dave

On Apr 25, 2009, at 11:32 AM, Jim Correia wrote:

On Sat, Apr 25, 2009 at 1:19 PM, Dave DeLong   
wrote:


It seems that the responder chain is not set up during awakeFromNib  
(even

though all the outlets are), because I moved the loop to my addGroup:
IBAction, where it printed off my chain.  My GroupListController  
was not in
the chain.  Shouldn't it be?  Doesn't a view's controller get a  
chance to

respond to anything that the view doesn't respond to?


No, an NSViewController is an NSResponder subclass, but if you want it
to be part of the responder chain, it is your responsibility to
link/unlink it into the responder chain at the right place when
appropriate.

- Jim

___

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

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

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

This email sent to arch...@mail-archive.com


Re: figuring out which TableView I am?

2009-04-25 Thread WT

On Apr 25, 2009, at 7:26 PM, David Scheidt wrote:


On Apr 25, 2009, at 1:13 PM, WT wrote:

NSTableView inherits from NSControl, which has methods -tag and - 
setTag. I would suggest assigning a different tag value to each  
instance of your NSTableView subclass (you'd do that in your  
subclass' initializer or -awakeFromNib method) and use the -tag  
method to identify the instance when you need to do so.


That's perfect.  Thanks!


You're welcome. It's my impression that tags are generally under- 
utilized, though very useful.


It's also possible to set the tag in IB (it's on the Attributes  
Inspector palette, in the "control" tab).  Since I'm not creating  
any dynamically, I can do that.


It's funny... I fired up IB and created a fake app to check if it was  
possible to set the tag through IB before I replied to your first  
message but, in my haste, missed it so I thought you'd have to do it  
in code.


Wagner
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Trying to get flagsChanged: to work

2009-04-25 Thread Jim Correia
On Sat, Apr 25, 2009 at 1:19 PM, Dave DeLong  wrote:

> It seems that the responder chain is not set up during awakeFromNib (even
> though all the outlets are), because I moved the loop to my addGroup:
> IBAction, where it printed off my chain.  My GroupListController was not in
> the chain.  Shouldn't it be?  Doesn't a view's controller get a chance to
> respond to anything that the view doesn't respond to?

No, an NSViewController is an NSResponder subclass, but if you want it
to be part of the responder chain, it is your responsibility to
link/unlink it into the responder chain at the right place when
appropriate.

- Jim
___

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

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

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

This email sent to arch...@mail-archive.com


Re: figuring out which TableView I am?

2009-04-25 Thread David Scheidt


On Apr 25, 2009, at 1:13 PM, WT wrote:

NSTableView inherits from NSControl, which has methods -tag and - 
setTag. I would suggest assigning a different tag value to each  
instance of your NSTableView subclass (you'd do that in your  
subclass' initializer or -awakeFromNib method) and use the -tag  
method to identify the instance when you need to do so.


That's perfect.  Thanks!
It's also possible to set the tag in IB (it's on the Attributes  
Inspector palette, in the "control" tab).  Since I'm not creating any  
dynamically, I can do that.






On Apr 25, 2009, at 6:47 PM, David Scheidt wrote:

I've got a sub-class of NSTableView.  I have windows that have more  
than one instance of this TableView in them, which need to behave  
slightly differently, based on which one they are.  (There are  
three different classes of data that they'll display, and the  
designer wants the background alternating color to be different  
based on what they're displaying.)  Everything is instantiated from  
IB.  Is there some way to figure out from the class itself which of  
the table views in the NIB it is?  Two approaches occured to me;  
I'm not keen on either.  First is to make N subclasses, each of the  
particular type.  That would work, but seems ugly and a pain to  
maintain.  Second is to check the delegate of the tableview, and  
based on what class it is, do the right thing.  That seems slightly  
weird and wrong.  Is there another way?  Alternatively, am I going  
about this the wrong way from the start?




___

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

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

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

This email sent to arch...@mail-archive.com


Re: Trying to get flagsChanged: to work

2009-04-25 Thread Dave DeLong

After some more investigation...

It seems that the responder chain is not set up during awakeFromNib  
(even though all the outlets are), because I moved the loop to my  
addGroup: IBAction, where it printed off my chain.  My  
GroupListController was not in the chain.  Shouldn't it be?  Doesn't a  
view's controller get a chance to respond to anything that the view  
doesn't respond to?


Dave

On Apr 25, 2009, at 11:05 AM, Dave DeLong wrote:


Hi everyone,

I'm building a master-detail interface with several IB-instantiated  
NSViewController subclasses.  I've got a controller for my group  
list on the left (GroupListController), a controller for the list of  
items (ItemListController), and another controller for the selected  
item (ItemController).


I'm trying to detect when the user presses the option key so that I  
can change the "Add Group" button to an "Add Smart Group" button.   
So far, my attempts have been pretty unsuccessful.  I noticed that  
NSViewController is a subclass of NSResponder, so I thought that I  
could simply implement flagsChanged: in my GroupListController.   
However, it *never* gets fired (nor do any other events, like keyUp,  
keyDown, etc).  I've tried setting the initialFirstResponder to be  
the groupList, manually making the groupList becomeFirstResponder  
(after ensuring that acceptsFirstResponder returns YES), and so on.


One thing that's curious to me is the following in  
GroupListController's awakeFromNib method:


NSResponder * next = [[NSApp keyWindow] firstResponder];
while (next) {
NSLog(@"%@", next);
next = [next nextResponder];
}

That code *never* prints anything.  Is the responder chain empty?   
How can it be, if my groupList is the window's initialFirstResponder?


All I want to do is know when the option key is pressed.  I realize  
that I can implement a CGEventTap and find out that way, but given  
the flagsChanged method, a tap seems like overkill to me.


Any ideas what I'm doing wrong?

Thanks,

Dave
___

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

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

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

This email sent to davedel...@me.com


___

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

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

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

This email sent to arch...@mail-archive.com


Re: figuring out which TableView I am?

2009-04-25 Thread Dave DeLong

Aha.  This makes the -setTag: and IBOutlet methods ineffective.

Dave

On Apr 25, 2009, at 11:14 AM, David Scheidt wrote:



On Apr 25, 2009, at 1:06 PM, Dave DeLong wrote:

Simple way:  have 3 IBOutlets, one for each tableView.  In the  
datasource methods, just do a little bit of pointer comparison to  
figure out which tableview it is.  The tableview requesting  
information is passed along as the first parameter, so you can  
easily do something like:


I'm using bindings, so I don't have have any data source methods.   
Sorry, should have said that.  It's Core Data, cocoa bindings, 10.5+  
only.


___

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

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

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

This email sent to arch...@mail-archive.com


Re: Clicking through a NSView with CALayers

2009-04-25 Thread Rowan Nairn
Hi Volker,

I wasn't clear enough in my original question I think.  Yes, my view
is set up to handle clicks and is doing so just fine.  It's the
windows of *other* apps underneath my transparent view that I'm
worried about.

Here's how to reproduce my problem.  Create a fullscreen transparent
window with an empty view and position it over some other app.  You'll
see that when you click on the transparent area the view ignores the
click and lets the app behind be activated.  This is the behavior I
want.  Now change it to call:

[view setWantsLayer:YES]

Now if you click on the transparent region, you get click events in
the view and the background app never gets activated.

Make sense?

Rowan

On Sat, Apr 25, 2009 at 8:22 AM, Volker in Lists  wrote:
> Hi Rowan,
>
> are you aware that layers don't handle clicks? Does the view containing your
> layers is set to handle mouse events? If not, the behaviour you describe
> sounds expected.
>
> Volker
>
> Am 24.04.2009 um 19:33 schrieb Rowan Nairn:
>
>> Hi,
>>
>> I have a transparent overlay NSWindow the size if the screen and it
>> contains a mostly transparent NSView.  I'd like to accept clicks which
>> occur on non-transparent regions of the view but let clicks that occur
>> over transparent regions activate the app underneath.  If I draw the
>> view using drawRect: then this works well.
>>
>> However I'd also like to use Core Animation in my view.  If I
>> setWantsLayer:YES and draw using CALayers then clicks over transparent
>> regions no longer get passed to apps underneath my window.
>>
>> Is it possible to have my cake and eat it too?
>>
>> Rowan
>> ___
>>
>> 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/volker_lists%40ecoobs.de
>>
>> This email sent to volker_li...@ecoobs.de
>
>
___

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

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

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

This email sent to arch...@mail-archive.com


Re: figuring out which TableView I am?

2009-04-25 Thread WT
NSTableView inherits from NSControl, which has methods -tag and - 
setTag. I would suggest assigning a different tag value to each  
instance of your NSTableView subclass (you'd do that in your subclass'  
initializer or -awakeFromNib method) and use the -tag method to  
identify the instance when you need to do so.


On Apr 25, 2009, at 6:47 PM, David Scheidt wrote:

I've got a sub-class of NSTableView.  I have windows that have more  
than one instance of this TableView in them, which need to behave  
slightly differently, based on which one they are.  (There are three  
different classes of data that they'll display, and the designer  
wants the background alternating color to be different based on what  
they're displaying.)  Everything is instantiated from IB.  Is there  
some way to figure out from the class itself which of the table  
views in the NIB it is?  Two approaches occured to me; I'm not keen  
on either.  First is to make N subclasses, each of the particular  
type.  That would work, but seems ugly and a pain to maintain.   
Second is to check the delegate of the tableview, and based on what  
class it is, do the right thing.  That seems slightly weird and  
wrong.  Is there another way?  Alternatively, am I going about this  
the wrong way from the start?

___

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

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

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

This email sent to arch...@mail-archive.com


Re: figuring out which TableView I am?

2009-04-25 Thread Dave DeLong
Simple way:  have 3 IBOutlets, one for each tableView.  In the  
datasource methods, just do a little bit of pointer comparison to  
figure out which tableview it is.  The tableview requesting  
information is passed along as the first parameter, so you can easily  
do something like:


if (aTableView == myFirstTableView) {

} else if (aTableView == mySecondTableView) {

}
//etc

HTH,

Dave

On Apr 25, 2009, at 10:47 AM, David Scheidt wrote:

I've got a sub-class of NSTableView.  I have windows that have more  
than one instance of this TableView in them, which need to behave  
slightly differently, based on which one they are.  (There are three  
different classes of data that they'll display, and the designer  
wants the background alternating color to be different based on what  
they're displaying.)  Everything is instantiated from IB.  Is there  
some way to figure out from the class itself which of the table  
views in the NIB it is?  Two approaches occured to me; I'm not keen  
on either.  First is to make N subclasses, each of the particular  
type.  That would work, but seems ugly and a pain to maintain.   
Second is to check the delegate of the tableview, and based on what  
class it is, do the right thing.  That seems slightly weird and  
wrong.  Is there another way?  Alternatively, am I going about this  
the wrong way from the start?

___

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

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

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

This email sent to arch...@mail-archive.com


Trying to get flagsChanged: to work

2009-04-25 Thread Dave DeLong

Hi everyone,

I'm building a master-detail interface with several IB-instantiated  
NSViewController subclasses.  I've got a controller for my group list  
on the left (GroupListController), a controller for the list of items  
(ItemListController), and another controller for the selected item  
(ItemController).


I'm trying to detect when the user presses the option key so that I  
can change the "Add Group" button to an "Add Smart Group" button.  So  
far, my attempts have been pretty unsuccessful.  I noticed that  
NSViewController is a subclass of NSResponder, so I thought that I  
could simply implement flagsChanged: in my GroupListController.   
However, it *never* gets fired (nor do any other events, like keyUp,  
keyDown, etc).  I've tried setting the initialFirstResponder to be the  
groupList, manually making the groupList becomeFirstResponder (after  
ensuring that acceptsFirstResponder returns YES), and so on.


One thing that's curious to me is the following in  
GroupListController's awakeFromNib method:


NSResponder * next = [[NSApp keyWindow] firstResponder];
while (next) {
NSLog(@"%@", next);
next = [next nextResponder];
}

That code *never* prints anything.  Is the responder chain empty?  How  
can it be, if my groupList is the window's initialFirstResponder?


All I want to do is know when the option key is pressed.  I realize  
that I can implement a CGEventTap and find out that way, but given the  
flagsChanged method, a tap seems like overkill to me.


Any ideas what I'm doing wrong?

Thanks,

Dave
___

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

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

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

This email sent to arch...@mail-archive.com


undoMenuTitleForUndoActionName

2009-04-25 Thread norio ota

Hi,

I need to localize the undo menu title.
I made the subclass of NSUndoManager and overrode two methods:
undoMenuTitleForUndoActionName and redoMenuTitleForUndoActionName.

Bun they don't get called.

Would you tell me who calls the functions and , if possible,
how I should do to localize the titles instead of general ones?

It would be very appreciated.

Thank you,
Norio
___

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

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

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

This email sent to arch...@mail-archive.com


figuring out which TableView I am?

2009-04-25 Thread David Scheidt
I've got a sub-class of NSTableView.  I have windows that have more  
than one instance of this TableView in them, which need to behave  
slightly differently, based on which one they are.  (There are three  
different classes of data that they'll display, and the designer wants  
the background alternating color to be different based on what they're  
displaying.)  Everything is instantiated from IB.  Is there some way  
to figure out from the class itself which of the table views in the  
NIB it is?  Two approaches occured to me; I'm not keen on either.   
First is to make N subclasses, each of the particular type.  That  
would work, but seems ugly and a pain to maintain.  Second is to check  
the delegate of the tableview, and based on what class it is, do the  
right thing.  That seems slightly weird and wrong.  Is there another  
way?  Alternatively, am I going about this the wrong way from the start?

___

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

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

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

This email sent to arch...@mail-archive.com


Re: [NSOutlineView] _outlineCell and _trackingOutlineCell vs 64-bit

2009-04-25 Thread Jean-Daniel Dupas


Le 25 avr. 09 à 15:12, Iceberg-Dev a écrit :



On Apr 22, 2009, at 8:16 PM, Corbin Dunn wrote:


[...]

There is no way to replace the outlinecell


How could one then draw the disclosure triangle in white


Leopard has a bug with them looking too dark; that is a known  
issue, and it will be fixed. There is no easy way to make them  
white, but in the -willDisplayOutlineCell method you can replace  
the image on the NSButtonCell.



(and correctly centered vertically) instead of black/dark gray  
(and incorrectly centered)?


Override frameOfOutlineCellAtRow: and place it where you want.


Your solution works. Thanks.

The only issues I have with it are:

- independence of resolution lost: By using code, I was able to have  
independence of resolution through bezier path. By changing the  
images, I'm stuck with fixed size image. I don't have Illustrator to  
create a PDF version of the triangles.




No need to have illustrator.
Create a CGPDFContext.
Draw the triangle in it.
Save the resulting PDF.

You can also use a free vectorial editor (like Inkscape - http://www.inkscape.org/ 
 ).


- feedback is not perfect: The non highlighted images can be  
changed. The highlighted state can not be changed or tuned.


But since it now builds and runs in 64-bit, I can't really complain.


___

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

This email sent to devli...@shadowlab.org



___

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

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

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

This email sent to arch...@mail-archive.com


Re: problems with live resize of NSTextView

2009-04-25 Thread Keary Suska


On Apr 24, 2009, at 3:06 PM, Stuart Malin wrote:

I have an NSTextView in a custom view, it is set to resize with the  
containing view only in the horizontal dimension. When I resize the  
window, the text view does resize, and it does re-layout its content  
to fit, both on expanding and shrinking. However, the text view not  
only changes its frame size height, but repositions itself (changing  
the y value of its frame's origin). Why does it do this?


You need to read the "Cocoa Drawing Guide" and "View Programming Guide  
for Cocoa". The answer is explicit: the 0,0 coordinate of the Cocoa  
drawing system is the bottom left.


More important to me: where is the best place for me to detect this  
change because I want to change the parent view's height to  
accommodate any increase in height in the text view.


One possible approach is to observe NSViewFrameDidChangeNotification  
coming from the view. See the NSView documentation for how to use it.


Best,

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

___

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

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

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

This email sent to arch...@mail-archive.com


Re: [NSOutlineView] _outlineCell and _trackingOutlineCell vs 64-bit

2009-04-25 Thread Iceberg-Dev


On Apr 22, 2009, at 8:16 PM, Corbin Dunn wrote:


[...]

There is no way to replace the outlinecell


How could one then draw the disclosure triangle in white


Leopard has a bug with them looking too dark; that is a known  
issue, and it will be fixed. There is no easy way to make them  
white, but in the -willDisplayOutlineCell method you can replace  
the image on the NSButtonCell.



(and correctly centered vertically) instead of black/dark gray  
(and incorrectly centered)?


Override frameOfOutlineCellAtRow: and place it where you want.


Your solution works. Thanks.

The only issues I have with it are:

- independence of resolution lost: By using code, I was able to have  
independence of resolution through bezier path. By changing the  
images, I'm stuck with fixed size image. I don't have Illustrator to  
create a PDF version of the triangles.


- feedback is not perfect: The non highlighted images can be changed.  
The highlighted state can not be changed or tuned.


But since it now builds and runs in 64-bit, I can't really complain.


___

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

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

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

This email sent to arch...@mail-archive.com


Re: How to clone a mutable dictionary

2009-04-25 Thread Mike Abdullah


On 24 Apr 2009, at 17:56, Steve Cronin wrote:


Mike;

Thank-you also.  The "goodness' just doesn't stop... ;-)

My bad on the NSObject code - thanks for clarifying...
(How on earth could init yield a copy?)

But at the end of your message you say "...there's a reason why  
Cocoa has both -copy and -mutableCopy. .."


Is the reason you are alluding to the complications due to instance  
variables that is noted in the NSMutableCopying Protocol notes?

Or are you thinking of another reason?


It's because of the way Cocoa has mutable/immutable class pairs. For  
the mutable class in such a pair (e.g. NSMutableArray), calling -copy  
will return a plain NSArray. You need -mutableCopy if you specifically  
want the copy to be immutable. Therefore when deep copying the  
following hierarchy:


NSMutableArray
NSMutableSet
NSMutableDictionary

You'd probably want to distinguish between a deep copy (in the Cocoa  
sense):


NSArray
NSSet
NSDictionary

And a mutable deep copy:

NSMutableArray
NSMutableSet
NSMutableDictionary
___

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

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

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

This email sent to arch...@mail-archive.com


How to set tags for ComboBox cell items?

2009-04-25 Thread Arun
Hi All,

In my application i use NSComboBoxCell in a table column. The ComboxCell has
3 pre-defined items in the drop down.
How can i set tags or identifiers to these pre-defined items so that when
user chooses one of the pre-defined items i can know which item he has
chosen.
I don't to use string comparision as the application is muti-lingual.

Thanks
Arun
___

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

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

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

This email sent to arch...@mail-archive.com


Re: parsing a string into words

2009-04-25 Thread Gerriet M. Denkmann


On 25 Apr 2009, at 09:21, Michael Ash  wrote:


On Fri, Apr 24, 2009 at 9:24 PM, Gerriet M. Denkmann
 wrote:


I want to parse a string into words.
Currently I do:

NSString *theString = 
NSUInteger stringLength = [ theString length ];
NATextView *theTextView = [[NSTextView alloc] initWithFrame:
NSMakeRect(0,0,99,99) ];
[ theTextView setString: theString ];

for( NSUInteger t = 0; t < stringLength;)
{
       NSRange proposedSelRange = NSMakeRange(t,0);
       NSRange wordRange = [ theTextView
selectionRangeForProposedRange: proposedSelRange

   granularity:                                  
   NSSelectByWord
                                             
   ];
       NSString *word = [ theString substringWithRange:  
wordRange ];

       t = NSMaxRange( wordRange );

       //      do something with 
};

[ theTextView release ];

but this looks rather wasteful. Is there a more elegant way?

Please note that there are lots of languages, where words are not  
separated

by space or punctuation.


If you can require 10.5, use CFStringTokenizer. It is really great,
and is a lot simpler and less evil than this.



Thanks a lot. This was exactly what I was looking for.
But without knowing the term "CFStringTokenizer", it is really hard to  
find.


But this is a general problem:
Cocoa is just the tip of the iceberg, on top of lots of additional C- 
APIs which are needed to solve the not so common problems.


Would it not be a good idea, if e.g. the documentation for NSString  
would mention the C-APIs which can be used for functionality which  
NSString does not offer?

Like CFStringTransform, CFStringTokenizer etc.


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


Auxiliary background executable without dock icon but with some UI

2009-04-25 Thread Oleg Krupnov
Hi,

In my app's bundle I have two executables - the main one and an
auxiliary one, launched by the main executable. The aux executable is
a Distributed Objects server. In its main() function there's a simple
run loop that is intended to accept connection events:

while (!shouldTerminate)
{
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:[NSDate distantFuture]];
}

Everything works fine.

Now I want to use the aux executable additionally to show some UI
window. (I can't show the window in the main executable but have to do
it in the aux process because the aux process runs as root, and the UI
window is provided by a third party component that also must have root
permissions)

I added the corresponding function to the vended object interface, but
the result is not satisfactory.

The problem #1 is that although the desired UI window appears, it does
not accept mouse and keyboard input. I guess I haven't properly set up
the run loop, or window server, but I don't know how to do this for
such an auxiliary executable. Any hints would be welcome!

The problem #2 is that another application icon (the same as the main
app's) appears in the dock, and begins jumping. I've read in the docs
that I can suppress the dock icon if I set the LSUIElement property in
the Info.plist file, but there are two executables in the bundle, and
bundle's Info.plist is already taken by the main executable. If I
modify the main Info.plist, the main executable will not show its icon
in the dock, which is not the desirable effect. How do I provide
another Info.plist file for the auxiliary executable in the same
bundle?

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


Re: Conversation-style controls?

2009-04-25 Thread Angus Hardie


On 24 Apr 2009, at 15:44, Christopher Gillis wrote:


How would I go about attaining a conversation-style layout. Tweetie (
http://www.atebits.com/tweetie-mac/ ) is a perfect example of the  
layout I

would like to achieve. I can get something similar by subclassing
NSTableView but it seems to me like it's a convoluted approach to what
should be a simple problem.


I believe that Adium uses webkit and javascript to do its (somewhat  
similar) controls.




--
Angus Hardie
angus.har...@malcolmhardie.com




___

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

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

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

This email sent to arch...@mail-archive.com


Re: CF autorelease?

2009-04-25 Thread Jean-Daniel Dupas


Le 25 avr. 09 à 07:57, Charles Srstka a écrit :


On Apr 23, 2009, at 3:42 PM, Todd Heberlein wrote:

Many of the Cocoa object allocation methods automatically do an  
autorelease before returning the pointer to the object, so I can  
call something like:


foo( [NSString stringWithCString: "bar" encoding:  
NSASCIIStringEncoding] );


and then not worry about memory leakage. Is the same true with Core  
Foundation calls? For example, will


foo2( CFSTR("bar") ); or
foo2 ( CFStringCreateWithCString(NULL, "bar",  
kCFStringEncodingASCII) );


leak memory?


You could just:

foo2 ( [(NSString *)CFStringCreateWithCString(NULL, "bar",  
kCFStringEncodingASCII) autorelease] );


To be GC safe, it should be

foo2 ( [NSMakeColectable(CFStringCreateWithCString(NULL, "bar",  
kCFStringEncodingASCII)) autorelease] );



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Conversation-style controls?

2009-04-25 Thread Benjamin Dobson


On 24 Apr 2009, at 15:44:51, Christopher Gillis wrote:


How would I go about attaining a conversation-style layout. Tweetie (
http://www.atebits.com/tweetie-mac/ ) is a perfect example of the  
layout I

would like to achieve. I can get something similar by subclassing
NSTableView but it seems to me like it's a convoluted approach to what
should be a simple problem.


You could just subclass NSCell.
___

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

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

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

This email sent to arch...@mail-archive.com