Subject: [ NSSplitview ] -setAutosaveName

2009-05-31 Thread Caleb Strockbine

On May 31, 2009, at 12:10 AM, cocoa-dev-requ...@lists.apple.com wrote:

What does setAutosaveName actually do? I assume it saves the  
position of the splitview to user defaults?


Did you read the fine manual? It's fairly plain:

"Sets the name under which receiver’s divider position is  
automatically saved... If this value is nil or the string is empty no  
autosaving is done."


So, if you set the autosave name for a split view to something other  
than nil, the split view will automatically save its position using  
the name that you gave it. The autosave name isn't something that  
you'd normally want to change after the splitter is set up -- you set  
it either in Interface Builder or in whatever code creates the  
splitter, and then forget about it.




If so, how does one retrieve that value?



Typically, one doesn't. The split view will use the autosave name you  
gave it to retrieve the data from the defaults system and set itself  
appropriately. Your app shouldn't need to worry about the position of  
the splitters themselves -- they're not controls, and they shouldn't  
affect the state of your application. To whatever extent you do care  
about the position of the splitters, you can/should probably rely on  
the sizes of the split view's subviews instead. However, if you do  
want to peek at the data that the split view is saving (for logging  
purposes, perhaps), you can always retrieve the split view's data from  
the defaults system yourself:


id savedData = [[NSUserDefaults standardUserDefaults] valueForKey: 
[slider autosaveName]];


I used an id above because you really can't know for certain what kind  
of data NSSplitView is saving. It's probably an array, since there can  
be more than one splitter in a split view, but it could be something  
else.


-Caleb___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Subject: [ NSSplitview ] -setAutosaveName

2009-05-31 Thread Erg Consultant
Ok so more specifically I should have asked:

How do I get the NSSplitView to restore the divider position when my app 
relaunches the next time?

I set the autosave name but when I drag the splitter, then quit and relaunch, 
it's still in the default position, not the position it was in when I quit.

Erg





From: Caleb Strockbine 
To: cocoa-dev@lists.apple.com
Cc: erg_consult...@yahoo.com
Sent: Sunday, May 31, 2009 12:19:34 AM
Subject: Subject: [ NSSplitview ] -setAutosaveName


On May 31, 2009, at 12:10 AM, cocoa-dev-requ...@lists.apple.com wrote:

What does setAutosaveName actually do? I assume it saves the position of the 
splitview to user defaults?

Did you read the fine manual? It's fairly plain:

"Sets the name under which receiver’s divider position is automatically 
saved... If this value is nil or the string is empty no autosaving is done."

So, if you set the autosave name for a split view to something other than nil, 
the split view will automatically save its position using the name that you 
gave it. The autosave name isn't something that you'd normally want to change 
after the splitter is set up -- you set it either in Interface Builder or in 
whatever code creates the splitter, and then forget about it.


If so, how does one retrieve that value?


Typically, one doesn't. The split view will use the autosave name you gave it 
to retrieve the data from the defaults system and set itself appropriately. 
Your app shouldn't need to worry about the position of the splitters themselves 
-- they're not controls, and they shouldn't affect the state of your 
application. To whatever extent you do care about the position of the 
splitters, you can/should probably rely on the sizes of the split view's 
subviews instead. However, if you do want to peek at the data that the split 
view is saving (for logging purposes, perhaps), you can always retrieve the 
split view's data from the defaults system yourself:

id savedData = [[NSUserDefaults standardUserDefaults] valueForKey:[slider 
autosaveName]];

I used an id above because you really can't know for certain what kind of data 
NSSplitView is saving. It's probably an array, since there can be more than one 
splitter in a split view, but it could be something else.

-Caleb



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing

2009-05-31 Thread Erg Consultant
I have a custom icon in a .tiff that I draw next to my cells in an 
NSOutlineView table.

Everything works fine until I turn on 
NSTableViewSelectionHighlightStyleSourceList:

[ registryOutlineView 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList ];

When I do that the table draws the disclosure triangle area with the 
NSTableViewSelectionHighlightStyleSourceList but it draws the icon & text to 
the right of my icon without NSTableViewSelectionHighlightStyleSourceList (i.e. 
with normal selection highlighting).

In my header I have my cell & icon ivar:

IBOutlet NSOutlineView *registryOutlineView;
NSImage *hackOutlineViewFolderIconImage;
NSBrowserCell  *hackOutlineViewFolderCell;

When my app starts I load my icon from file, cache it, and then set my folder 
icon image onto my NSBrowserCell:

- (BOOL)loadCachedIconCell
{
BOOLgotEm = NO;

if( hackOutlineViewFolderIconImage )
{
// Make a new folder icon cell and cache it...

hackOutlineViewFolderCell = [ [ NSBrowserCell alloc ] init ];
if( hackOutlineViewFolderCell )
{
// Turn off right-pointing arrow on right side of cell...

[ hackOutlineViewFolderCell setLeaf:YES ];

// Set our folder icon into the cell...

[ hackOutlineViewFolderCell setImage:hackOutlineViewFolderIconImage 
];
}
}

return gotEm;
}

In my - (void)outlineView:(NSOutlineView*)outlineView
willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn
item:(id)item method I set the cell to the cached cell I set up earlier:

- (void)outlineView:(NSOutlineView*)outlineView willDisplayCell:(id)cell 
forTableColumn:(NSTableColumn*)tableColumn item:(id)item
{
if( outlineView && cell && tableColumn && item )
{
// Only handle outline view case...

if( ( [ outlineView isEqualTo:registryOutlineView ] ) && ( [ 
tableColumn isEqualTo:registryTableColumn1 ] ) )
{
// Set the column's cell to our folder icon cell...

if( hackOutlineViewFolderCell )
{
[ tableColumn setDataCell:hackOutlineViewFolderCell ];
}
  }
  }
}


  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing

2009-05-31 Thread Kyle Sluder
I guess my first question is, why are you using an NSBrowserCell for
this?  NSBrowserCell probably knows nothing about table view
highlighting styles, because its intended use is inside an NSMatrix
within an NSBrowser.

An image-and-text cell is not hard to create.  It can delegate its
drawing to an NSImageCell and NSTextFieldCell.

--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: Several Questions

2009-05-31 Thread Alexander Spohr

Could you split your app in two?
One would be a daemon that runs all times, the second a gui-frontend  
for the deamon.


The problem seems to be that no one here can think of an app that has  
a gui that no one ever looks at. Why a gui at all if no one looks at  
it anyway?


atze


Am 31.05.2009 um 08:18 schrieb Ammar Ibrahim:


But my app is a "normal" Cocoa App, it's not a daemon or an agent.

On Sun, May 31, 2009 at 6:16 AM, Chris Hanson  wrote:

The best way to ensure your daemon or agent is always running is to  
have it

run via launchd.

Start by reading the launchd man page and the "Daemons and Agents"  
tech
note; these will give you an overview of how Mac OS X used launchd  
to manage

these types of on-demand and always-on services.

-- Chris


On May 30, 2009, at 5:57 PM, Ammar Ibrahim 
wrote:

On Sun, May 31, 2009 at 3:27 AM, Kyle Sluder 

wrote:

On Sat, May 30, 2009 at 5:20 PM, Ammar Ibrahim >

wrote:

1- How do you ensure only one instance of your app is running?  
How do

you
detect if it stops responding? Can you restart it using  
something like a

watchdog? And how would you go about implementing it?



The system already does this for you.  Unless you're not writing a
regular application (say, a daemon or something), or you only  
want one

instance regardless of how many people are logged in on the machine
(say, using Fast User Switching).  If you need to ask this  
question,
you're probably not in either of these scenarios, so don't worry  
about

it.


Actually, I'm writing a non regular application, and it's for a  
controlled
environment. No users will be using the system, it should be  
completely
automated and recover from errors. All I need is to make sure my  
app is
running at all times. Would a simple cronjob check do the trick?  
The only
thing I dont know how to do at the moment is to check if the app  
is not

responding, and force quit it from an external script/app





2- Is there a way to launch applications like iTunes from cocoa  
without



the


need to use AppleScript?



Look at the NSWorkspace documentation.  iTunes's bundle  
identifier is

com.apple.iTunes, but in general you can look at any app bundle's
Info.plist file to get its bundle identifier (the  
CFBundleIdentifier

key).





Thanks, I did and it did the trick. One question though, it seems  
the call
returns before the app is launched, what's the best way to detect  
when the
app is launched? I heard there's something called notification  
center or

so.
Is there a way to view all notifications being sent on my Mac?
___

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

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

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

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




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de

This email sent to a...@freeport.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: Message from view to viewController

2009-05-31 Thread Pierre Berloquin
I think I solved the warning problem. I suspected my folder logic was wrong
so I cleaned it up, taking all class files from the project and adding them
back one by one. And it works fine, no warning anywhere !I had a duplicate
controller I had created by mistake and I thought I had gotten rid of.
Thanks

2009/5/31 Pierre Berloquin 

> I get warning "UIViewController may not respond to '-vagTouchesBegan:'
> (Messages without a matching method signature will be assumed to return
> 'id' and accept '...' as arguments)" when I call the view controller from
> the sub view
>
> - (void) touchesBegan: (NSSet *)touches withEvent:(UIEvent *)event {
>
> [theViewController vagTouchesBegan:self];
>
> }
>
> even though vagTouchesBegan is properly declared in the controller's .h
>
> -(void)vagTouchesBegan:(id)sender;
>
> Also I follow your advice about retaining loopholes and use
>
> -(void)setViewController:(UIViewController *) vc{
>
> theViewController = vc;
>
> }
>
> So the warning remains puzzling. Note that it's displayed on the sub view
> .m page only, after the call line, not after the mention "Succeeded".
>
> Thanks for your tips.
>
>
>
>
> 2009/5/30 WT 
>
>> On May 30, 2009, at 5:43 PM, Pierre Berloquin wrote:
>>
>>  Declaring in .h
>>>
>>> -(void)vagTouchesBegan:(id)sender;
>>> was my first impulse. But that's not enough.
>>>
>>
>> It's not clear from your two posts which method you're getting a warning
>> for. I thought it was for the -vagTouchesBegan method, but you claim it's
>> not. Please post the actual warning that you get from XCode.
>>
>>  About the memory problem, I suppose I should receive touchesBegan in the
>>> controller and sort out what I get ?
>>>
>>
>> No, that's not what I was referring to. I was referring to the fact that
>> if an object of class A retains an object of class B and that same object of
>> class B also retains the object of class A which retains it, then you have
>> what's called a retain cycle. That may cause you trouble if you're not
>> careful.
>>
>> The view controller already retains its view, so if you're passing the
>> view controller object to the view object for it to keep, then the view
>> object should NOT retain that view controller object. If what I just said
>> isn't completely clear to you, you should read
>>
>>
>> http://devworld.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html
>>
>> If that document is still a bit obscure, then you should search the web
>> for more accessible explanations. For instance,
>>
>>
>> http://stackoverflow.com/questions/791322/retain-cycles-why-is-that-such-a-bad-thing
>>
>> Note that it *is* ok for the view object to have a pointer to its view
>> controller. All I'm saying is that you should avoid retaining the view
>> controller in its view. Thus, instead of
>>
>> - (void) setViewController: (UIViewController*) vcontroller
>> {
>>[viewController release];
>>viewController = [vcontroller retain];
>> }
>>
>> (which is the typical setter for objects) you should have
>>
>> - (void) setViewController: (UIViewController*) vcontroller
>> {
>>viewController = vcontroller; // Note: no release and no retain
>> }
>>
>> (atypical for objects, but necessary in this case to avoid a retain
>> cycle).
>>
>> Or, if you prefer to use properties, instead of
>>
>> @property (readwrite, nonatomic, retain) UIViewController* viewController;
>>
>> you should use
>>
>> @property (readwrite, nonatomic, assign) UIViewController* viewController;
>>
>> Wagner
>>
>>
>>  2009/5/30 WT 
>>>
>>>  On May 30, 2009, at 4:40 PM, Pierre Berloquin wrote:

 [theViewController vagTouchesBegan:self];

> QED
> There's still a warning that the view controller may not respond. But
> it
> works seamlessly.
> Can I get rid of the warning?
>
>
 Yes, by declaring the method -vagTouchesBegan: in the header file of
 your
 view controller class.

 Something to be cautious about when storing in the view a pointer to its
 view controller is that you may end up creating a retain cycle, since
 the
 view controller already retains its view. I would recommend that you
 read
 the documentation on memory management to make sure you don't create
 unnecessary problems for yourself.

 Wagner

>>>
>
>
> --
> Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
>http://pierre-berloquin.blogspot.com/
>
> Développement durable des neurones par le jeu de réflexion
> www.crealude.net
>
> Sustainable development of neurones through mind games
> www.crealude.net/us
>
> Que fait-on pour les mal-codants ?
>



-- 
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

Cocoa-de

Re: Several Questions

2009-05-31 Thread Jelle De Laender

Can you give us so more details? For example: What will the app do?
Your description is very strange, lol.

But indeed, you should create a normal cocoa app that do the stuff you  
want to do (UI + the real stuff),
and a little daemon that checks every X minutes if the other app is  
running:

yes: ok, continue
no: start app (log message? App was stopped)

Jelle

On 31 May 2009, at 11:07, Alexander Spohr wrote:


Could you split your app in two?
One would be a daemon that runs all times, the second a gui-frontend  
for the deamon.


The problem seems to be that no one here can think of an app that  
has a gui that no one ever looks at. Why a gui at all if no one  
looks at it anyway?


atze


Am 31.05.2009 um 08:18 schrieb Ammar Ibrahim:


But my app is a "normal" Cocoa App, it's not a daemon or an agent.

On Sun, May 31, 2009 at 6:16 AM, Chris Hanson  wrote:

The best way to ensure your daemon or agent is always running is  
to have it

run via launchd.

Start by reading the launchd man page and the "Daemons and Agents"  
tech
note; these will give you an overview of how Mac OS X used launchd  
to manage

these types of on-demand and always-on services.

-- Chris


On May 30, 2009, at 5:57 PM, Ammar Ibrahim 
wrote:

On Sun, May 31, 2009 at 3:27 AM, Kyle Sluder 

wrote:

On Sat, May 30, 2009 at 5:20 PM, Ammar Ibrahim >

wrote:

1- How do you ensure only one instance of your app is running?  
How do

you
detect if it stops responding? Can you restart it using  
something like a

watchdog? And how would you go about implementing it?



The system already does this for you.  Unless you're not writing a
regular application (say, a daemon or something), or you only  
want one
instance regardless of how many people are logged in on the  
machine
(say, using Fast User Switching).  If you need to ask this  
question,
you're probably not in either of these scenarios, so don't worry  
about

it.


Actually, I'm writing a non regular application, and it's for a  
controlled
environment. No users will be using the system, it should be  
completely
automated and recover from errors. All I need is to make sure my  
app is
running at all times. Would a simple cronjob check do the trick?  
The only
thing I dont know how to do at the moment is to check if the app  
is not

responding, and force quit it from an external script/app





2- Is there a way to launch applications like iTunes from cocoa  
without



the


need to use AppleScript?



Look at the NSWorkspace documentation.  iTunes's bundle  
identifier is

com.apple.iTunes, but in general you can look at any app bundle's
Info.plist file to get its bundle identifier (the  
CFBundleIdentifier

key).





Thanks, I did and it did the trick. One question though, it seems  
the call
returns before the app is launched, what's the best way to detect  
when the
app is launched? I heard there's something called notification  
center or

so.
Is there a way to view all notifications being sent on my Mac?
___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/atze%40freeport.de

This email sent to a...@freeport.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/maillist%40codingmammoth.com

This email sent to maill...@codingmammoth.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: Message from view to viewController

2009-05-31 Thread WT

On May 31, 2009, at 8:04 AM, Pierre Berloquin wrote:


Also I follow your advice about retaining loopholes and use

-(void)setViewController:(UIViewController *) vc{

theViewController = vc;

}

So the warning remains puzzling. Note that it's displayed on the sub  
view .m

page only, after the call line, not after the mention "Succeeded".


I think you're under the impression that the recommendation to avoid  
retain cycles is somehow related to the warning you received. It is  
not. I made that recommendation as a general statement since you're  
doing something that could very easily cause retain cycles (namely,  
having a view store a pointer to its view controller).


On May 31, 2009, at 11:30 AM, Pierre Berloquin wrote:

I think I solved the warning problem. I suspected my folder logic  
was wrong
so I cleaned it up, taking all class files from the project and  
adding them
back one by one. And it works fine, no warning anywhere !I had a  
duplicate

controller I had created by mistake and I thought I had gotten rid of.


Ok, that might be it. If it works now, great.


Thanks


Welcome.

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: NSURLConnection sendSynchronousRequest: crashes since, upgrading to 10.5.7

2009-05-31 Thread Andrew Farmer

On 27 May 2009, at 18:20, Dennis Hartigan-O'Connor wrote:
I have a very similar problem: my simple program that downloads  
stock prices has been working fine but intermittently crashes on  
10.5.7, whether I use sendSynchronousRequest or  
stringWithContentsOfURL.  For me, too, everything is fine for 10-15  
minutes and then the program crashes.


Here is the crash log from the crashed thread:

Thread 1 Crashed:
0   libobjc.A.dylib 0x965c3688 objc_msgSend + 24
1   com.apple.CoreFoundation0x946cc581  
_CFStreamSignalEventSynch + 193
2   com.apple.CoreFoundation0x946ba595  
CFRunLoopRunSpecific + 3141
3   com.apple.CoreFoundation0x946bac78  
CFRunLoopRunInMode + 88
4   com.apple.Foundation0x9058c530 + 
[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:]  
+ 320
5   com.apple.Foundation0x90528e0d -[NSThread main]  
+ 45
6   com.apple.Foundation0x905289b4  
__NSThread__main__ + 308


Any ideas out there?  I can't believe this isn't happening to lots  
of people.


The symptoms described in the original thread all pointed strongly to  
a latent memory management issue that's being triggered by changes in  
the URL loading code. Does your application print any console output  
before (or as) it's crashing? If this doesn't point straight at  
anything, try running your application under MallocDebug.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Cocoa-dev Digest, Vol 6, Issue 811

2009-05-31 Thread Michael Swan

Strange, this originally was a link

A Core Data Tutorial Part 2: Polishing the Basics

Guess it got stripped, here is the real link.
http://themikeswan.wordpress.com/2009/05/30/a-core-data-tutorial-part-2-polishing-the-basics/


Mike Swan
ETCP Certified Entertainment Electrician
http://www.michaelsswan.com

"The Ego is the little self that pretends to be the only self and  
speaks so loudly that the still, small voice of the Greater Self,  
whose whisperings come from within the Soul, are rarely heard - unless  
we learn to listen."


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 draw background image in my app window

2009-05-31 Thread Uli Kusterer

Am 30.05.2009 um 19:45 schrieb cocoa learner:
Yah Andy and Michael you all were right. But still I have some  
problem.1>.

While resizing the window Image is not getting resized.


 You could probably fix that using setImageScaling: on the image view.


2>. My controls (NSButton and NSTextField) are not visible after the
awakeFromNib call.


 You are replacing the window's content view with a new view. That  
means that the entire content view and all its subviews get removed.  
You may want to loop over the subviews of the previous content view  
and move them all to your image view.


 Another approach would be to try changing the class of your content  
view in Interface builder. Simply click the background of the window,  
that should show the content view in the inspector. Go to the  
"Identity" tab and change the class to NSImageView. Then you can  
probably just do


[(NSImageView*)[myWindow contentView] setImage: [[[NSImage alloc]  
initWithContentsOfFile: path] autorelease]];


 I haven't actually tried this, but I know you can select the content  
view that way since Interface Builder 3.x, and I know you can change  
classes of objects that way, so this should work.



NSString *path = [myBundle pathForResource:@"winImg" ofType:@"png"];

NSLog(@"AppController::init : Image file path : %@", path);

// winImageView is a data member of this class

winImageView = [[NSImageView alloc] init];

[winImageView setImage: [[NSImage alloc] initWithContentsOfFile:  
path]];



 Are you using garbage collection? If not, you are leaking the image  
and the image view here. In that case, you may want to re-read Apple's  
memory-management documentation, which describes which things need to  
be released and which ones don't.


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: Several Questions

2009-05-31 Thread Uli Kusterer

Am 31.05.2009 um 12:12 schrieb Jelle De Laender:

Can you give us so more details? For example: What will the app do?
Your description is very strange, lol.

But indeed, you should create a normal cocoa app that do the stuff  
you want to do (UI + the real stuff),
and a little daemon that checks every X minutes if the other app is  
running:

yes: ok, continue
no: start app (log message? App was stopped)



 Look at CFNotification and the distributed notification center (I  
thought there was a Cocoa variant of that, but I can't seem to find  
it) for a way to detect whether your app has hung. You could just do a  
ping/pong set of question/reply notifications that your daemon sends  
to your app and gets a reply. If the app is still running but there's  
no reply within a sensible timeframe, something has gone wrong.


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: [ NSSplitview ] -setAutosaveName

2009-05-31 Thread Jim Correia
On Sat, May 30, 2009 at 11:22 PM, Erg Consultant
 wrote:

> What does setAutosaveName actually do? I assume it saves the position of the 
> splitview to user defaults?

The behavior is documented, succinctly, here:

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/nssplitview_Class/Reference/Reference.html#//apple_ref/occ/instm/NSSplitView/setAutosaveName:

> If so, how does one retrieve that value?

You typically don't, since the actual key and format of the data is a
private implementation detail. NSSplitView will restore the geometry
for you automatically.

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: Showing more warnings possible in Xcode?

2009-05-31 Thread Michael Ash
On Sat, May 30, 2009 at 11:36 PM, Eric Hermanson  wrote:
> Yes Mike, you ask a very pertinent question.
>
> First I'm looking for a source-time (not compile-time) monitor that would
> alert me to potential code problems as I type.

Seems like this would have to be *extremely* unobtrusive to avoid
false positives that happen while I'm typing and haven't finished with
the code yet.

> Second, to get an idea of the code inspection capabilities of the Java IDE
> I've been using for the past 8 years, see:
>
>        http://www.jetbrains.com/idea/documentation/inspections.jsp  (very
> much worth the read, and maybe even try the app itself)

If I understand this correctly, this IDE has some kind of plug-in
interface such that third parties can write new warnings? That's
pretty cool if so. You ought to file a bug requesting this in Xcode.

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: Cocoa Bindings and Dependent Keys question

2009-05-31 Thread Keary Suska

On May 30, 2009, at 2:18 PM, Kelvin Chung wrote:

I seem to have a very simple question, but the answer is eluding me  
for some odd reason, but here goes:


Suppose I have two NSArrayControllers, ac1 and ac2.  Suppose now  
that I have a third controller ac3, whose content array is dependent  
on both ac1.selection and ac2.selection (or some keypath therein).   
Since I can't bind ac3 to both ac1 and ac2 at the same time, I have  
a class which has a dependent key.  In particular, suppose I have  
the following:


@interface Foo {
  IBOutlet NSArrayController* ac1;
  IBOutlet NSArrayController* ac2;
}
/* ... */
@end

@implementation Foo
- (id) ac1Selection { return [[ac1 selection] valueForKey:@"bar"]; }
- (id) ac2Selection { return [[ac2 selection] valueForKey:@"baz"]; }

+ (NSSet*) keyPathsForValuesAffectingAc3ContentArray {
  return [NSSet setWithObjects:@"ac1Selection", @"ac2Selection", nil];
}


The +keyPathsForValuesAffectingKey is, at least in theory, correct,  
but it won't work. You will never receive KVO notifications when the  
selection changes. Instead, why not just observe "selectedObjects" of  
each array controller, and in - 
observeValueForKeyPath:ofObject:change:context: send willchange/ 
didchange for the "ac3ContentArray" key?



- (NSArray*) ac3ContentArray {
  /* Do stuff using -ac1Selection and -ac2Selection */
}
@end


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


Label randomly cut off in NSOutlineView column

2009-05-31 Thread David
I have an outline view where the first column are file names. There is
absolutely no processing of the name going on in my code.

Everything has been working fine for a long time. Suddenly I discover
a filename that causes the value displayed to be truncated. I've
played with it. There are no special characters, they're all regular
ascii single byte characters. For some names it works, some get
truncated with no apparent rhyme or reason.

Has anyone seen anything like this before? Is this some weird bug or
explainable behavior in Cocoa? Could I be doing something wrong? My
application is running on leopard with garbage collection enabled.

I've changed the name to be generic. The following filename
Xxxx....444..66.777

displays in my NSOutlineView as
Xxxx.

If I take out some xx's it works. Many other random changes will make
it work, such as changing the Xs to 0s. Some cases will cause it to
truncate at a later period, but it always truncates at a period.

This is extremely weird. Any suggestions appreciated.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSTableView setting row heights

2009-05-31 Thread Peter Hudson

I have a table view with 3 columns.
I have implemented the delegate method   -tableView:heightForRow:  in  
order to set row height.
The height is set correctly, my NSMutableString s are rendered  
correctly.


I can't however select rows in the table view.

Any suggestions.

Peter


___

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

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

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

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


Re: How to draw background image in my app window

2009-05-31 Thread Andy Lee

On May 31, 2009, at 8:51 AM, Uli Kusterer wrote:
Another approach would be to try changing the class of your content  
view in Interface builder. Simply click the background of the  
window, that should show the content view in the inspector. Go to  
the "Identity" tab and change the class to NSImageView. Then you can  
probably just do


[(NSImageView*)[myWindow contentView] setImage: [[[NSImage alloc]  
initWithContentsOfFile: path] autorelease]];


I had the same thought but when I tried it (and added a call to  
setImageScaling:) the image didn't appear.  I wonder what I'm doing  
wrong:


- (void)awakeFromNib
{
NSLog(@"-[AppDelegate awakeFromNib]");

NSImage *whiteRoomImage = [NSImage imageNamed:@"WhiteRoom"];
NSImageView *backgroundImageView = (NSImageView *)[_imageWindow  
contentView];


NSLog(@"image: %@", whiteRoomImage);
NSLog(@"contentView: %@", [_imageWindow contentView]);

[backgroundImageView setImageScaling:NSScaleToFit];
[backgroundImageView setImage:whiteRoomImage];
}

Yet another approach would be to use IB to add an image view as a  
subview of the window's content view, and use autoresizing to have it  
always fill the content view.  The benefit of this approach is that  
you can see the background image in IB, so you can see what it looks  
like as you lay out its subviews.


--Andy

___

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

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

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

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


Re: [Announce] A Core Data Tutorial Part 2: Polishing the Basics

2009-05-31 Thread Mic Pringle
Michael,

Do you have a link for the article ?

There wasn't one in your announcement ?

Thanks

-Mic

2009/5/31 Michael Swan :
> Part 2 of my tutorial is up for anyone that is interested.
> A Core Data Tutorial Part 2: Polishing the Basics
>
> Mike Swan
> ETCP Certified Entertainment Electrician
> http://www.michaelsswan.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/micpringle%40gmail.com
>
> This email sent to micprin...@gmail.com
>
___

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

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

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

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


Re: [Announce] A Core Data Tutorial Part 2: Polishing the Basics

2009-05-31 Thread Dave DeLong

http://themikeswan.wordpress.com/2009/05/30/a-core-data-tutorial-part-2-polishing-the-basics/

On May 31, 2009, at 9:43 AM, Mic Pringle wrote:


Michael,

Do you have a link for the article ?

There wasn't one in your announcement ?

Thanks

-Mic

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSFormatter Question

2009-05-31 Thread Matt Neuburg
On Sun, 24 May 2009 13:30:30 -0500, Dietmar Kuttelwascher 
said:
>This is a newbie question, my apologies if it has been discussed in
>the past. I haven't been programming on a Mac since the System 7 days
>and trying to catch up with OS X and Cocoa...
>
>I have text field bound to an NSObjectController with an
>NSNumberFormatter to ensure that there are only integer numbers
>entered. Whenever I leave the field blank or enter invalid characters,
>I get a very generic error message "Formatting Error". I'd like to
>customize that error message with a hint for the user which values are
>valid (similar to the message I get in the standard print dialog when
>entering zero copies), but I haven't found a way to do so, except for,
>perhaps, subclassing NSNumberFormatter. I had a look at -
>control:didFailToFormatString:errorDescription:, but noticed that the
>error description is not a mutable string, therefore I cannot pass
>back a modified error message. Is there a way to customize the error
>message without having to create a new subclass of NSNumberFormatter
>for each field with a different format?
>
>On a related topic, if I set "Validates Immediately" on the binding of
>that particular field, I was expecting to be stopped in my tracks as
>soon as I enter, say, a letter instead of a number, but nothing
>happens. It seems like the setting of the Validates Immediately flag
>doesn't have any impact on the behavior. Am I missing something here?

This might help:

http://www.cocoabuilder.com/archive/message/cocoa/2008/9/9/217770

m.
-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Nike+iPod Settings Undocumented?

2009-05-31 Thread Chunk 1978
i can't seem to find documentation on how to disable preference
specifiers based on PSToggleSwitchSpecifier current setting.  an
example is the Nike+iPod's settings.  activating the app will enable
the remaining settings to be configured, while they are grayed
out/disabled if the app is not active.

anyone have any information on this?  or even how to create special
views (again, like Nike+iPod's settings for Sensor and Remote)
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Several Questions

2009-05-31 Thread Ammar Ibrahim
On Sun, May 31, 2009 at 3:57 PM, Uli Kusterer
wrote:

> Am 31.05.2009 um 12:12 schrieb Jelle De Laender:
>
>> Can you give us so more details? For example: What will the app do?
>> Your description is very strange, lol.
>>
>> But indeed, you should create a normal cocoa app that do the stuff you
>> want to do (UI + the real stuff),
>> and a little daemon that checks every X minutes if the other app is
>> running:
>>yes: ok, continue
>>no: start app (log message? App was stopped)
>>
>
>
>  Look at CFNotification and the distributed notification center (I thought
> there was a Cocoa variant of that, but I can't seem to find it) for a way to
> detect whether your app has hung. You could just do a ping/pong set of
> question/reply notifications that your daemon sends to your app and gets a
> reply. If the app is still running but there's no reply within a sensible
> timeframe, something has gone wrong.
>


This seems like a very doable approach. Anyhow, the daemon itself might
crash, so I would go for a cron job that runs say every 5 mins,

Now let's assume the app was running and not responding, I couldn't find any
API to "force quit" another application. Would a `kill -9 {process ID}` be
sufficient?
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Several Questions

2009-05-31 Thread Kyle Sluder
On Sun, May 31, 2009 at 11:08 AM, Ammar Ibrahim  wrote:
> This seems like a very doable approach. Anyhow, the daemon itself might
> crash, so I would go for a cron job that runs say every 5 mins,

We have launchd which already relaunches tasks that die.

--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: Several Questions

2009-05-31 Thread Gwynne Raskind

On May 31, 2009, at 2:08 PM, Ammar Ibrahim wrote:

Can you give us so more details? For example: What will the app do?
Your description is very strange, lol.

But indeed, you should create a normal cocoa app that do the stuff  
you

want to do (UI + the real stuff),
and a little daemon that checks every X minutes if the other app is
running:
  yes: ok, continue
  no: start app (log message? App was stopped)

Look at CFNotification and the distributed notification center (I  
thought
there was a Cocoa variant of that, but I can't seem to find it) for  
a way to
detect whether your app has hung. You could just do a ping/pong set  
of
question/reply notifications that your daemon sends to your app and  
gets a
reply. If the app is still running but there's no reply within a  
sensible

timeframe, something has gone wrong.

This seems like a very doable approach. Anyhow, the daemon itself  
might

crash, so I would go for a cron job that runs say every 5 mins,

Now let's assume the app was running and not responding, I couldn't  
find any
API to "force quit" another application. Would a `kill -9 {process  
ID}` be

sufficient?


The Cocoa variant of the distributed notification is  
NSDistributedNotificationCenter :).


"kill -9 {process ID}" is shell-ese for the POSIX call kill(2) with a  
parameter of SIGKILL:


NAME
 kill -- send signal to a process

SYNOPSIS
 #include 

 int
 kill(pid_t pid, int sig);

The rest of the manpage has more info if you need it.

Note that OS X's Force Quit command doesn't send SIGKILL immediately;  
I believe it sends SIGINT and SIGQUIT before resorting to SIGKILL,  
since a process can trap SIGINT and SIGQUIT, use them to perform  
emergency cleanup before dying, or even just ignore them completely.  
SIGKILL can not be trapped, caught, ignored, or otherwise stopped from  
terminating the process.


-- Gwynne

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Several Questions

2009-05-31 Thread Uli Kusterer

Am 31.05.2009 um 20:27 schrieb Gwynne Raskind:
The Cocoa variant of the distributed notification is  
NSDistributedNotificationCenter :).



 I thought so, but it wasn't in NSNotification.h when I looked there,  
and there was no NSDistributedNotification.h. Figures that  
NSDistributedNotificationCenter.h is where it was at :-/


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: Cocoa-dev Digest, Vol 6, Issue 811

2009-05-31 Thread Caleb Strockbine

On May 31, 2009, at 6:15 AM, erg_consult...@yahoo.com wrote:


Ok so more specifically I should have asked:

How do I get the NSSplitView to restore the divider position when my  
app relaunches the next time?


I set the autosave name but when I drag the splitter, then quit and  
relaunch, it's still in the default position, not the position it  
was in when I quit.



It would help if you'd post some code that displays the problem --  
autosaving certainly works for me whether I call -setAutosaveName: in  
code or just set the name in IB. However, it sounds like you're  
calling -setAutosaveName: late in your app, and then not hitting the  
spot where it gets called when you run the app the second time. The  
method will set the position of the splitter as soon as you call it,  
but it obviously can't load the saved position until you've set the  
name that the data was saved under.


Try either setting the autosave name in IB or calling - 
setAutosaveName: immediately after you create the split view. And, in  
case it's not obvious, you certainly have to pass it the same name.


-Caleb
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Hidden API?

2009-05-31 Thread Pierce Freeman
Hi Everyone:

I am wondering if the method that the iWork apps use to add themselves to
the dock (after install, they add themselves to the dock) requires a private
API.  I am looking into a way to use this method not to add icons but to do
some quick preference switching of the dock without relaunching it.


Sincerely,

Pierce Freeman


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


[Moderator] Re: Hidden API?

2009-05-31 Thread Scott Anguish


On 2009-05-31, at 12:58 PM, Pierce Freeman wrote:


Hi Everyone:

I am wondering if the method that the iWork apps use to add  
themselves to
the dock (after install, they add themselves to the dock) requires a  
private
API.  I am looking into a way to use this method not to add icons  
but to do

some quick preference switching of the dock without relaunching it.



There is no public API for that. And discussing private API here isn't  
allowed.


I'm unlikely to be able to stem the flow of "you shouldn't do that  
anyway" email's you'll be getting about the very request.




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


[Moderator] Re: Nike+iPod Settings Undocumented?

2009-05-31 Thread Scott Anguish


On 2009-05-31, at 10:03 AM, Chunk 1978 wrote:


i can't seem to find documentation on how to disable preference
specifiers based on PSToggleSwitchSpecifier current setting.  an
example is the Nike+iPod's settings.  activating the app will enable
the remaining settings to be configured, while they are grayed
out/disabled if the app is not active.

anyone have any information on this?  or even how to create special
views (again, like Nike+iPod's settings for Sensor and Remote)


I don't believe this is public, and discussion of private API isn't  
allowed on this list.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSAttributedString -size Crash

2009-05-31 Thread Seth Willits



For some reason that I have yet to discover, calling - 
[NSAttributedString size] is causing a crash. It's rare, but it's  
happening. I can't yet repeat it on my system.




Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0010

Thread 0 Crashed:
0   com.apple.CoreText	0x9532d56e  
CFTLine::CFTLine(__CFString const*, adopted_t const&) + 16
1   com.apple.CoreText	0x9530c2a3 CTTypesetterCreateLine +  
129
2   com.apple.AppKit  	0x95efbabc -[NSATSLineFragment  
layoutForStartingGlyphAtIndex:characterIndex:minPosition:maxPosition:lineFragmentRect 
:] + 965
3   com.apple.AppKit  	0x95efa539 -[NSATSTypesetter  
_layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext 
:] + 2651
4   com.apple.AppKit  	0x95f32e13 -[NSATSTypesetter  
layoutParagraphAtPoint:] + 155
5   com.apple.AppKit  	0x95edb579 -[NSTypesetter  
_layoutGlyphsInLayoutManager:startingAtGlyphIndex:maxNumberOfLineFragments:maxCharacterIndex:nextGlyphIndex:nextCharacterIndex 
:] + 2974
6   com.apple.AppKit  	0x964c8562 -[NSTypesetter  
layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments 
:] + 218
7   com.apple.AppKit  	0x96243d98 -[NSATSTypesetter  
layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments 
:] + 599
8   com.apple.AppKit  	0x95f309af - 
[NSLayoutManager(NSPrivate)  
_fillLayoutHoleForCharacterRange:desiredNumberOfLines:isSoft:] + 1024
9   com.apple.AppKit  	0x95f47700 - 
[NSLayoutManager(NSPrivate)  
_fillLayoutHoleAtIndex:desiredNumberOfLines:] + 261
10  com.apple.AppKit  	0x95f3e9be  
_NSFastFillAllLayoutHolesUpToEndOfContainerForGlyphIndex + 624
11  com.apple.AppKit  	0x95f3e569 -[NSLayoutManager  
textContainerForGlyphAtIndex:effectiveRange:] + 128
12  com.apple.AppKit  	0x95f3e400 -[NSLayoutManager  
glyphRangeForTextContainer:] + 307
13  com.apple.AppKit  	0x95f6e433 - 
[NSStringDrawingTextStorage usedRectForTextContainer:] + 153
14  com.apple.AppKit  	0x95eed172 - 
[NSAttributedString(NSExtendedStringDrawing)  
boundingRectWithSize:options:] + 2044
15  com.apple.AppKit  	0x95fcfa5f - 
[NSAttributedString(NSStringDrawing) size] + 68
16  com.my.app	  	0x0007392c -[AQColumnTokenCell  
cellSize] + 46
17  com.my.app	  	0x00071cb9 -[AQColumnListView  
cellFrameForColumnIndex:] + 181
18  com.my.app	  	0x00072c07 -[AQColumnListView  
drawRect:] + 262
19  com.apple.AppKit  	0x95f8529c -[NSView  
_drawRect:clip:] + 3853
20  com.apple.AppKit  	0x95f83d93 -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1050
21  com.apple.AppKit  	0x95f8412a -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
22  com.apple.AppKit  	0x95f8412a -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
23  com.apple.AppKit  	0x95f8412a -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
24  com.apple.AppKit  	0x95f8412a -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
25  com.apple.AppKit  	0x95f8412a -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
26  com.apple.AppKit  	0x95f8412a -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
27  com.apple.AppKit  	0x95f8412a -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
28  com.apple.AppKit  	0x95f8412a -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1969
29  com.apple.AppKit  	0x95f826e9 -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 759
30  com.apple.AppKit  	0x95f8202b -[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 306
31  com.apple.AppKit  	0x95f7eb4f -[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] +  
3090
32  com.apple.AppKit  	0x95ebf523 -[NSView  
displayIfNeeded] + 933
33  com.apple.AppKit  	0x95f71c61 -[NSWindow  
_setFrameCommon:display:stashSize:] + 2031
34  com.apple.AppKit  	0x95f7146a -[NSWindow  
setFrame:display:] + 78
35  com.apple.AppKit  	0x95fc4469 -[NSMoveHelper  
_stopAnimation] + 637
36  com.apple.AppKit  	0x96120776 -[NSMoveHelper  
_doAnimation] + 1048
37  com.apple.AppKit  	0x9619f4b0 -[NSMoveHelper  
_resizeWindow:toFrame:display:] + 407
38  com.apple.AppKit  	0x95fac71e -[NSWindow  
setFrame:display:animate:] + 1038
39  com.my.app	  	0x0006b1fa -[AQImportPanel(Private)  
p_displayColumnMappingView] + 1860
40  com.apple.AppKit  	0x95f8e53b -[NSApplication  
sendAction:to:from:] + 112
41  c

Re: NSAttributedString -size Crash

2009-05-31 Thread Kyle Sluder
On Sun, May 31, 2009 at 3:36 PM, Seth Willits  wrote:
> If [self title] were nil, I'd get an exception when creating the attributed
> string, not a crash when calling -size. There's nothing fancy going on with

Not on Leopard you don't.  You do get a warning, but not an exception.
 This is the warning:

-[NSConcreteAttributedString initWithString:] called with nil string
argument. This has undefined behavior and will raise an exception in
post-Leopard linked apps. This warning is displayed only once.

--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: Several Questions

2009-05-31 Thread Greg Guerin

Gwynne Raskind wrote:

Note that OS X's Force Quit command doesn't send SIGKILL  
immediately; I believe it sends SIGINT and SIGQUIT before resorting  
to SIGKILL, ...



On 10.4 and 10.5, it sends SIGTERM before resorting to SIGKILL.

In some earlier OS version, SIGINT may have been used instead of  
SIGTERM.  I'd have to bring up an old machine to find out.


I don't recall SIGQUIT ever being used for Force Quit, but I could be  
wrong.  If ever it was, it was in Elder Days.


  -- GG

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSAttributedString -size Crash

2009-05-31 Thread Joar Wingfors


On 31 maj 2009, at 15.36, Seth Willits wrote:

For some reason that I have yet to discover, calling - 
[NSAttributedString size] is causing a crash. It's rare, but it's  
happening. I can't yet repeat it on my system.




If [self title] were nil, I'd get an exception when creating the  
attributed string, not a crash when calling -size. There's nothing  
fancy going on with the string. The only thing I can think of is  
that this drawing and call to -size is happening while the window is  
resizing caused by a simple call to -[NSWindow  
setFrame:display:animate:].



Is it at all possible that this is the result of some sort of thread  
unsafe operation in your app?


j o a r


___

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

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

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

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


Re: [ NSSplitview ] -setAutosaveName

2009-05-31 Thread Erg Consultant
Where is it documented? Other than the scant listings for 

setAutosaveName: and 

autosaveName:
I see no discussion as to what they actually do or how to use them.




From: Jim Correia 
To: cocoa-dev@lists.apple.com
Sent: Sunday, May 31, 2009 6:19:13 AM
Subject: Re: [ NSSplitview ] -setAutosaveName

On Sat, May 30, 2009 at 11:22 PM, Erg Consultant
 wrote:

> What does setAutosaveName actually do? I assume it saves the position of the 
> splitview to user defaults?

The behavior is documented, succinctly, here:

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/nssplitview_Class/Reference/Reference.html#//apple_ref/occ/instm/NSSplitView/setAutosaveName:

> If so, how does one retrieve that value?

You typically don't, since the actual key and format of the data is a
private implementation detail. NSSplitView will restore the geometry
for you automatically.

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/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: NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing

2009-05-31 Thread Erg Consultant
Because that is how code posted in the archives says to do it.

If I use NSImageCell or NSTextFieldCell (which I've tried), the icons never 
show up. Those work for NSTableView icons but not NSOutlineView icons.




From: Kyle Sluder 
To: Erg Consultant 
Cc: cocoa-dev@lists.apple.com
Sent: Sunday, May 31, 2009 12:55:28 AM
Subject: Re: NSTableViewSelectionHighlightStyleSourceList interferes with  
custom NSBrowserCell drawing

I guess my first question is, why are you using an NSBrowserCell for
this?  NSBrowserCell probably knows nothing about table view
highlighting styles, because its intended use is inside an NSMatrix
within an NSBrowser.

An image-and-text cell is not hard to create.  It can delegate its
drawing to an NSImageCell and NSTextFieldCell.

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


Problems choosing an encoding for Word generated html

2009-05-31 Thread Ken Tozier

Hi

I wrote an app that converts Word files into a simpler format by first  
converting from .doc to html using scripting and Word's "Save as Web  
page" command followed by using NSXMLDocument to extract the parts I  
need. I'm finding that there are no good options when it comes to  
choosing a character encoding for the saved html (this is set in Word)  
because it uses some custom tags to embed special characters like  
bullets and that UTF-8 chokes on.


My basic process is to
- Use Applescript to tell Word to convert from .doc to html and save  
as utf-8

- Read the resultant file into an NSString with NSUTF8StringEncoding

I've tried saving the html from Word as NSLatin1Encoding but many  
important characters like double-quotes, apostrophes, dashes etc are  
translated to cap "O's" with various diacritical marks.


Not really sure how to proceed as there doesn't seem to be a single  
encoding useable by NSString that will both translate the quotes and  
allow me to access Word's "special" characters. Anyone have any ideas  
how I can read the html and treat it as a mostly normal character  
string without resorting to a custom binary  character translation  
class?


Thanks for any help
___

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

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

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

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


Re: NSAttributedString -size Crash

2009-05-31 Thread Seth Willits

On May 31, 2009, at 3:45 PM, Kyle Sluder wrote:

On Sun, May 31, 2009 at 3:36 PM, Seth Willits   
wrote:
If [self title] were nil, I'd get an exception when creating the  
attributed
string, not a crash when calling -size. There's nothing fancy going  
on with


Not on Leopard you don't.  You do get a warning, but not an exception.
This is the warning:

-[NSConcreteAttributedString initWithString:] called with nil string
argument. This has undefined behavior and will raise an exception in
post-Leopard linked apps. This warning is displayed only once.



Alright, well, either way I know it's not happening because it's not  
in the console log.





On May 31, 2009, at 3:49 PM, Joar Wingfors wrote:

If [self title] were nil, I'd get an exception when creating the  
attributed string, not a crash when calling -size. There's nothing  
fancy going on with the string. The only thing I can think of is  
that this drawing and call to -size is happening while the window  
is resizing caused by a simple call to -[NSWindow  
setFrame:display:animate:].


Is it at all possible that this is the result of some sort of thread  
unsafe operation in your app?


Only if clicking on a button is not thread-safe. :-\

That's the only way this code could be triggered.


--
Seth Willits



___

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

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

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

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


Re: NSAttributedString -size Crash

2009-05-31 Thread Joar Wingfors


On 31 maj 2009, at 16.08, Seth Willits wrote:


On May 31, 2009, at 3:49 PM, Joar Wingfors wrote:

If [self title] were nil, I'd get an exception when creating the  
attributed string, not a crash when calling -size. There's nothing  
fancy going on with the string. The only thing I can think of is  
that this drawing and call to -size is happening while the window  
is resizing caused by a simple call to -[NSWindow  
setFrame:display:animate:].


Is it at all possible that this is the result of some sort of  
thread unsafe operation in your app?


Only if clicking on a button is not thread-safe. :-\\
That's the only way this code could be triggered.



I was not thinking so much about the snippet of code that you posted,  
I was more curious to know if you have something else running in the  
background in your app, updating your UI / model in a non-thread safe  
way. So to rephrase the question: Are you doing any background work in  
your app at all, and if so, how sure are you that you're doing that in  
a thread safe way?


If you come to the conclusion that this is more likely to be a bug in  
AppKit than in your code, please file a bug report!




j o a r


___

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

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

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

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


Re: NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing

2009-05-31 Thread Kyle Sluder
On Sun, May 31, 2009 at 4:04 PM, Erg Consultant
 wrote:
> Because that is how code posted in the archives says to do it.

Where is this code?  In any event, it's wrong.  It's a convenient
shortcut if NSBrowserCell draws the way you want it to, but obviously
it doesn't.

> If I use NSImageCell or NSTextFieldCell (which I've tried), the icons never 
> show up. Those work for NSTableView icons but not NSOutlineView icons.

That's why I said you need to use your own cell class.  You can make
one that simply uses a "child" NSImageCell and "child" NSTextCell to
do its drawing.

--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: NSAttributedString -size Crash

2009-05-31 Thread Kyle Sluder
On Sun, May 31, 2009 at 4:08 PM, Seth Willits  wrote:
> Alright, well, either way I know it's not happening because it's not in the
> console log.

You don't know it's not nil unless you check yourself.  Set a
conditional breakpoint; it's the only real way to reason about your
code.

And FWIW, click a button isn't threadsafe.  AppKit on the whole, with
few and documented exceptions, isn't threadsafe.

--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: [ NSSplitview ] -setAutosaveName

2009-05-31 Thread Kyle Sluder
On Sun, May 31, 2009 at 4:02 PM, Erg Consultant
 wrote:
> Where is it documented? Other than the scant listings for

Why are you setting the split view's autosave name in code?
99.(completely arbitrary number of 9's)% of the time you set it once
in IB.  That way it has the autosave name when it's unfrozen from the
nib, and can set itself up accordingly.

It sounds like you expect -setAutosaveName: to cause the split view to
load its settings from user defaults and resize itself.  It probably
doesn't do this because the most common (indeed, almost always
appropriate) scenario is for -setAutosaveName: to be called at design
time, within IB.

Go ahead and file a doc bug on -setAutosaveName: anyway.  Either the
reference or the conceptual docs should explain when the autosaved
settings are restored.

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


Discovering the default font names and sizes on the iPhone

2009-05-31 Thread Sam Krishna

Hi All,

I'm cross-posting this to both the Xcode and cocoa-dev mailing lists,  
since I am stumped and I suspect one of you have answered this  
question before:


I want to discover the default font used for UITableView's section  
header view when you set the style to UITableViewStyleGrouped. I'm  
attempting to implement a custom section header view and I have  
everything working *except* for this one font.


Here are my questions:

(1) How do I discover the font? I have tried The Mighty Google and  
experimented with some different font families, but nothing seems to  
really come close to the default font. If anyone has a process they  
can point me towards, that would be awesome. (Also, the Mighty iPhone  
HIG was useless in terms of *naming* the font family and size -- and  
no, it's not the boldSystemFont)


(2) If (1) can't be answered, what is the default section header view  
font? Does anyone just simply have the knowledge?


TIA!

Live Playfully,

Sam
-
If he listens in faith,
finding no fault, a man is free
and will attain the cherished words
of those who act in virtue.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Nike+iPod Settings Undocumented?

2009-05-31 Thread Clark Cox
On Sun, May 31, 2009 at 10:03 AM, Chunk 1978  wrote:
> i can't seem to find documentation on how to disable preference
> specifiers based on PSToggleSwitchSpecifier current setting

You will be much more likely to get much better answers if you take
this to the appropriate venue:


-- 
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

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


Re: Discovering the default font names and sizes on the iPhone

2009-05-31 Thread Sam Krishna

Hi All,

Never mind - I forgot to set the UILabel's font before setting the  
text value. DOH!


Thanks for listening.

Live Playfully,

Sam
-
If he listens in faith,
finding no fault, a man is free
and will attain the cherished words
of those who act in virtue.

On May 31, 2009, at 7:46 PM, Sam Krishna wrote:


Hi All,

I'm cross-posting this to both the Xcode and cocoa-dev mailing  
lists, since I am stumped and I suspect one of you have answered  
this question before:


I want to discover the default font used for UITableView's section  
header view when you set the style to UITableViewStyleGrouped. I'm  
attempting to implement a custom section header view and I have  
everything working *except* for this one font.


Here are my questions:

(1) How do I discover the font? I have tried The Mighty Google and  
experimented with some different font families, but nothing seems to  
really come close to the default font. If anyone has a process they  
can point me towards, that would be awesome. (Also, the Mighty  
iPhone HIG was useless in terms of *naming* the font family and size  
-- and no, it's not the boldSystemFont)


(2) If (1) can't be answered, what is the default section header  
view font? Does anyone just simply have the knowledge?


TIA!



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Showing more warnings possible in Xcode?

2009-05-31 Thread Graham Cox


On 31/05/2009, at 11:38 AM, Gwynne Raskind wrote:

Not to mention I haven't yet figured out a way to apply  
__attribute__((unused)) to an ObjC method parameter. I just get a  
pile of syntax errors, or it gets applied to the function instead of  
the parameters.



Just use #pragma unused(parameter[,parameter2,...])

--Graham



___

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

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

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

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


Re: NSTableView setting row heights

2009-05-31 Thread Graham Cox


On 01/06/2009, at 1:33 AM, Peter Hudson wrote:


Any suggestions.



Post your code?

--Graham

___

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

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

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

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


Re: [ NSSplitview ] -setAutosaveName

2009-05-31 Thread Greg Guerin

Erg Consultant wrote:


I see no discussion as to what they actually do or how to use them.



The docs are concise to the point of opacity.

You'd have to infer the workings of NSSplitView from the way other  
views do auto-saving, e.g. NSTableView's setAutosaveName: .


http://developer.apple.com/documentation/Cocoa/Reference/ 
ApplicationKit/Classes/nstableview_Class/Reference/Reference.html#// 
apple_ref/occ/instm/NSTableView/setAutosaveName:


Found using google terms:
  cocoa setAutosaveName site:developer.apple.com

You might also want to scan this for "AutosaveName" or "NSSplitView":
  http://developer.apple.com/releasenotes/Cocoa/AppKit.html

  -- GG

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing

2009-05-31 Thread Nathan Kinsinger

On May 31, 2009, at 5:04 PM, Erg Consultant wrote:


Because that is how code posted in the archives says to do it.

If I use NSImageCell or NSTextFieldCell (which I've tried), the  
icons never show up. Those work for NSTableView icons but not  
NSOutlineView icons.




Have a look at the SourceView sample project, it has a custom  
ImageAndTextCell class used in an NSOutlineView.

http://developer.apple.com/samplecode/SourceView/index.html



--Nathan

http://brotherbard.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


[MEET] June CocoaHeads Mac Developer Meetings

2009-05-31 Thread Stephen Zyszkiewicz

Greetings,

CocoaHeads is an international Mac programmer's group. Meetings are  
free and open to the public. We specialize in Cocoa, but everything  
Mac programming related is welcome.


Upcoming meetings:
Australia
Melbourne- Thursday, June 11, 2009 18:00.

Germany
Aachen- Thursday, June 18, 2009 19:00.
Berlin- Thursday, June 11, 2009 19:00.
Munich- Thursday, June 18, 2009 20:00.

Saudi Arabia
Riyadh- Tuesday, June 9, 2009 20:00.

South Africa
Johannesburg- Thursday, June 11, 2009 18:30.

Spain
Madrid- Friday, June 26, 2009 15:30.

Sweden
Stockholm- Monday, June 1, 2009 19:00.

United States
Atlanta- Thursday, June 18, 2009 19:00.
Boston- Thursday, June 11, 2009 19:00.
Boulder- Thursday, June 4, 2009 19:00.
Colorado Springs- Thursday, June 11, 2009 19:00.
Des Monies- Thursday, June 11, 2009 19:00.
Fayetteville- Thursday, June 11, 2009 18:00.
Lake Forest- Wednesday, June 10, 2009 19:00.
Nashville- Thursday, June 11, 2009 19:00.
New York- Thursday, June 11, 2009 18:00.
Philadelphia- Thursday, June 18, 2009 19:00.
St. Louis- Saturday, June 27, 2009 14:00.


Some chapters may have yet to post their meeting for next month.  
Meeting times may change. Locations and more information here:

http://cocoaheads.org

Also be sure to check for an NSCoder Night in your area:
http://nscodernight.com/


Steve
Silicon Valley CocoaHeads
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


MSN preference

2009-05-31 Thread Joseph Yu
Hi

How to use Toolbar to create UI like Mac MSN preference?

Push the button,window changes.

Is there any sample code?

 

 

BR



***
The opinions and views expressed in this e-mail are solely those of the author 
and do not necessarily represent those of Qisda Corporation and its affiliates. 
Qisda Corporation is not responsible for any liability or damaged caused by 
viruses transmitted with this e-mail or its attachments. If this e-mail is not 
originally intended for you, or received by you in error, do not disclose its 
content to anyone and delete it immediately. This e-mail may contain 
information that is private, legally privileged, confidential or exempt from 
disclosure, and intended for the sole use of the intended recipient. Any 
review, copying, or distribution of this email (or any attachments thereto) by 
others is strictly prohibited. Thank you. 

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSXMLParser - howto resolve entities defined in DTD

2009-05-31 Thread Dominik Pich

Hi,
I use NSXMLParser to parse large XML files-- going good BUT :)
I cant get the parser to resolve the external entities from the DTD.

I googled and read documentation and older mails...
and I did set parser.shouldResolveExternalEntities = YES


I do get:
- (NSData *)parser:(AQXMLParser *)parser resolveExternalEntityName: 
(NSString *)name systemID:(NSString *)systemID

but I have no idea what to return...
the entities are defined in the DTD...

if I could get the folowing for the entries in the DTD, I would just  
build a table myself
- (void)parser:(AQXMLParser *)parser  
foundInternalEntityDeclarationWithName:(NSString *)name value: 
(NSString *)value;


Still, shouldnt NSXMLParser do entity substitution for me?
somehow... :)

In any case, I have no clue as to how to proceed



Dominik Pich
http://www.pich.info




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSTextFieldCell Subclass Not Showing Text

2009-05-31 Thread Colin Chivers
I'm subclassing NSTextFieldCell to display an icon (a favicon of a webpage,
to be specific) in the left end of the text field. The text field's cell is
set to my subclass in Interface Builder. When I start my application, the
icon is displayed, but the text that should be in the text field is not.
When the text field is in focus, it beeps every time you hit a key and
doesn't display the key you pressed. I've been trying to figure this out for
quite awhile to no avail. Here is the interface file:

@interface SBIconTextFieldCell : NSTextFieldCell {

NSImage *icon;

}

@property(nonatomic, retain) NSImage *icon;

@end

And this is the implementation file:

#import "SBIconTextFieldCell.h"


@implementation SBIconTextFieldCell

- (NSImage *)icon {

return icon;

}

- (void)setIcon:(NSImage *)newValue {

[icon release];

icon = [newValue retain];

[icon setFlipped:YES];

if (icon) [[self controlView] setNeedsDisplayInRect:NSMakeRect(2, 3, 16,
16)];

else [[self controlView] setNeedsDisplay:YES];

}

- (void)dealloc {

[icon release];

[super dealloc];

}

- (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView *)controlView {

   NSRect rect = NSMakeRect(2, 3, 16, 16);

if ([controlView needsToDrawRect:rect])

[icon drawInRect:rect fromRect:NSZeroRect operation:
NSCompositeSourceOver fraction:1];

if (icon) {

frame.origin.x += 16;

frame.size.width -= 16;

}

[super drawInteriorWithFrame:frame inView:controlView];

}

- (void)editWithFrame:(NSRect)rect inView:(NSView *)view
editor:(NSText*)text delegate:(
id)object

event:(NSEvent *)event {

if (icon) {

rect.origin.x += 16;

rect.size.width -= 16;

}

[super editWithFrame:rect inView:view editor:text delegate:object event
:event];

}

- (void)selectWithFrame:(NSRect)rect inView:(NSView *)view
editor:(NSText*)text delegate:(
id)object

  start:(NSInteger)start length:(NSInteger)length {

if (icon) {

rect.origin.x += 16;

rect.size.width -= 16;

}

[super selectWithFrame:rect inView:view editor:text delegate:object
start:start length:length];

}

@end

Does anyone have insight as to what I'm doing wrong?
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: MSN preference

2009-05-31 Thread Kyle Sluder
On Sun, May 31, 2009 at 7:14 PM, Joseph Yu  wrote:
> How to use Toolbar to create UI like Mac MSN preference?

Brandon Walkin's BWToolkit has some classes that are designed just for
this task, because there is no built-in functionality.
http://brandonwalkin.com/bwtoolkit/

--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: Several Questions

2009-05-31 Thread Chris Hanson

On May 30, 2009, at 11:18 PM, Ammar Ibrahim wrote:

On Sun, May 31, 2009 at 6:16 AM, Chris Hanson  wrote:

The best way to ensure your daemon or agent is always running is to  
have it

run via launchd.

Start by reading the launchd man page and the "Daemons and Agents"  
tech
note; these will give you an overview of how Mac OS X used launchd  
to manage

these types of on-demand and always-on services.


But my app is a "normal" Cocoa App, it's not a daemon or an agent.


It's still essentially an agent, just one that runs in the foreground,  
not the background.


You can use launchd to keep your app alive.  That way you, don't have  
to worry about adding code to your application to do it, you just have  
to ensure the launchd property list is in the right place.


That will also make development of your application easier, because  
your application can run normally; you won't have to put a bunch of  
extra code into it to disable its keep-alive behavior during  
development.


  -- Chris

___

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

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

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

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


Re: Several Questions

2009-05-31 Thread Todd Heberlein
You can use launchd to keep your app alive.  That way you, don't  
have to worry about adding code to your application to do it, you  
just have to ensure the launchd property list is in the right place.


So if in your launchd module you have the key-value pair:

KeepAlive


will launchd automatically restart the program when it exists no  
matter what the exit status is? I wasn't a 100% sure.


Todd

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Detecting a modal session.

2009-05-31 Thread Vijay Malhan
Is there any way to detect if an application is in modal session?
I am trying to fix (work around) a problem in Cocoa + Carbon application,
where Cocoa UI thread is not blocked(for some Cocoa views) when a modal
dialog is invoked from Carbon app.

Thanks,
Vijay
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Setting wantsLayer = YES; crashes on view load.

2009-05-31 Thread Kevin Ross
Hi everyone, I have a Core Data document based app that I've been  
working on for a while and I now want to change some of the view  
drawing to use CALayers.  The trouble I'm having is that when I set a  
view's wantsLayer = YES, I end up getting EXC_BAD_ACCESS.This  
happens when I try to set it on any arbitrary view in any of the nibs  
in my project, when setting it from code, or from clicking the  
checkbox in IB.  I've tried new CALayer projects from scratch and they  
work fine, is there something I could have done to my project that  
would prevent me from setting a view's wantsLayer property to YES?


Thank you for taking time to read this.

Kevin Ross


Stack Trace of crash:

#0  0x9129c688 in objc_msgSend ()
#1  0x91bbe7a6 in +[NSConcreteNotification  
newTempNotificationWithName:object:userInfo:] ()

#2  0x91bc158d in _nsnote_callback ()
#3  0x951fa64a in __CFXNotificationPost ()
#4  0x951fa923 in _CFXNotificationPostNotification ()
#5  0x951fac18 in CFNotificationCenterPostNotification ()
#6  0x9368250c in CARenderContextNew ()
#7  0x9365671a in -[CAContextImpl initWithOptions:] ()
#8  0x936823cf in +[CAContext localContextWithOptions:] ()
#9  0x93682386 in +[CAContext localContext] ()
#10 0x93682296 in CAViewCreate ()
#11 0x930643d0 in -[NSView(NSInternal) _createLayerTreeRenderer] ()
#12 0x930642ac in -[NSView(NSLayerKitGlue)  
_setUpLayerTreeRendererAndSurface] ()

#13 0x92df5e51 in -[NSView lockFocusIfCanDraw] ()
#14 0x92df58b1 in -[NSView lockFocus] ()
#15 0x92df9c4b in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#16 0x92dfa0ba in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#17 0x92dfa0ba in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#18 0x92dfa0ba in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#19 0x92dfa0ba in -[NSView  
_recursiveDisplayAllDirtyWithLockFocus:visRect:] ()
#20 0x92df8679 in -[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] ()
#21 0x92df7fbb in -[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] ()
#22 0x92df4adf in -[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] ()

#23 0x92d354b3 in -[NSView displayIfNeeded] ()
#24 0x92d35061 in -[NSWindow displayIfNeeded] ()
#25 0x92df0c37 in -[NSWindow  
_reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] ()

#26 0x92df0690 in -[NSWindow orderWindow:relativeTo:] ()
#27 0x92e2270d in -[NSWindow orderFront:] ()
#28 0x92d03503 in -[NSIBObjectData  
nibInstantiateWithOwner:topLevelObjects:] ()

#29 0x92cf9616 in loadNib ()
#30 0x92cf8f78 in +[NSBundle(NSNibLoading)  
_loadNibFile:nameTable:withZone:ownerBundle:] ()
#31 0x92cf8bbb in +[NSBundle(NSNibLoading)  
loadNibFile:externalNameTable:withZone:] ()

#32 0x92d38ed9 in -[NSWindowController loadWindow] ()
#33 0x92d38c72 in -[NSWindowController window] ()
#34 0x92d38b9a in -[NSWindowController showWindow:] ()
#35 0x92d38add in -[NSDocument showWindows] ()
#36 0x92d36da4 in -[NSDocumentController  
openUntitledDocumentAndDisplay:error:] ()

#37 0x92f229ea in -[NSDocumentController newDocument:] ()
#38 0x92e044cb in -[NSApplication sendAction:to:from:] ()
#39 0x92eb3108 in -[NSMenu performActionForItemAtIndex:] ()
#40 0x92eb2e0d in -[NSCarbonMenuImpl  
performActionWithHighlightingForItemAtIndex:] ()

#41 0x92eb2a93 in -[NSMenu performKeyEquivalent:] ()
#42 0x92eb1338 in -[NSApplication _handleKeyEquivalent:] ()
#43 0x92dce0fb in -[NSApplication sendEvent:] ()
#44 0x92d2b62f in -[NSApplication run] ()
#45 0x92cf8834 in NSApplicationMain ()






___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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