Getting mouse moved events on overlay windows

2008-06-30 Thread Markus Spoettl

Hello List,

  I have a WebView with a transparent overlay window + custom view  
"attached" it to allow for custom overlay drawing on top of what the  
WebView displays. This works very well.


However, I can't figure out a way to get -mouseMoved: messages on the  
overlay window's view. Tracking areas as well as -mouseMoved: messages  
(with setting acceptsMouseMovedEvents:YES on the overlay window) don't  
work because the overlay window is borderless (NSBorderlessWindowMask)  
and transparent and the framework does not send those messages to it.


So I thought, I go through a WebView subclass, establishing the  
tracking area there and forward the mouse messages to the overlay  
window and its view manually. Unfortunately this doesn't work either  
because the tracking area events are only firing if there is no overlay.


The overlay view does get -mouseDown:, -mouseUp: and -mouseDragged:  
events, but not -mouseMoved:. I'm pretty out of ideas, how can I get - 
mouseMoved: messages on the overlay window?


Thanks for any input!

Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Implementing NSOutlineView autosaveExpandedItems with CoreData

2008-06-30 Thread Ian


On 1 Jul 2008, at 04:41, Andy Kim wrote:


Hi Ian,

I've got a CoreData object graph with an outline view showing  
instances of an NSManagedObject subclass called "Group".
The Group class has the standard to-one relation 'parent' and to- 
many 'children'.

The outline view is working perfectly.

I've set autosaveExpandedItems to YES and when I expand or unexpand  
(contract?) a group my outline view's data source gets sent the  
persistentObjectForItem message.


Collapse is the word used in the docs.

I can see in the prefs plist for my app that the expanded Group  
itmes are being saved, and when my application launches, the  
outline view's data source object gets sent the  
itemForPersistentObject message.


Below is what I'm doing for each of these messages:

- (id)outlineView:(NSOutlineView*)outlineView  
persistentObjectForItem:(id)item

{
NSNumber *uid=[[item representedObject] valueForKeyPath:@"uid"];
id archivedObject=[NSKeyedArchiver archivedDataWithRootObject:uid];
return archivedObject;
}

- (id)outlineView:(NSOutlineView *)outlineView  
itemForPersistentObject:(id)object

{
NSNumber *uid=[NSKeyedUnarchiver unarchiveObjectWithData:object];
NSManagedObjectContext *context=[self managedObjectContext];
NSFetchRequest *request=[[NSFetchRequest alloc] init];
	NSEntityDescription *groupEntityDescription=[NSEntityDescription  
entityForName:@"Group" inManagedObjectContext:context];

[request setEntity:groupEntityDescription];
	NSPredicate *predicate=[NSPredicate predicateWithFormat:@"uid== 
%@",uid];

[request setPredicate:predicate];
NSError *error;
	NSArray *fetchResults=[context executeFetchRequest:request  
error:&error];

if ([fetchResults count])
return [fetchResults objectAtIndex:0];
return nil;
}


The request object is not being released.


Thanks - that one slipped my notice.




The persistentObjectForItem method successfully archives and  
returns the 'uid' property for the item's represented object - this  
is a unique identifier for each of my Groups.


The itemForPersistentObject successfully reconstitutes the archived  
uid and correctly finds the Group with the unique 'uid' property  
and returns it.


Expanded items in the outline view are not being restored however.

Is itemForPersistentObject expecting me to return something else?
My guess would be that it was expecting an instance of NSTreeNode,  
since this is what I first got as 'item' in persistentObjectForItem.

Sadly though, I can't see a way to get an NSTreeNode from an object.
I have [item representedObject] for archival, but not [object  
representingItem], if you see what I mean.


Obviously I've tried returning an the 'item' archived but it  
doesn't respond to archiving.
Neither (obviously) does my NSManagedObject subclass... should I  
implement archiving in my subclass to get this to work?


Does anyone have any clue they can distribute my way? (citation: 
http://www.bofhcam.org/co-larters/distributing-clue/index.html)
I've seen lots in the usual places (lists.apple.com,  
cocoabuilder.com et al) about this but no actual solutions shout  
out at me. Perhaps I'm not looking hard enough. (most likely).


Many TIA
Ian


I have this working in my app and I'm doing almost exactly the same  
thing. I'm also using the UID as the persistent object so you don't  
have to return an archived version of your whole model object or the  
tree node.


I would check two things:

1. Are you setting the autosaveName to the outline view?


Yeah - I can se it in my app's prefs plist.




2. Maybe the outline view is trying to restore the expanded state  
before your tree controller has content? You said  
itemForPersistentObject returns the correct Group, but this actually  
happened to me before, so just making sure :)


No, it's fine:

(gdb) po fetchResults
<_PFArray 0x711bb90>(
 (entity: Group; id: 0x1dd560 > ; data: )

)





Beyond those two, if you still can't figure out why it's not  
working, saving and restoring expanded state of an outline view is a  
trivial task. I use the following bit of code in an NSOutlineView  
subclass to do just that:


- (id)expandedState
{
NSMutableArray *state = [NSMutableArray array];
NSInteger count = [self numberOfRows];
for (NSInteger row = 0; row < count; row++) {
id item = [self itemAtRow:row];
if ([self isItemExpanded:item])
			[state addObject:[[self dataSource] outlineView:self  
persistentObjectForItem:item]];

}
return state;
}

- (void)setExpandedState:(id)state
{
if ([state isKindOfClass:[NSArray class]] == NO) return;

// Collapse everything first
[self collapseItem:nil collapseChildren:YES];

for (id pobj in state) {
		[self expandItem:[[self dataSource] outlineView:self  
itemForPersistentObject:pobj]];

}
}

You can use those two methods to save the e

Re: Alternative to NSDate's dateWithNaturalLanguageString: ?

2008-06-30 Thread David Arve


On Jun 30, 2008, at 5:14 PM, Jens Alfke wrote:



On 30 Jun '08, at 12:29 AM, David Arve wrote:


sqlite3_bind_int(sql_statement, 1, one_week);


Shouldn't that be sqlite3_bind_double? The variable one_week is  
declared as double, and I'm pretty sure that seconds-since-1970  
intervals are soon going to overflow a (signed) 32-bit int, if they  
haven't already.


Erhm, yeah sloppy copy-paste that went wrong.




Is there a better way for me to get e.g. the dates from my database  
from

this week, this month etc.?


Look at "Calendars" in the "Date & Time Programming Guide For  
Cocoa", which describes how to do manipulations with calendar dates.  
In a nutshell, you can find the beginning of the week by getting the  
current date/time, then breaking it into components and setting the  
day-of-week plus hour/minute/second to zero, then converting back to  
NSDate. Then you can call -timeIntervalSince1970.


(I'd give you an example, but my own code that does this uses the  
deprecated NSCalendarDate class. I haven't used NSCalendar myself,  
yet.)


—Jens


Thanks!

/David

___

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

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

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

This email sent to [EMAIL PROTECTED]


Problem in Custom Window

2008-06-30 Thread Adil Saleem
Hi,
 
I have implemented a custom shaped window using technique described in sample 
code RoundTransparentWindow (make a borderless transparent window and place 
your image  using a customview on it).
 
It works quite fine when there are no controls on it. However, i am facing 
problem when i place a ComboBox in it.
 
The problem is that when i click on the combo to drop down the items in it, the 
window automatically gets dragged to a new position which is at quite a 
distance from the original position. It is very annoying for the users. They 
click the combo box and the window gets itself dragged.
 
The same problem also appears sometimes with TableView. 
 
Please guide me what can i do to remedy it.
 
Thanx




___

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

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

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

This email sent to [EMAIL PROTECTED]


Problem in Custom Shaped Window

2008-06-30 Thread Adil Saleem
Hi,I have implemented a custom shaped window using technique described in 
sample code RoundTransparentWindow (make a borderless transparent window and 
place your image  using a customview on it). It works quite fine when there are 
no controls on it. However, i am facing problem when i place a ComboBox 
it.  The problem is that when i click on the combo 
box to drop down the items in it, the window automatically gets dragged to a new position which is at quite a distance from the origianl position. It is very annoying for the users. They click the combo box and the window gets itself dragged
 The same problem also appears sometimes with TableView. Please guide me what 
can i do to remedy it.Thanx



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Flowcharts in Cocoa

2008-06-30 Thread Graham Cox
To be honest this is rather a large and open-ended question, a bit  
like "how do I program a computer?" ;-)


Depending on what you want to do you might find a framework such as my  
own DrawKit useful, though I have to warn you it's probably not ideal  
for complete beginners with Cocoa. It will however handle much of the  
basic creation (interactively) of objects in a drawing which could  
well be a large part of what a flowcharting program would need to do.  
You would, of course, be left with the task of turning those basic  
objects into specific types that knew about flowcharting and  
implementing a suitable data model for that.


http://apptree.net/drawkitmain.htm

If you do decide to go this route, you'll get a lot of help from  
myself and others with specific points on the DK mailing list, and  
general cocoa-related questions on this list.


hth,


cheers, Graham


On 1 Jul 2008, at 1:23 pm, Matt Orr wrote:


Hi guys!
I am very new to Cocoa, but not new to UNIX development. GUI  
programming is

new to me, and I am tackling it heavily ;)

I have a little assignment at work to create a simple application  
which

charts a bunch of processes, much like OmniGraffle (
http://www.omnigroup.com/applications/omnigraffle/). I was wondering  
how
such graphing was implemented, and more importantly, where to read.  
I went
through the 3rd edition of Cocoa Programming for Mac OS X, but I  
still dont

have any ideas on how to start implementing such a beast.
Can you please point me to potential topics and aspects of Cocoa I  
should

research? I have played a little bit with quartz, but it seems too
complicated (or is it?) of a solution for the simple thing I am  
trying to

achieve.

Any input is much appreciated!


Matt
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Implementing NSOutlineView autosaveExpandedItems with CoreData

2008-06-30 Thread Andy Kim

Hi Ian,

I've got a CoreData object graph with an outline view showing  
instances of an NSManagedObject subclass called "Group".
The Group class has the standard to-one relation 'parent' and to- 
many 'children'.

The outline view is working perfectly.

I've set autosaveExpandedItems to YES and when I expand or unexpand  
(contract?) a group my outline view's data source gets sent the  
persistentObjectForItem message.


Collapse is the word used in the docs.

I can see in the prefs plist for my app that the expanded Group  
itmes are being saved, and when my application launches, the outline  
view's data source object gets sent the itemForPersistentObject  
message.


Below is what I'm doing for each of these messages:

- (id)outlineView:(NSOutlineView*)outlineView  
persistentObjectForItem:(id)item

{
NSNumber *uid=[[item representedObject] valueForKeyPath:@"uid"];
id archivedObject=[NSKeyedArchiver archivedDataWithRootObject:uid];
return archivedObject;
}

- (id)outlineView:(NSOutlineView *)outlineView  
itemForPersistentObject:(id)object

{
NSNumber *uid=[NSKeyedUnarchiver unarchiveObjectWithData:object];
NSManagedObjectContext *context=[self managedObjectContext];
NSFetchRequest *request=[[NSFetchRequest alloc] init];
	NSEntityDescription *groupEntityDescription=[NSEntityDescription  
entityForName:@"Group" inManagedObjectContext:context];

[request setEntity:groupEntityDescription];
	NSPredicate *predicate=[NSPredicate predicateWithFormat:@"uid== 
%@",uid];

[request setPredicate:predicate];
NSError *error;
	NSArray *fetchResults=[context executeFetchRequest:request  
error:&error];

if ([fetchResults count])
return [fetchResults objectAtIndex:0];
return nil;
}


The request object is not being released.

The persistentObjectForItem method successfully archives and returns  
the 'uid' property for the item's represented object - this is a  
unique identifier for each of my Groups.


The itemForPersistentObject successfully reconstitutes the archived  
uid and correctly finds the Group with the unique 'uid' property and  
returns it.


Expanded items in the outline view are not being restored however.

Is itemForPersistentObject expecting me to return something else?
My guess would be that it was expecting an instance of NSTreeNode,  
since this is what I first got as 'item' in persistentObjectForItem.

Sadly though, I can't see a way to get an NSTreeNode from an object.
I have [item representedObject] for archival, but not [object  
representingItem], if you see what I mean.


Obviously I've tried returning an the 'item' archived but it doesn't  
respond to archiving.
Neither (obviously) does my NSManagedObject subclass... should I  
implement archiving in my subclass to get this to work?


Does anyone have any clue they can distribute my way? (citation: 
http://www.bofhcam.org/co-larters/distributing-clue/index.html)
I've seen lots in the usual places (lists.apple.com,  
cocoabuilder.com et al) about this but no actual solutions shout out  
at me. Perhaps I'm not looking hard enough. (most likely).


Many TIA
Ian


I have this working in my app and I'm doing almost exactly the same  
thing. I'm also using the UID as the persistent object so you don't  
have to return an archived version of your whole model object or the  
tree node.


I would check two things:

1. Are you setting the autosaveName to the outline view?

2. Maybe the outline view is trying to restore the expanded state  
before your tree controller has content? You said  
itemForPersistentObject returns the correct Group, but this actually  
happened to me before, so just making sure :)


Beyond those two, if you still can't figure out why it's not working,  
saving and restoring expanded state of an outline view is a trivial  
task. I use the following bit of code in an NSOutlineView subclass to  
do just that:


- (id)expandedState
{
NSMutableArray *state = [NSMutableArray array];
NSInteger count = [self numberOfRows];
for (NSInteger row = 0; row < count; row++) {
id item = [self itemAtRow:row];
if ([self isItemExpanded:item])
			[state addObject:[[self dataSource] outlineView:self  
persistentObjectForItem:item]];

}
return state;
}

- (void)setExpandedState:(id)state
{
if ([state isKindOfClass:[NSArray class]] == NO) return;

// Collapse everything first
[self collapseItem:nil collapseChildren:YES];

for (id pobj in state) {
		[self expandItem:[[self dataSource] outlineView:self  
itemForPersistentObject:pobj]];

}
}

You can use those two methods to save the expanded state to the user  
defaults and then restore later on exactly when you need to.


- Andy Kim



smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lis

Flowcharts in Cocoa

2008-06-30 Thread Matt Orr
Hi guys!
I am very new to Cocoa, but not new to UNIX development. GUI programming is
new to me, and I am tackling it heavily ;)

I have a little assignment at work to create a simple application which
charts a bunch of processes, much like OmniGraffle (
http://www.omnigroup.com/applications/omnigraffle/). I was wondering how
such graphing was implemented, and more importantly, where to read. I went
through the 3rd edition of Cocoa Programming for Mac OS X, but I still dont
have any ideas on how to start implementing such a beast.
Can you please point me to potential topics and aspects of Cocoa I should
research? I have played a little bit with quartz, but it seems too
complicated (or is it?) of a solution for the simple thing I am trying to
achieve.

Any input is much appreciated!


Matt
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [MEET] CocoaHeads Mac Developer Meetings

2008-06-30 Thread Apparao Mulpuri
Hi Steve,

  Do you have any plans to conduct this type meets in India?

- Apparao Mulpuri.


On Mon, Jun 30, 2008 at 11:51 AM, Stephen Zyszkiewicz
<[EMAIL PROTECTED]> wrote:
> Greetings,
>
> We have a few new chapters!
>
> CocoaHeads is an international Mac programmer's group.  We specialize
> in Cocoa, but everything Mac programming related is welcome.
>
> Why Should I Attend?
> Meeting other Mac OS X developers in person is both fun and immensely
> useful. There's no better way to learn Cocoa or get help with problems
> than being around other people who are writing Mac software.
>
> We usually have several Cocoa experts hanging around that are happy to
> answer whatever questions they can. Bring your laptop and any code
> you're working on.
>
> Everyone is Welcome
> Meetings are free and open to the public. Feel free to drop in even if
> you've never attended or aren't currently using Cocoa. We usually have
> a few new faces, so don't worry about being the odd one out.
>
> Upcoming meetings:
> * Boulder, CO - Tuesday July 08, 2008 07:00 PM MDT.
> * Colorado Springs, CO - Thursday July 10, 2008 07:00 PM MST.
> * Detriot, MI - Thursday July 10, 2008 07:00 PM EST.
> * Des Moines, IA - Thursday July 10, 2008 07:00 PM CST.
> * Hong Kong - Thursday July 24, 2008 08:00 PM HKT.
> * London, UK - Monday July 09, 2007 06:30 PM GMT.
> * Minneapolis, MN - Thursday July 10, 2008 05:00 PM CST.
> * New York, NY - Thursday July 10, 2008 06:00 PM EST.
> * Provo, UT - Wednesday July 09, 2008 07:00 PM MST.
> * Pittsburgh, PA - Friday July 04, 2008 07:30 PM EST.
> * Osaka, Japan - Saturday July 14, 2007 01:00 PM JST.
> * St Louis, MO -  Saturday July 26, 2008 02:00 PM CST.
> * Silicon Valley, CA - Thursday July 10, 2008 07:30 PM PST.
> * Stockholm, Sweden - Monday June 30, 2008 07:00 PM CEST.
> * Toronto, ON - Tuesday July 08, 2008 06:30 PM EST.
>
>
> Please check the web site at  for more
> information including last-minute changes. Some chapters may have yet to
> post their meeting for this month.
>
>
> Steve
> CocoaHeads: Silicon Valley
> 
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/apparao.forums%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Alternative to NSDate's dateWithNaturalLanguageString: ?

2008-06-30 Thread Andrew Farmer

On 30 Jun 08, at 08:14, Jens Alfke wrote:

On 30 Jun '08, at 12:29 AM, David Arve wrote:


sqlite3_bind_int(sql_statement, 1, one_week);


Shouldn't that be sqlite3_bind_double? The variable one_week is  
declared as double, and I'm pretty sure that seconds-since-1970  
intervals are soon going to overflow a (signed) 32-bit int, if they  
haven't already.


time_t (seconds since 1970, signed 32-bit integer) doesn't overflow  
until early 2038 - at which point there is mass panic, riots in the  
streets, and blood raining from the skies, because a ton of protocols  
have the 32-bit width baked into them.


But it's safe for the next 30 years or so. Hopefully we'll all be  
using 64-bit systems by then.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data Entity Relationship -valueForKeyPath: question

2008-06-30 Thread Jamie Phelps
You're right. Someone off list pointed me in the right direction of
NSNumber's -isEqualToNumber: method. Sorry for the noise, everyone!
JP

On Mon, Jun 30, 2008 at 9:42 PM, Quincey Morris <[EMAIL PROTECTED]>
wrote:

>
> On Jun 30, 2008, at 19:01, Jamie Phelps wrote:
>
>  I have a Core Data entity Item with a relationship "transaction." (It's
>> actually a to-many relationship. I'll adjust the key when I migrate my Core
>> Data model.) My question is about KVC. Can anyone help me understand why the
>> following code always returns YES? I know for a fact that some of my Item
>> objects should return NO for this.
>>
>> -(BOOL)sold{
>>   return ([self valueForKeyPath:@"[EMAIL PROTECTED]"] > 0);
>> }
>>
>
> It's not a KVC issue. You called a method that returns a pointer, then you
> compared the pointer to 0 (nil). That's not what you meant to do.
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> http://lists.apple.com/mailman/options/cocoa-dev/jamierphelps%2Bcocoa-dev%40gmail.com
>
> This email sent to [EMAIL PROTECTED]<[EMAIL PROTECTED]>
>



-- 
::
Jamie Phelps
PO Box 12564
Fort Worth, TX 76110
(817) 673-0036
http://www.jamiephelps.com
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data Entity Relationship -valueForKeyPath: question

2008-06-30 Thread Quincey Morris


On Jun 30, 2008, at 19:01, Jamie Phelps wrote:

I have a Core Data entity Item with a relationship  
"transaction." (It's actually a to-many relationship. I'll adjust  
the key when I migrate my Core Data model.) My question is about  
KVC. Can anyone help me understand why the following code always  
returns YES? I know for a fact that some of my Item objects should  
return NO for this.


-(BOOL)sold{
   return ([self valueForKeyPath:@"[EMAIL PROTECTED]"] > 0);
}


It's not a KVC issue. You called a method that returns a pointer, then  
you compared the pointer to 0 (nil). That's not what you meant to do.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Core Data Entity Relationship -valueForKeyPath: question

2008-06-30 Thread Jamie Phelps
I have a Core Data entity Item with a relationship  
"transaction." (It's actually a to-many relationship. I'll adjust the  
key when I migrate my Core Data model.) My question is about KVC. Can  
anyone help me understand why the following code always returns YES? I  
know for a fact that some of my Item objects should return NO for this.


-(BOOL)sold{
return ([self valueForKeyPath:@"[EMAIL PROTECTED]"] > 0);
}

Thanks in advance!

Jamie
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: PDFDocument subclass with an undo manager

2008-06-30 Thread Graham Cox
It won't redo because when it performs the undo, it is calling - 
initWithData: directly, and I take it from this snippet that  
initWithData: isn't recording the undo.


You need to create a wrapper method for initWithData that contains the  
undo recording step, then make that method the target of the undo,  
something like:


- (void)myInitWithData:(NSData*) newData
{
	[[undoManager prepareWithInvocationTarget:self] myInitWithData:[self  
oldData]];

[self initWithData:newData];
}


hth,

cheers, Graham




On 1 Jul 2008, at 9:02 am, Kevin Ross wrote:

Hi everyone, I have a question that might seems a little silly.  I  
have a PDFDocument subclass which can perform page impositions.  I  
would also like to be able to undo the impositions.  In the methods  
I have this when I make the change to the PDF:


[[undoManager prepareWithInvocationTarget:self] initWithData:[self  
dataRepresentation]];

[self initWithData:(NSData *)newPDFData];


When I call -undo: later, it works, but I can't get it to -redo:

Is what I'm trying to do even possible this way ?  Is there a better  
way?


Thanks for any pointers and/or suggestions!!

Kevin
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Linking against /Dev/L/PrivateFrameworks/

2008-06-30 Thread Owen Yamauchi
I neglected to mention the specific error, but I figured there's only
one error one might see on an import line.

error: DevToolsCore/PBXFileType.h: No such file or directory

Owen
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [MEET] CocoaHeads Mac Developer Meetings

2008-06-30 Thread Scott Ellsworth
On Sun, Jun 29, 2008 at 11:21 PM, Stephen Zyszkiewicz
<[EMAIL PROTECTED]> wrote:
> CocoaHeads is an international Mac programmer's group.  We specialize
> in Cocoa, but everything Mac programming related is welcome.
>
> Upcoming meetings:

* Lake Forest, CA - Wednesday, July 09, 2008, 07:00 PM PST

Topic to be announced in a later email.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-06-30 Thread Ron Lue-Sang


On Jun 30, 2008, at 2:53 PM, Hamish Allan wrote:

On Mon, Jun 30, 2008 at 10:43 PM, Ron Lue-Sang <[EMAIL PROTECTED]>  
wrote:


Yes! infoForBinding is what you should use to implement the logic  
in #1.

[...]
2b) Implement the "read" logic yourself by implementing bind:.


What puzzles me is that NSTextField doesn't seem to do either of
these, yet still seems to know which key path to update after user
interaction.

Hamish



Yep, that's right. The bindings machinery uses a faster cache. The  
same way as bindable-view implementors are free to cache the binding  
information any way you like. You don't need to use infoForBinding,  
but it's the easiest solution to describe.



--
RONZILLA



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-06-30 Thread Michael Ash
On Mon, Jun 30, 2008 at 5:04 PM, Hamish Allan <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 30, 2008 at 3:56 PM, Michael Ash <[EMAIL PROTECTED]> wrote:
>
>> Although Apple's sample code shows overriding -bind:... to store
>> information about the new binding, it doesn't look like this is
>> necessary. You can simply use -infoForBinding: to obtain the info
>> dictionary, extract the bound object and key, and use that information
>> to update the model object. I'd assume this is what the Apple classes
>> do, and it seems to me to be a lot simpler than overriding -bind:...
>> to stash away a bunch of information that's already being stored for
>> you anyway.
>
> That would seem a pretty reasonable assumption, but it doesn't seem to
> be the case. At least, breakpoints on -[NSTextField infoForBinding:],
> -[NSControl infoForBinding:],  -[NSObject infoForBinding:] don't seem
> to trigger when the text field is edited; nor are messages logged from
> a subclass of NSTextField overriding -infoForBinding:.
>
> Any other ideas, anyone?

Well, this is irrelevant to the question of what *you* should do.
Using -infoForBinding: is simple and it works, so use it.

However, if you're curious about what Apple does, it shouldn't be too
hard to find out. You know one thing that happens reliably: your
model's key is set. So set up a test app, put a breakpoint on the
model's setter, then see what's calling it. The rest should follow
from there.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Table view tab order problem

2008-06-30 Thread Scott Ribe
Two table views with editable columns. On 10.4, tabbing works as I expected.
On 10.5, tabbing out of the last cell of a row always goes to the next table
view, not the next row of the current table view (when there is a next row).

Is there an easy way to fix this? Or do I really have to hook into
setObjectValue or textDidEndEditing and call editColumn:Row: from there???

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Process app.

2008-06-30 Thread Michael Hall


On Jun 30, 2008, at 3:44 PM, Ken Thomases wrote:


More techniques:

Technical Note TN2050: Observing Process Lifetimes Without Polling
http://developer.apple.com/technotes/tn/tn2050.html


Getting off-topic maybe but I did this from java.
For example...
CmdJHTML: terminated Firefox /Applications/Firefox.app pid = 3932640
CmdJHTML: launched Firefox /Applications/Firefox.app pid = 3.264063e+08

As you can see it is a bit off on getting the pid.
This was a 'real world' example of creating a Cocoa class from java  
on the fly...


public CocoaMonitor() {

if (initsel == nil) {   // Class setup complete?
if (createClassDefinition("CocoaMonitor","NSObject")) {
CocoaMonitor_class = getClass(getName());
}

I liked it enough I added it to my application as a normal  
'automation' type function. I was adding things of that sort in at  
the time.


I'm not familiar enough with loginwindow that I want to test with  
that though. So it may or may not work there.


А потом будет суп с котом!

Mike Hallhallmike at att dot net
http://www.geocities.com/mik3hall
http://sourceforge.net/projects/macnative



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: iPhone: Flip core animation performance with images in UIButtons

2008-06-30 Thread Richard Adams
Noted - thanks - I will come back in 11 days (or when appropriate)  
unless we feel cocoa for the iPhone is not for this list at that  
time.  If someone is able to point me in the direction of a legitimate  
source of help that I'm allowed to go to feel free to point me in the  
right direction.


Apologise for the transgression.

Richard

On Jul 1, 2008, at 12:02 AM, Michael Kaye wrote:


Richard,

Sorry but we can't discuss iPhone Development on this forum as the  
iPhone SDK is still under NDA...


Regards, Michael.

On 30 Jun 2008, at 23:53, Richard Adams wrote:


Hi All,

I'm in the process of learning Cocoa/Objective-C and I'm writing  
some stuff for the iPhone as an exercise.


I am writing a simple application based on the "Utility  
Application" iPhone Template with the latest SDK Beta 8.  This is a  
simple 2 view application with a routine called "toggleview" that  
sets up an animation between the 2 views to do a  
"UIViewAnimationTransitionFlipFromRight" transition.


The issue arrises when one view has lots of UIButtons (>40) WITH  
active background images set with code like .


[self setBackgroundImage:[UIImage imageNamed:@"blank_37.png"]  
forState:UIControlStateNormal];


Where "self" is a UIButton derived custom class.

As the number of buttons increases the animation processing slows  
down to the point that there is no animation and it approaches 2  
frames of animation - first frame and last frame (ie no perceived  
animation).


I have proved it is the images in the buttons because performance  
is great with just a background colour set (no images), I can also  
see the animation render at very low frame rates if I significantly  
increase the transition time, and performance increase the fewer  
buttons with images there are.



So my question is - given I don't want to reduce the number of  
buttons, and I want the images for eye candy reasons, is there  
anything I can do to improve performance of the core animation  
transition?


Tx

Richard

PS.  This is running in the simulator on an Intel Macbook Pro with  
2GB of memory and not iPhone natively (I couldn't get into the  
developer early access)



___

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

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

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


This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


[moderator] Re: iPhone: Flip core animation performance with images in UIButtons

2008-06-30 Thread Scott Anguish


On Jun 30, 2008, at 6:53 PM, Richard Adams wrote:

I'm in the process of learning Cocoa/Objective-C and I'm writing  
some stuff for the iPhone as an exercise.


As stated in the non-disclosure agreement you accepted when you  
registered for the iPhone program, you are not allowed to talk about  
the iPhone SDK publicly, or outside of your own organization. That  
includes this list.


From the list guidelines (mailed to new subscribers and posted here  
as often as tolerated)


Discussing NDA Projects (Snow Leopard and iPhone OS) and Private API


This list is not an appropriate forum for the discussion of issues  
that are covered by non-disclosure. This includes Snow Leopard and  
iPhone OS 2.0. Doing so will violate your NDA and the message will be  
forwarded to WWDR.


The discussion of Private API is also not appropriate for this list.  
Using private API is strongly discouraged as it can (and often does)  
change in future software revisions. If you feel some private API  
should be made public contact WWDR directly or file a bug using  
bugreporter.apple.com. Please do not advocate for those changes here,  
it isn't effective.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Connecting to non-standard HTTP ports with authorization

2008-06-30 Thread Jens Alfke


On 30 Jun '08, at 12:51 PM, Niklas Saers wrote:

In the HTTP header I get back from the server I cannot see a domain,  
but then again I cannot see a realm either. How do I find the  
domain? In NTLM authentication, is domain the same as the DNS  
domain, or is it the same as the domain windows computers in a  
domain there use?


I don't know anything about NTLM; sorry.

I'm trying to get this done within the Cocoa classes, though, so  
I'll have to figure out a way to translate from CFNetwork to regular  
Cocoa :-)


The Cocoa NSURL classes are built on top of the CFNetwork APIs, so  
there's quite likely a way to do this using Cocoa. I just don't know  
what it is.


You might try asking on the macnetworkprog list.

—Jens

___

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

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

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

This email sent to [EMAIL PROTECTED]


Implementing NSOutlineView autosaveExpandedItems with CoreData

2008-06-30 Thread Ian

Hi all,

I've got a CoreData object graph with an outline view showing  
instances of an NSManagedObject subclass called "Group".
The Group class has the standard to-one relation 'parent' and to-many  
'children'.

The outline view is working perfectly.

I've set autosaveExpandedItems to YES and when I expand or unexpand  
(contract?) a group my outline view's data source gets sent the  
persistentObjectForItem message.


I can see in the prefs plist for my app that the expanded Group itmes  
are being saved, and when my application launches, the outline view's  
data source object gets sent the itemForPersistentObject message.


Below is what I'm doing for each of these messages:

- (id)outlineView:(NSOutlineView*)outlineView persistentObjectForItem: 
(id)item

{
NSNumber *uid=[[item representedObject] valueForKeyPath:@"uid"];
id archivedObject=[NSKeyedArchiver archivedDataWithRootObject:uid];
return archivedObject;
}

- (id)outlineView:(NSOutlineView *)outlineView itemForPersistentObject: 
(id)object

{
NSNumber *uid=[NSKeyedUnarchiver unarchiveObjectWithData:object];
NSManagedObjectContext *context=[self managedObjectContext];
NSFetchRequest *request=[[NSFetchRequest alloc] init];
	NSEntityDescription *groupEntityDescription=[NSEntityDescription  
entityForName:@"Group" inManagedObjectContext:context];

[request setEntity:groupEntityDescription];
	NSPredicate *predicate=[NSPredicate predicateWithFormat:@"uid== 
%@",uid];

[request setPredicate:predicate];
NSError *error;
	NSArray *fetchResults=[context executeFetchRequest:request  
error:&error];

if ([fetchResults count])
return [fetchResults objectAtIndex:0];
return nil;
}

The persistentObjectForItem method successfully archives and returns  
the 'uid' property for the item's represented object - this is a  
unique identifier for each of my Groups.


The itemForPersistentObject successfully reconstitutes the archived  
uid and correctly finds the Group with the unique 'uid' property and  
returns it.


Expanded items in the outline view are not being restored however.

Is itemForPersistentObject expecting me to return something else?
My guess would be that it was expecting an instance of NSTreeNode,  
since this is what I first got as 'item' in persistentObjectForItem.

Sadly though, I can't see a way to get an NSTreeNode from an object.
I have [item representedObject] for archival, but not [object  
representingItem], if you see what I mean.


Obviously I've tried returning an the 'item' archived but it doesn't  
respond to archiving.
Neither (obviously) does my NSManagedObject subclass... should I  
implement archiving in my subclass to get this to work?


Does anyone have any clue they can distribute my way? (citation: 
http://www.bofhcam.org/co-larters/distributing-clue/index.html)
I've seen lots in the usual places (lists.apple.com, cocoabuilder.com  
et al) about this but no actual solutions shout out at me. Perhaps I'm  
not looking hard enough. (most likely).


Many TIA
Ian

___

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

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

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

This email sent to [EMAIL PROTECTED]


PDFDocument subclass with an undo manager

2008-06-30 Thread Kevin Ross
Hi everyone, I have a question that might seems a little silly.  I  
have a PDFDocument subclass which can perform page impositions.  I  
would also like to be able to undo the impositions.  In the methods I  
have this when I make the change to the PDF:


[[undoManager prepareWithInvocationTarget:self] initWithData:[self  
dataRepresentation]];

[self initWithData:(NSData *)newPDFData];


When I call -undo: later, it works, but I can't get it to -redo:

Is what I'm trying to do even possible this way ?  Is there a better  
way?


Thanks for any pointers and/or suggestions!!

Kevin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: iPhone: Flip core animation performance with images in UIButtons

2008-06-30 Thread Brady Duga


On Jun 30, 2008, at 3:53 PM, Richard Adams wrote:


I'm in the process of learning Cocoa/Objective-C and I'm writing  
some stuff for the iPhone as an exercise.


I am sure you are about to get a bunch of comments about the  
appropriateness of posting iPhone related questions on this list, but  
I will leave it to a moderator to do it properly. I will say that  
using an unreleased beta product to be your first foray into Cocoa/ 
Objective-C is probably not the best approach. It might make more  
sense to use a stable, released environment with plenty of books on  
the topic and some good resources for asking questions (like this  
list, which *is* appropriate for general Cocoa questions).


--Brady
___

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

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

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

This email sent to [EMAIL PROTECTED]


iPhone: Flip core animation performance with images in UIButtons

2008-06-30 Thread Richard Adams

Hi All,

I'm in the process of learning Cocoa/Objective-C and I'm writing some  
stuff for the iPhone as an exercise.


I am writing a simple application based on the "Utility Application"  
iPhone Template with the latest SDK Beta 8.  This is a simple 2 view  
application with a routine called "toggleview" that sets up an  
animation between the 2 views to do a  
"UIViewAnimationTransitionFlipFromRight" transition.


The issue arrises when one view has lots of UIButtons (>40) WITH  
active background images set with code like .


[self setBackgroundImage:[UIImage imageNamed:@"blank_37.png"]  
forState:UIControlStateNormal];


Where "self" is a UIButton derived custom class.

As the number of buttons increases the animation processing slows down  
to the point that there is no animation and it approaches 2 frames of  
animation - first frame and last frame (ie no perceived animation).


I have proved it is the images in the buttons because performance is  
great with just a background colour set (no images), I can also see  
the animation render at very low frame rates if I significantly  
increase the transition time, and performance increase the fewer  
buttons with images there are.



So my question is - given I don't want to reduce the number of  
buttons, and I want the images for eye candy reasons, is there  
anything I can do to improve performance of the core animation  
transition?


Tx

Richard

PS.  This is running in the simulator on an Intel Macbook Pro with 2GB  
of memory and not iPhone natively (I couldn't get into the developer  
early access)



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Methods that return autoreleased objects?

2008-06-30 Thread Tom Bunch

On Jun 29, 2008, at 9:42 AM, Mike Ferris wrote:
And, as long as we're on the topic... who can name the only other  
exceptional case for the "release only if you alloc,new, copy or  
retain" rule?  (It's pretty old-school...)



How about if you're implementing an initializer for a class cluster  
that decides, perhaps based on parameters, that it wants to return an  
instance of a subclass instead of self?


On Jun 28, 2008, at 9:14 PM, Omar Qazi wrote:
Well theres no way to know, unless it's specifically mentioned in  
the documentation, but it really shouldn't matter. If you need the  
object retain it, if you don't let someone else worry about it.


This will keep you from crashing in the short term, but if you never  
take the time to crack this and learn to match all your retaining  
calls with releases, your application is doomed to die a slow leaky  
death.  Perhaps I'm misinterpreting you...


-Tom

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core animation

2008-06-30 Thread Brian Christensen

Am Jun 30, 2008 um 07:04 schrieb Papa-Raboon:


I was wondering if many of you have had a go at core animation yet?
I am personally looking at making a piece of text fade in and fade  
out as a
confirmation that something worked in my latest project. Currently I  
am just

popping a bit of text on screen using:
[succcessFlag setStringValue:@"Record Added"];

I presume we are talking pretty simple here but the question is how  
simple.
If any of you knows of any cool tutorials on really quick and simple  
core

animation text effects could you please give me the heads up.


It's difficult to know exactly what you need based on what you wrote  
above. Do you really need to drop down to Core Animation layers or  
would AppKit's animation proxies be good enough for your purposes? Is  
there a reason you would need to manipulate a CATextLayer directly? Is  
"successFlag" supposed to be a layer or is it an NSTextField?


If successFlag is in fact an NSTextField (or, for that matter, any  
NSView or subclass thereof), then [[successFlag animator]  
setHidden:YES] (or setHidden:NO) should give you a default fade  
effect, provided a superview somewhere up the view hierarchy is layer  
backed.


Here are some excellent starting points for learning OS X animation  
technologies. I highly recommend reading these guides. A "cool  
tutorial" should not be a substitute for reading Apple's  
documentation, IMHO:











Following that, Bill Dudney is authoring a Core Animation book  
(currently in beta, available in PDF form right now) that seems to be  
coming along nicely so far: 


/brian



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Linking against /Dev/L/PrivateFrameworks/

2008-06-30 Thread Jean-Daniel Dupas


Le 30 juin 08 à 23:10, Owen Yamauchi a écrit :


Yes, I know, I shouldn't be linking against an Apple private
framework, but trust me, there's a reason for it.

Anyway, I'm having trouble building the project. I dragged my private
framework (DevToolsCore.framework) into Xcode and left all the default
settings alone. However, when I try to build, it fails on the first
import line from the framework that it comes across:

#import 

PBXFileType.h is in the framework's PrivateHeaders directory, if that
makes a difference.

I've checked the project's (and target's) Framework Search Path
settings, and they definitely include
/Developer/Library/PrivateFrameworks.

Any ideas? (Note that I just want to get this to build; it doesn't
have to be deployable.)

TIA,
Owen


Transcript ?

From the Monthly reminder:

You can drag and drop most of the interesting information you need  
right from Xcode into the New Mail window.  Look in the Xcode Build  
Results, for example.  If you find a step labeled "Compiling main.c (1  
warning)" and you drag that step into an outgoing Mail message, here's  
what you get:…


 cd /Volumes/Local/Users/espich/4831414
setenv MACOSX_DEPLOYMENT_TARGET 10.4
/usr/bin/gcc-4.0 -x c -arch ppc -pipe -Wno-trigraphs -fpascal- 
strings […]


It's infinitely easier to diagnose the problem from this than from a  
written statement that "I get an error about printf."





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Why aren't my bindings firing?

2008-06-30 Thread Hamish Allan
On Mon, Jun 30, 2008 at 10:43 PM, Ron Lue-Sang <[EMAIL PROTECTED]> wrote:

> Yes! infoForBinding is what you should use to implement the logic in #1.
> [...]
> 2b) Implement the "read" logic yourself by implementing bind:.

What puzzles me is that NSTextField doesn't seem to do either of
these, yet still seems to know which key path to update after user
interaction.

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question: Timers

2008-06-30 Thread j o a r


On Jun 30, 2008, at 2:36 PM, Matthew Youney wrote:

In the VS environment, there is a “timer” control that can be  
dropped onto a
form, and will generate timer events every X milliseconds.  How  
would I
impliment similar functionality in Cocoa, or what would you gurus  
suggest

that I look into?  What is best?



There is no way to do that in IB, you would have to set up the timer  
in code, but that's easy enough - Check the documentation for the  
NSTimer class. What are you going to use the timer for? There might be  
something else that would be better for you to use in Cocoa.


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie question: Timers

2008-06-30 Thread Daniel Richman

Use this:

NSTimer *myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 // number 
of seconds as double

target:self // targer
selector:@selector(checkTimer:) // selector to call (parameter is the timer)
userInfo:nil // I don't use any user info
repeats:YES]; // whether the timer repeats or is once only (this is a BOOL)


Daniel


Matthew Youney wrote:

Hello everyone:
I have another question that is based on my Microsoft background (yes I am
ashamed).

In the VS environment, there is a “timer” control that can be dropped onto a
form, and will generate timer events every X milliseconds.  How would I
impliment similar functionality in Cocoa, or what would you gurus suggest
that I look into?  What is best?


As always, thanks for your help, and best regards,
Matt
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/applemaillist%40mm.danielrichman.com

This email sent to [EMAIL PROTECTED]
  

___

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

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

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

This email sent to [EMAIL PROTECTED]


Scaled Printing

2008-06-30 Thread John Nairn
I cannot find any mention of what a view needs to do to support scaled  
printing, so I thought it would be automatic as long as I adjust  
things for the current scaling. Unfortunately, the view always prints  
at 100% despite changing the scale setting in a page layout dialog.


Below is all the code I added for printing a flipped view that may  
span multiple pages. The view has a bunch of framed subviews, each  
containing some text and soon graphics, that are connected by lines (a  
family tree).


The controller first sets the margins to the printable area (to  
minimize number of pages needed) and then starts printing of the view  
with


- (void)printChartView:(id)pview
{
NSPrintInfo *pi = [[self document] printInfo];
	NSPrintOperation *printOp = [NSPrintOperation  
printOperationWithView:pview printInfo:pi];

[printOp setShowPanels:YES];
[printOp runOperation];
}

The printing uses custom pagination (following Apple's example, but in  
both directions instead of just vertical direction) and accounts for  
scaling in the calculations. The knowsPageRange and rectForPage are  
returning appropriate results for any scale setting, but the view  
always prints at 100% and thus scaling does not print correctly (an  
aside: at first I thought I should not even need knowsPageRange and  
rectForPage and could use auto pagination instead; although it worked,  
it did not use the margins I set up before printing and therefore used  
less of each page). This view's drawRect method has nothing special  
for printing (except to not highlight the currently selected subview).


// Return the number of pages available for printing
- (BOOL)knowsPageRange:(NSRangePointer)range
{
NSRect bounds = [self bounds];
NSSize printSize = [self calculatePrintSize];

range->location = 1;
int horiz = NSWidth(bounds)/printSize.width + 1;
int vert = NSHeight(bounds)/printSize.height + 1;
range->length = horiz*vert;
return YES;
}

// Return the drawing rectangle for a particular page number
- (NSRect)rectForPage:(int)page
{
NSRect bounds = [self bounds];
NSSize printSize = [self calculatePrintSize];

// hpage 1 to horiz and vpage 1 to vert (horiz and vert defined above)
int pagesForWidth = NSWidth(bounds)/printSize.width + 1;
int vpage = page/pagesForWidth;
int hpage = page % pagesForWidth;
if(hpage == 0)
hpage = pagesForWidth;
else
vpage++;
return NSMakeRect(NSMinX(bounds)+(hpage-1)*printSize.width,

NSMinY(bounds)+(vpage-1)*printSize.height,

printSize.width,printSize.height);
}

// Calculate the size of the view that fits on a single page
- (NSSize)calculatePrintSize
{
// Obtain the print info object for the current operation
NSPrintInfo *pi = [[NSPrintOperation currentOperation] printInfo];

// Calculate the page size in points
NSSize paperSize = [pi paperSize];
	float pageHeight = paperSize.height - [pi topMargin] - [pi  
bottomMargin];

float pageWidth = paperSize.width - [pi leftMargin] - [pi rightMargin];

// Convert size to the scaled view
	float scale = [[[pi dictionary] objectForKey:NSPrintScalingFactor]  
floatValue];

return NSMakeSize(pageWidth/scale, pageHeight/scale);
}

---
John Nairn (1-541-737-4265, FAX:1-541-737-3385)
Professor and Richardson Chair
Web Page: http://woodscience.oregonstate.edu/faculty/Nairn
FEA/MPM Web Page: http://oregonstate.edu/~nairnj



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-06-30 Thread Ron Lue-Sang


Sorry, I haven't read every message in this thread, but I think I can  
answer the original question


[[self bar] bind:@"title" toObject:ivar_controller  
withKeyPath:@"selection.displayName" options:nil];


Now here's the thing: if I call setDisplayName: on Foo, it calls  
Bar's setTitle: method, exactly as it should. However, if I call  
setTitle: on Bar, it does *not* end up calling Foo's setDisplayName:  
method, although it seems like it should. I can change the  
bind:toObject:withKeyPath:options: invocation above so that it binds  
Bar directly to Foo without going through the object controller, or  
I can try going the other way and binding the Foo to the Bar -  
always I get the same result.



Bindings of this type are one way. Their kinda ad hoc. "Title" will be  
updated to match ivar_controller.selection.displayName. Changing title  
will not result in any KVC calls to change anything in the  
ivar_controller. This is a read-only setup.


It sounds like you're asking for 2 things.
1) To have logic that will update ivarController.selection.displayName  
to match "title".

2) To have the logic from #1 triggered when setTitle is called.

There was some suggestion about using infoForBinding: to do blah blah  
blah.


Yes! infoForBinding is what you should use to implement the logic in #1.

// in Bar get the infoForBinding dictionary
NSDictionary *info = [self infoForBinding:@"title"];

// extract the controller and keypath info
id controller = [info objectForKey:NSObservedObjectKey];
NSString *keyPath = [info objectForKey:NSObservedKeyPathKey];

// extra points for looking in the binding options for value  
transformers and stuff

// options = [info  objectForKey:NSOptionsKey];

// push/write the value to the controller
[controller setValue:theTitle forKeyPath:keyPath];

The trick to getting #2 is that setTitle is ALSO what gets called  
during the regular we-did-the-read-work-for-you bindings update from  
the controller. Don't let changing the displayName end up calling  
setTitle if setTitle's going to set the displayName. Make sense?



So how do we fix this issue?

2a) Don't use setTitle to trigger logic in #1. This is the approach I  
normally suggest. Your views should push these changes down due to  
user interaction, not programatic fiddling.


2b) Implement the "read" logic yourself by implementing bind:. This  
means you'll need to cache the binding info yourself, start observing  
the controller object, and react to the KVO notifications  
appropriately. Don't call super for bind:/unbind:/infoForBinding:  
@"title".



As a final note - I'm not sure if anyone else mentioned it. The  
original code snippets had stuff like


- (void)setTitle:(NSString *)title {
[self willChangeValueForKey:@"title"];

NSLog(@"setting title to %@", title);

if(title != ivar_title) {
[ivar_title release];
ivar_title = [title copy];
}

[self didChangeValueForKey:@"title"];
}


You don't need the will/did changeValueForKey:@"title" calls in the  
setTitle: method if you haven't disabled automatic KVO notifications  
for title. If you didn't know you could do that, then you haven't  
disabled KVO notifications for your class and, therefore, don't need  
to call will/did changeValueForKey:@"title".


Hope that clears things up.


On Jun 30, 2008, at 2:04 PM, Hamish Allan wrote:

On Mon, Jun 30, 2008 at 3:56 PM, Michael Ash <[EMAIL PROTECTED]>  
wrote:



Although Apple's sample code shows overriding -bind:... to store
information about the new binding, it doesn't look like this is
necessary. You can simply use -infoForBinding: to obtain the info
dictionary, extract the bound object and key, and use that  
information

to update the model object. I'd assume this is what the Apple classes
do, and it seems to me to be a lot simpler than overriding -bind:...
to stash away a bunch of information that's already being stored for
you anyway.


That would seem a pretty reasonable assumption, but it doesn't seem to
be the case. At least, breakpoints on -[NSTextField infoForBinding:],
-[NSControl infoForBinding:],  -[NSObject infoForBinding:] don't seem
to trigger when the text field is edited; nor are messages logged from
a subclass of NSTextField overriding -infoForBinding:.

Any other ideas, anyone?

Thanks,
Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]



--
RONZILLA



___

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

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

Help/Unsubscribe/Upd

Newbie question: Timers

2008-06-30 Thread Matthew Youney
Hello everyone:
I have another question that is based on my Microsoft background (yes I am
ashamed).

In the VS environment, there is a “timer” control that can be dropped onto a
form, and will generate timer events every X milliseconds.  How would I
impliment similar functionality in Cocoa, or what would you gurus suggest
that I look into?  What is best?


As always, thanks for your help, and best regards,
Matt
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: garbage collection and NSConnection

2008-06-30 Thread Hamish Allan
On Mon, Jun 30, 2008 at 9:10 PM, eblu <[EMAIL PROTECTED]> wrote:

>hostname = [sender hostName];
>socket = (NSSocketPort*)[[NSSocketPortNameServer sharedInstance]
> portForName:@"BKOtherPort" host:hostname];
>connection = [NSConnection connectionWithReceivePort: nil sendPort:
> socket];
>@try{
>proxy = [connection rootProxy];
>}

Have you tried the rather more simple:

proxy = [[NSConnection
rootProxyForConnectionWithRegisteredName:@"BKOtherPort" host:[sender
hostname]] retain];

?

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Style Question: apology and correction

2008-06-30 Thread Rob Ross


On Jun 27, 2008, at 10:25 PM, Jens Alfke wrote:



On 27 Jun '08, at 9:45 PM, Rob Ross wrote:

Btw, how many people realize this convention comes from the early  
K&R C book, and the *only* reason they wrote it this way was to  
minimize the number of lines of text their examples would take up  
on each page? It's a type-setting design decision, and has nothing  
to do with how "pure" a programmer you are.


Do you have any citation that shows that was their rationale? From  
the forward of K&R:


"The position of braces is less important, although people hold  
passionate beliefs. We have chosen one of several popular styles.  
Pick a style that suits you, then use it consistently."


Ergo, it was already a popular coding style in 1978. Understandably  
so, as a standard terminal fit even fewer lines (only 24) than did  
a page of print, so minimizing the number of lines was important in  
those days if you wanted to be able to see any amount of your code  
at a time.


—Jens [who learned C in 1980 using K&R 1st ed. and a VT-100]


I stand humbly corrected. I fell victim to reporting something I read  
"on the internet" as fact without checking for sources.


I had seen several people whom I respected mention the theory of the  
book publisher as driving the use of a particular style in the  
original K&R "The C Programming Language" book, and have been  
repeating this as fact. But after your email challenging me to find  
sources, I could not do so after several hours of searching.


So I contacted the sources - both K&R, and to my amazement received  
email replies from both of them. They stated they had never advocated  
for any particular style, and that it was better just to be  
consistent with whatever one chose. And their use of the K&R style  
was well established by Ken Thompson, and something all the members  
of the original Unix and C compiler teams adopted, and still use to  
this day. So the use in the book of the K&R style represented what  
they themselves used on a daily basis.


So please accept my apology for propagating another internet rumor.  
We programmers really need something like snopes.com for programming  
myths :)


Rob Ross, Lead Software Engineer
E! Networks

---
"Beware of he who would deny you access to information, for in his  
heart he dreams himself your master." -- Commissioner Pravin Lal


___

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

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

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

This email sent to [EMAIL PROTECTED]


Linking against /Dev/L/PrivateFrameworks/

2008-06-30 Thread Owen Yamauchi
Yes, I know, I shouldn't be linking against an Apple private
framework, but trust me, there's a reason for it.

Anyway, I'm having trouble building the project. I dragged my private
framework (DevToolsCore.framework) into Xcode and left all the default
settings alone. However, when I try to build, it fails on the first
import line from the framework that it comes across:

#import 

PBXFileType.h is in the framework's PrivateHeaders directory, if that
makes a difference.

I've checked the project's (and target's) Framework Search Path
settings, and they definitely include
/Developer/Library/PrivateFrameworks.

Any ideas? (Note that I just want to get this to build; it doesn't
have to be deployable.)

TIA,
Owen
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-06-30 Thread Hamish Allan
On Mon, Jun 30, 2008 at 3:56 PM, Michael Ash <[EMAIL PROTECTED]> wrote:

> Although Apple's sample code shows overriding -bind:... to store
> information about the new binding, it doesn't look like this is
> necessary. You can simply use -infoForBinding: to obtain the info
> dictionary, extract the bound object and key, and use that information
> to update the model object. I'd assume this is what the Apple classes
> do, and it seems to me to be a lot simpler than overriding -bind:...
> to stash away a bunch of information that's already being stored for
> you anyway.

That would seem a pretty reasonable assumption, but it doesn't seem to
be the case. At least, breakpoints on -[NSTextField infoForBinding:],
-[NSControl infoForBinding:],  -[NSObject infoForBinding:] don't seem
to trigger when the text field is edited; nor are messages logged from
a subclass of NSTextField overriding -infoForBinding:.

Any other ideas, anyone?

Thanks,
Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Splitting an NSAttributedString across different NSRects of a given size

2008-06-30 Thread Keith Blount
Thank you, Douglas - multiple containers it is then.
All the best,
Keith

- Original Message 
From: Douglas Davidson <[EMAIL PROTECTED]>
To: Keith Blount <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Sent: Monday, June 30, 2008 9:34:19 PM
Subject: Re: Splitting an NSAttributedString across different NSRects of a 
given size


On Jun 30, 2008, at 1:19 PM, Keith Blount wrote:

> I am creating a view for printing index cards that basically takes  
> an array of attributed strings and prints each one on a 5 x 3 card.  
> However, if an attributed string is too long for one card, I want to  
> wrap it across two cards or more (however many it takes). This is  
> where my brain-deadness comes in. What's the best way of doing this?  
> That is, what is the best way of seeing how many NSRects of a given  
> size it takes to fit one attributed string, and the range of  
> characters for each rect? The only thing that has come to mind is  
> using an NSLayoutManager with multiple text containers, creating a  
> new text container each time the layout manager finishes layout out  
> a text container if layout is not complete (i.e. using the same  
> method you would use for a multiple page view, a la TextEdit). I  
> suppose I could use one text view, set at 5 x 3 inches, for the  
> drawing, swapping in and out the text containers as necessary... But  
> this seems a heavy-handed approach
> for a view that is only for printing and that will never be used for  
> editing. Is there a simpler method, something blindingly obvious  
> that I'm overlooking?

Using multiple text containers would be the standard way of doing  
this.  It might also be possible to lay out your text in a single very  
long, 5" wide container, and go through it line by line figuring out  
how many lines would fit in each container, but that could end up  
being more work than just using multiple containers; the two  
techniques also might differ if there's a possibility of hard page  
breaks.

Douglas Davidson


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Process app.

2008-06-30 Thread Ken Thomases

On Jun 30, 2008, at 10:53 AM, Jean-Daniel Dupas wrote:



Le 30 juin 08 à 17:27, Jens Alfke a écrit :



On 30 Jun '08, at 6:23 AM, Толя Макаров wrote:


Yes, that's clear, but how to get this list? I have found 2 ways: ps
-ef and [[NSWorkspace sharedWorkspace] launchedApplications].


There are underlying APIs that tools like ps and top use; you can  
call those. I'm not familiar with the details, however. You can  
look in the Darwin repository for the source code of either of  
those tools, or you can ask on the darwin-userlevel mailing list.  
(Cocoa-dev is off topic for this, since it's not related to any  
Cocoa APIs.)


NSWorkspace isn't going to help, because it's in AppKit, and  
daemon processes (the only kind that could be running without  
loginwindow) aren't allowed to link against AppKit.


See QA1123: Getting List of All Processes on Mac OS X.

http://developer.apple.com/qa/qa2001/qa1123.html

To get notification, you can use kevent with the EVFILT_PROC and  
the NOTE_EXIT event. (man kqueue), but it's going off topics too.


More techniques:

Technical Note TN2050: Observing Process Lifetimes Without Polling
http://developer.apple.com/technotes/tn/tn2050.html

Cheers,
Ken___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Splitting an NSAttributedString across different NSRects of a given size

2008-06-30 Thread Douglas Davidson


On Jun 30, 2008, at 1:19 PM, Keith Blount wrote:

I am creating a view for printing index cards that basically takes  
an array of attributed strings and prints each one on a 5 x 3 card.  
However, if an attributed string is too long for one card, I want to  
wrap it across two cards or more (however many it takes). This is  
where my brain-deadness comes in. What's the best way of doing this?  
That is, what is the best way of seeing how many NSRects of a given  
size it takes to fit one attributed string, and the range of  
characters for each rect? The only thing that has come to mind is  
using an NSLayoutManager with multiple text containers, creating a  
new text container each time the layout manager finishes layout out  
a text container if layout is not complete (i.e. using the same  
method you would use for a multiple page view, a la TextEdit). I  
suppose I could use one text view, set at 5 x 3 inches, for the  
drawing, swapping in and out the text containers as necessary... But  
this seems a heavy-handed approach
for a view that is only for printing and that will never be used for  
editing. Is there a simpler method, something blindingly obvious  
that I'm overlooking?


Using multiple text containers would be the standard way of doing  
this.  It might also be possible to lay out your text in a single very  
long, 5" wide container, and go through it line by line figuring out  
how many lines would fit in each container, but that could end up  
being more work than just using multiple containers; the two  
techniques also might differ if there's a possibility of hard page  
breaks.


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: garbage collection and NSConnection

2008-06-30 Thread Jean-Daniel Dupas


Le 30 juin 08 à 22:19, Jean-Daniel Dupas a écrit :


Le 30 juin 08 à 22:10, eblu a écrit :


Hi Chris,
	I'm not terribly sure what you are asking for here. From my  
experience (limited experience admittedly) theres really only one  
way to use NSConnection.
its a pretty elegant class, which is simple, and works as expected,  
except for when garbage collection is enabled.


heres what I do just after NSNetService finds a service:

// Sent when a service appears
- (void)netServiceBrowser:(NSNetServiceBrowser *)browser
  didFindService:(NSNetService *)aNetService
  moreComing:(BOOL)moreComing
{
NSMutableDictionary* newDict = [[NSMutableDictionary alloc] init];
[newDict setValue:aNetService forKey:@"theService"];

[serverArrayController addObject:newDict];
[aNetService setDelegate:self];
[aNetService resolveWithTimeout:5];
  if(!moreComing)
  {
  }
}

// NSNetService Delegate method:
- (void)netServiceDidResolveAddress:(NSNetService *)sender{

id proxy = nil;
NSData *addy;
NSSocketPort* socket;
NSConnection* connection;
NSString* hostname;

int a;
int i;

hostname = [sender hostName];
	socket = (NSSocketPort*)[[NSSocketPortNameServer sharedInstance]  
portForName:@"BKOtherPort" host:hostname];
	connection = [NSConnection connectionWithReceivePort: nil  
sendPort: socket];

@try{
proxy = [connection rootProxy];
}
@catch(id exception){
proxy = nil;

}
addy = [socket address];
if(proxy){
// app level stuff if the proxy exists
}
}

pretty straight forward,
and every time I ran it with garbage collection on, the  
NSConnection initialized, but NEVER returned the proxy. it returned  
nil.
all my instance variables were populated, everything on My end was  
correct... or at least behaving as expected. it just wouldn't  
return the proxy object (or the root for that matter)

All I did to fix it, was to turn off garbage collection.
That part runs like a champ now.  the rest of the app won't do  
anything anymore, as it was built on garbage collection.


cheers,
-eb



And did you try using CFNetServices instead ? As it is CF based, it  
probably does not have the same GC problem and is it far more easier  
to replace NSNetService by CFNetService than rewriting the whole  
application without GC .


Sorry, it the DO part that does not works, not the Bonjour discovery.  
I read it a little to fast.






smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Splitting an NSAttributedString across different NSRects of a given size

2008-06-30 Thread Keith Blount
Hi,

First of all, I think I'm being a bit brain-dead here as I just *know* I've had 
to do something similar to this in the past, or have seen something similar to 
it at least, elsewhere, but I'm obviously using the wrong search terms in 
Cocoabuilder and Cocoadev and my memory is obviously fading with age... So -

I am creating a view for printing index cards that basically takes an array of 
attributed strings and prints each one on a 5 x 3 card. However, if an 
attributed string is too long for one card, I want to wrap it across two cards 
or more (however many it takes). This is where my brain-deadness comes in. 
What's the best way of doing this? That is, what is the best way of seeing how 
many NSRects of a given size it takes to fit one attributed string, and the 
range of characters for each rect? The only thing that has come to mind is 
using an NSLayoutManager with multiple text containers, creating a new text 
container each time the layout manager finishes layout out a text container if 
layout is not complete (i.e. using the same method you would use for a multiple 
page view, a la TextEdit). I suppose I could use one text view, set at 5 x 3 
inches, for the drawing, swapping in and out the text containers as 
necessary... But this seems a heavy-handed approach
 for a view that is only for printing and that will never be used for editing. 
Is there a simpler method, something blindingly obvious that I'm overlooking?

Thanks for any input and all the best,
Keith


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: garbage collection and NSConnection

2008-06-30 Thread Jean-Daniel Dupas

Le 30 juin 08 à 22:10, eblu a écrit :


Hi Chris,
	I'm not terribly sure what you are asking for here. From my  
experience (limited experience admittedly) theres really only one  
way to use NSConnection.
its a pretty elegant class, which is simple, and works as expected,  
except for when garbage collection is enabled.


heres what I do just after NSNetService finds a service:

// Sent when a service appears
- (void)netServiceBrowser:(NSNetServiceBrowser *)browser
   didFindService:(NSNetService *)aNetService
   moreComing:(BOOL)moreComing
{
NSMutableDictionary* newDict = [[NSMutableDictionary alloc] init];
[newDict setValue:aNetService forKey:@"theService"];

[serverArrayController addObject:newDict];
[aNetService setDelegate:self];
[aNetService resolveWithTimeout:5];
   if(!moreComing)
   {
   }
}

// NSNetService Delegate method:
- (void)netServiceDidResolveAddress:(NSNetService *)sender{

id proxy = nil;
NSData *addy;
NSSocketPort* socket;
NSConnection* connection;
NSString* hostname;

int a;
int i;

hostname = [sender hostName];
	socket = (NSSocketPort*)[[NSSocketPortNameServer sharedInstance]  
portForName:@"BKOtherPort" host:hostname];
	connection = [NSConnection connectionWithReceivePort: nil sendPort:  
socket];

@try{
proxy = [connection rootProxy];
}
@catch(id exception){
proxy = nil;

}
addy = [socket address];
if(proxy){
// app level stuff if the proxy exists
}
}

pretty straight forward,
and every time I ran it with garbage collection on, the NSConnection  
initialized, but NEVER returned the proxy. it returned nil.
all my instance variables were populated, everything on My end was  
correct... or at least behaving as expected. it just wouldn't return  
the proxy object (or the root for that matter)

All I did to fix it, was to turn off garbage collection.
That part runs like a champ now.  the rest of the app won't do  
anything anymore, as it was built on garbage collection.


cheers,
-eb



And did you try using CFNetServices instead ? As it is CF based, it  
probably does not have the same GC problem and is it far more easier  
to replace NSNetService by CFNetService than rewriting the whole  
application without GC .





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: garbage collection and NSConnection

2008-06-30 Thread eblu

Hi Chris,
	I'm not terribly sure what you are asking for here. From my  
experience (limited experience admittedly) theres really only one way  
to use NSConnection.
 its a pretty elegant class, which is simple, and works as expected,  
except for when garbage collection is enabled.


heres what I do just after NSNetService finds a service:

// Sent when a service appears
- (void)netServiceBrowser:(NSNetServiceBrowser *)browser
didFindService:(NSNetService *)aNetService
moreComing:(BOOL)moreComing
{
NSMutableDictionary* newDict = [[NSMutableDictionary alloc] init];
[newDict setValue:aNetService forKey:@"theService"];

[serverArrayController addObject:newDict];
[aNetService setDelegate:self];
[aNetService resolveWithTimeout:5];
if(!moreComing)
{
}
}

// NSNetService Delegate method:
- (void)netServiceDidResolveAddress:(NSNetService *)sender{

id proxy = nil;
NSData *addy;
NSSocketPort* socket;
NSConnection* connection;
NSString* hostname;

int a;
int i;

hostname = [sender hostName];
	socket = (NSSocketPort*)[[NSSocketPortNameServer sharedInstance]  
portForName:@"BKOtherPort" host:hostname];
	connection = [NSConnection connectionWithReceivePort: nil sendPort:  
socket];

@try{
proxy = [connection rootProxy];
}
@catch(id exception){
proxy = nil;

}
addy = [socket address];
if(proxy){
// app level stuff if the proxy exists
}
}

pretty straight forward,
and every time I ran it with garbage collection on, the NSConnection  
initialized, but NEVER returned the proxy. it returned nil.
all my instance variables were populated, everything on My end was  
correct... or at least behaving as expected. it just wouldn't return  
the proxy object (or the root for that matter)

All I did to fix it, was to turn off garbage collection.
That part runs like a champ now.  the rest of the app won't do  
anything anymore, as it was built on garbage collection.


cheers,
-eb


On Jun 30, 2008, at 3:37 PM, Chris Hanson wrote:


On Jun 30, 2008, at 10:33 AM, [EMAIL PROTECTED] wrote:

only to discover some weeks later that for some odd reason,  
NSConnections do not work when the project is set to support or  
require garbage collection.


How are you using NSConnection?  NSConnection and Distributed  
Objects definitely *does* work with Objective-C garbage collection,  
at least in the situations in which I've used it.


Some code examples might be illustrative.

 -- Chris



___

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

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

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

This email sent to [EMAIL PROTECTED]


[Cocoa] Subclassing NSMutableURLRequest

2008-06-30 Thread Alexander von Below

Hello List,

I have searched the archives, but did not really find an answer to my  
question, even though the title was the same...


I want to subclass NSMutableURLRequest, in order to create my own,  
specialized URLRequest (namely, XML-RPC). I thought that was a smart  
idea.


As NSURLRequest is deep-copied for transmission, I could overwrite  
copyWithZone: , and create my custom body there on 10.4


On 10.5 however, copyWithZone: (or copyMutableWithZone:, for that  
matter), is never called.


Using class_dump to take a peak at the class, I overwrote - (struct  
_CFURLRequest *)_CFURLRequest, and all is well.


Now... is that a good idea? Or should I not subclass  
NSMutableURLRequest at all?


Any hints or opinions are appreciated!

Alex


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: RFC822 date-string to NSDate

2008-06-30 Thread Kyle Sluder
On Mon, Jun 30, 2008 at 3:14 PM, Steve Byan <[EMAIL PROTECTED]> wrote:
> That's a bummer, because RFC822 dates have some optional elements and so
> don't conform to a fixed format. I hoped that the default parsing was smart.

Well it looks like the RFC822 date grammar is context-free so
implementing a parser shouldn't be that hard.  You'll have to deal
with Y2K, though.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Connecting to non-standard HTTP ports with authorization

2008-06-30 Thread Niklas Saers

Hi Jens,
thanks for the reference and the domain property, I wasn't aware of  
that. In the HTTP header I get back from the server I cannot see a  
domain, but then again I cannot see a realm either. How do I find the  
domain? In NTLM authentication, is domain the same as the DNS domain,  
or is it the same as the domain windows computers in a domain there  
use? I'm trying to get this done within the Cocoa classes, though, so  
I'll have to figure out a way to translate from CFNetwork to regular  
Cocoa :-)


Cheers

Nik

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: RFC822 date-string to NSDate

2008-06-30 Thread Steve Byan


On Jun 30, 2008, at 2:50 PM, Andy Lee wrote:

I'm not too familiar with NSDateFormatter.  Do you need to call - 
setDateFormat:?


Ah, thanks, I missed the statement hidden on page 23 of "Data  
Formatting Programming Guide for Cocoa", which says:


"You use the format string is used to specify both the input to and  
the output from date formatter objects."


That's a bummer, because RFC822 dates have some optional elements and  
so don't conform to a fixed format. I hoped that the default parsing  
was smart.


Anyone have any pointers to some Objective-C RFC822-date-time parsing  
code? An NSDateFormatter category containing  
dateFromRFC822DateTimeString: would be great :-)


Best regards,
-Steve

--
Steve Byan <[EMAIL PROTECTED]>
Littleton, MA 01460


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: garbage collection and NSConnection

2008-06-30 Thread John Pannell

Hi there-

I encountered the same issue some months ago, and posted my questions  
to this list.  An Apple engineer did reply off-list that this was a  
known issue with garbage collection and that there was no known  
workaround at that time.


I was just playing with GC for fun and reverted back to "regular"  
memory management.


You might inquire of Apple DTS if things have changed at all; my  
incident was in the 10.5.0 days.


John

John Pannell
http://www.positivespinmedia.com

On Jun 30, 2008, at 11:33 AM, [EMAIL PROTECTED] wrote:


hey,
I have a project that uses Bonjour for some of its communication,  
theres a server and a client, and I was having tremendous difficulty  
getting it to work, pouring and pouring over my code, only to  
discover some weeks later that for some odd reason, NSConnections do  
not work when the project is set to support or require garbage  
collection.


As a test I set garbage collection to: Unsupported, and the app  
compiled, and the NSConnection returned the proxy object as  
expected.  But the app obviously failed to do much else, because I  
had no retain, release, or autorelease method calls.


can anybody shed any light on this? am I really stuck managing the  
memory myself? This is intolerable.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: RFC822 date-string to NSDate

2008-06-30 Thread Nick Zitzmann


On Jun 30, 2008, at 12:35 PM, Steve Byan wrote:

I'm having trouble grokking NSDateFormatter on OS X 10.4. Does it  
support RFC822-style dates?



It should, but you'll have to make your own format string to do that.  
NSDateFormatter does make some guesses at the format when getting the  
date from a string, but only when it's using 10.0-style behavior, and  
even then it's better to just make your own format string.


Nick Zitzmann





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: RFC822 date-string to NSDate

2008-06-30 Thread Andy Lee
I'm not too familiar with NSDateFormatter.  Do you need to call - 
setDateFormat:?


--Andy

On Jun 30, 2008, at 2:35 PM, Steve Byan wrote:

I'm having trouble grokking NSDateFormatter on OS X 10.4. Does it  
support RFC822-style dates? I'm parsing an XML document; here's the  
pertinent code snippet:


   NSLog(@"observation_time_rfc822 element end");
   NSDateFormatter * dateFormatter = [[NSDateFormatter alloc]  
init];
   [dateFormatter  
setFormatterBehavior:NSDateFormatterBehavior10_4];
   myObservationTime = [dateFormatter  
dateFromString:myCurrentStringValue];

   NSLog(@"myObservationTime %@", myObservationTime);
   myObservationTimeRFC822 = [[NSString alloc]  
initWithString:myCurrentStringValue];


The myObservationTimeRFC822 string is "Mon, 30 Jun 2008 13:56:00  
-0400 EDT", but NSLog(@"myObservationTime %@", myObservationTime)  
prints "myObservationTime 1969-12-31 19:00:00 -0500".


Best regards,
-Steve

--
Steve Byan <[EMAIL PROTECTED]>
Littleton, MA 01460


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


RFC822 date-string to NSDate

2008-06-30 Thread Steve Byan
I'm having trouble grokking NSDateFormatter on OS X 10.4. Does it  
support RFC822-style dates? I'm parsing an XML document; here's the  
pertinent code snippet:


NSLog(@"observation_time_rfc822 element end");
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc]  
init];
[dateFormatter  
setFormatterBehavior:NSDateFormatterBehavior10_4];
myObservationTime = [dateFormatter  
dateFromString:myCurrentStringValue];

NSLog(@"myObservationTime %@", myObservationTime);
myObservationTimeRFC822 = [[NSString alloc]  
initWithString:myCurrentStringValue];


The myObservationTimeRFC822 string is "Mon, 30 Jun 2008 13:56:00  
-0400 EDT", but NSLog(@"myObservationTime %@", myObservationTime)  
prints "myObservationTime 1969-12-31 19:00:00 -0500".


Best regards,
-Steve

--
Steve Byan <[EMAIL PROTECTED]>
Littleton, MA 01460


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [NSMutableAttributedString] How is NSBaseURLDocumentOption supposed to work?

2008-06-30 Thread Douglas Davidson


On Jun 28, 2008, at 4:37 AM, Stéphane Sudre wrote:

OK, someone kindly pointed me off-list that I was using a NSString  
instead of a NSURL.


I'm still wondering which URL is supposed to be used:

- the document itself

or

- the parent folder of the document


This is the URL that will be passed in to WebKit (via  
loadData:MIMEType:textEncodingName:baseURL:) to be used as the base  
for relative URLs within the document.


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Responder Chain and NSViewController in non-doc applications

2008-06-30 Thread Cathy Shive

Hi Jerry,

NSViewController is a subclass of NSResponder, but there is nothing  
provided in Cocoa that automatically includes the View Controllers in  
your appliation's window's Responder Chain.  You won't find any  
documentation that will show you how NSViewController is included in  
the Responder Chain, because it is not.  You have to do this for your  
View Controllers yourself.


This is part of the reason that Jonathan and I created the  
XSViewController and XSWindowController classes you found in the blog  
posts.  When an XSViewController is added to the tree of view  
controllers that the XSWindowController manages, the  
XSWindowController patches it into the Responder Chain automatically.   
If it is removed from the list, the view controller is removed from  
the Responder Chain and the chain is patched back up by the Window  
Controller.


In our design, the XSViewControllers are included in the responder  
chain after the Window Controller, not in the part of the chain that  
travels through the view hierarchy, but you could certainly do it how  
ever you wanted to. Again, this post is just illustrating one way to  
do it, there is no official Cocoa guide to adding View Controllers to  
the Responder Chain.


If you explicitly set the target for an action in IB, you are right  
that the action will get sent straight to its target without using the  
Responder Chain.  In the case of an application where the main menu,  
the application's main window and all of its views are in the same nib  
file, this could very well be a sufficient way to set up target/ 
actions in the app and you probably don't need any View Controllers at  
all.


If you are setting up views in multiple nib files that will be swapped  
in and out dynamically during runtime,  you'll want to start thinking  
about how to leverage the Responder Chain, NSViewController and the  
handy "First Responder" object Interface Builder.


If you are new to Cocoa and just learning about the event system, I'd  
suggest that you start with a simple UI, with everything in one nib  
file and then start to strategize how you might expand your interface  
into multiple nibs and View Controllers.


HTH,
Cathy

On Jun 30, 2008, at 6:52 PM, Jerry Isdale wrote:

I'm trying to understand a bit more about the Responder chain,  
especially how it relates to regular (non-document) applications  
using NSView and NSViewController added into the View Hierarchy.
Katidev.com has a nice series of articles on the related issue for  
Document based applications. (It starts at http://katidev.com/blog/2008/04/09/nsviewcontroller-the-new-c-in-mvc-pt-1-of-3/)


However, it doesnt give me enough background to understand why I  
need a XSViewController (extension of NSViewController), and how the  
Controller hierarchy fits in with the View Hierarchy.


When does an application following the Responder Chain look at the  
ViewController?
The clues I have (from KatiDev and Apple's  "Cocoa Event-Handling  
Guide" (aka EventOverview.pdf) is that the EVENT chain starts with  
the current focus Window's First Responder, and then it traverses  
the View Hierarchy's responder chain which I think means going  
up to the parent (containing) view and checking its responder until  
you get to the Window, then the WindowDelegate, and then the  
NSWindowController.


Event Messages (aka events) dont get passed to the NSViewController  
in the normal (NS) world.  The XSController extension (katidev.com)  
puts these back in, such that it when the event gets to the  
XSWindowController it would get passed down the XS-responder chain  
(see the article).


Action Messages (actions) follow a slightly different path. Actions  
start by an Event responder (eg a ButtonCell) firing off a  
sendAction:to:from.  If there is a designated Target (to:)  defined  
by the responder, that object gets the action. Otherwise the  
sendAction:to:from goes to the First Responder, up the view  
hierarchy, to the NSWindow, to the WindowDelegate, to the NSApp then  
the AppDelegate.


Again, the NSViewController doesnt appear in the responder chain,  
unless it was designated by the initial Event Responder.  If it was  
designated, but doesnt respond, what happens? An Error or does it go  
back to the responder chain?


The NSViewController is a Responder, but the associated view does  
not patch it into the responder chain for either event or action  
responding.


Correct?

But if my design explicitly specifies the target (connecting  
IBActions in InterfaceBuilder), I dont have to worry about the  
Responder chain for actions.  Correct?


Thanks

Jerry Isdale
[EMAIL PROTECTED]



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options

Re: Responder Chain and NSViewController in non-doc applications

2008-06-30 Thread Jonathan Dann


On 30 Jun 2008, at 17:52, Jerry Isdale wrote:

I'm trying to understand a bit more about the Responder chain,  
especially how it relates to regular (non-document) applications  
using NSView and NSViewController added into the View Hierarchy.
Katidev.com has a nice series of articles on the related issue for  
Document based applications. (It starts at http://katidev.com/blog/2008/04/09/nsviewcontroller-the-new-c-in-mvc-pt-1-of-3/)


However, it doesnt give me enough background to understand why I  
need a XSViewController (extension of NSViewController), and how the  
Controller hierarchy fits in with the View Hierarchy.




Sorry if we didn't explain it quite well enough in the articles, the  
main idea behind why we need the controllers can be found from our  
initial conversations on this list (sorry about my spelling on the  
first post, I was still getting used to the iPhone!)


http://www.cocoabuilder.com/archive/message/cocoa/2008/3/19/201743

The main points we wanted to address were:

1) How do you fit an NSViewController into the MVC architechure when  
all the docs only refer to the roles of the NSDocument and  
NSWindowControllers.
2) How do you deal with the issues of programmatic bindings when  
windows are deallocated while observers are registered.
3) As NSViewController is a subclass of NSResponder, where should is  
go in the responder chain and how can we automate the addition of a  
view controller to the chain so we don't have to explicitly add it and  
remove it from then chain when we need to create and get rid of  
controllers and their associated views.


When does an application following the Responder Chain look at the  
ViewController?


Events are sent up the responder chain, so the firstResponder will  
likely be the view you click on (an NSButton for example) or actions  
sent from the key window.  Just as in the docs they travel to the  
window controller, but then the view controller hierarchy is the then  
patched in so each view controller gets a chance to respond to the  
sent action.  If by the end of the view hierarchy the action is still  
not responded to, the action gets passed to what whatever is after the  
window controller is Apple's documentation (I forget what it is, the  
NSApplication delegate, maybe?)




Event Messages (aka events) dont get passed to the NSViewController  
in the normal (NS) world.


Correct.  Which is odd until you realise that NSViewController by  
itself cannot be put into the chain by default until an architecture  
for the class is decided upon. We chose a tree to reflect the view  
hierarchy, some choose an array controllers.


The XSController extension (katidev.com) puts these back in, such  
that it when the event gets to the XSWindowController it would get  
passed down the XS-responder chain (see the article).


Yep, solves a lot of problems, but note that it is not the only place  
that putting the controllers into the chain makes sense. Some prefer  
to make each controller the nextResponder of its view, and then  
interject the next responder of the view controller to the original  
next responder of the view.  The next version of the class may have  
this option, but its a simple case to start observing changes to the  
view's nextResponder during the +loadView method and hijacking it when  
it changes.




Action Messages (actions) follow a slightly different path. Actions  
start by an Event responder (eg a ButtonCell) firing off a  
sendAction:to:from.  If there is a designated Target (to:)  defined  
by the responder, that object gets the action. Otherwise the  
sendAction:to:from goes to the First Responder, up the view  
hierarchy, to the NSWindow, to the WindowDelegate, to the NSApp then  
the AppDelegate


Yep



Again, the NSViewController doesnt appear in the responder chain,  
unless it was designated by the initial Event Responder.  If it was  
designated, but doesnt respond, what happens? An Error or does it go  
back to the responder chain?


In the NS world yes, but it makes sense often  to have the controller  
respond to actions.


The NSViewController is a Responder, but the associated view does  
not patch it into the responder chain for either event or action  
responding.




Yes

But if my design explicitly specifies the target (connecting  
IBActions in InterfaceBuilder), I dont have to worry about the  
Responder chain for actions.  Correct?



Yes, but with the controllers in the chain you have some flexibility.

Thanks for reading the articles,

Jonathan Dann

www.espresso-served-here.com

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This e

Re: Responder Chain and NSViewController in non-doc applications

2008-06-30 Thread Jerry Isdale


On Jun 30, 2008, at 10:12 AM, j o a r wrote:



On Jun 30, 2008, at 9:52 AM, Jerry Isdale wrote:

Again, the NSViewController doesnt appear in the responder chain,  
unless it was designated by the initial Event Responder.  If it was  
designated, but doesnt respond, what happens? An Error or does it  
go back to the responder chain?



I'm not clear on what you mean by "designated by the initial Event  
Responder".

If the NSControl has a
- (BOOL)sendAction:(SEL)theAction to:(id)theTarget
it is the initial Event Responder (eg. it would be found in the  
responder chain handling the mouseDown/mouseUp) and it designates an  
NSViewController as theTarget (connected in IB to the IBAction method)


Jerry Isdale
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


garbage collection and NSConnection

2008-06-30 Thread eblugamma

hey,
I have a project that uses Bonjour for some of its communication,  
theres a server and a client, and I was having tremendous difficulty  
getting it to work, pouring and pouring over my code, only to discover  
some weeks later that for some odd reason, NSConnections do not work  
when the project is set to support or require garbage collection.


As a test I set garbage collection to: Unsupported, and the app  
compiled, and the NSConnection returned the proxy object as expected.   
But the app obviously failed to do much else, because I had no retain,  
release, or autorelease method calls.


I am not a lazy person, but I am a novice programmer, and the retain,  
release, autorelease stuff in cocoa is horrible. I was very happy when  
garbage collection was added to Cocoa, and my projects became much  
easier to develop, and maintain. Now however, I find myself with a  
project riddled with memory problems that did Not exist just a few  
days ago, and as far as I can tell, I don't have any choice... My app  
either gives up Bonjour, or I have to retrofit the whole thing to  
manage its own memory with a system that is, lets face it, poorly  
envisioned.


can anybody shed any light on this? am I really stuck managing the  
memory myself? This is intolerable.


cheers,
-eblu
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating AppControllers in InterfaceBuilder 3.1

2008-06-30 Thread Owen Yamauchi
On Mon, Jun 30, 2008 at 7:27 AM, j o a r <[EMAIL PROTECTED]> wrote:
> The thinking here is indeed that Xcode handles the creation of classes,
> while IB handles instances of classes and their configuration.

IB can actually create classes. In the Identity inspector, after
creating a generic NSObject, type in a class name that you want to
create. Then you can add outlets and actions below. Once you're
finished, File->Write Class Files... will create the .h and .m files
(unfortunately it won't add them to your Xcode project, or at least I
haven't found a way to make it do so).

Owen
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating AppControllers in InterfaceBuilder 3.1

2008-06-30 Thread Devon Ferns
You shouldn't even have to drag it into IB.  IB should pick up any new 
classes you create in XCode.


Devon

Tommy Nordgren wrote:


On 30 jun 2008, at 16.14, [EMAIL PROTECTED] wrote:


Hi

I'm writing my first project in Leopard and can't figure out how to 
accomplish the old
"Subclass NSObject/Generate Files/Instantiate" series of steps in 
Interface Builder 3.1.


I'm sure Interface Builder has a new way to do that but I can't find it.

Any help appreciated




You create the files from an XCode file template,
and drag the header file into IB
-
This sig is dedicated to the advancement of Nuclear Power
Tommy Nordgren
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Responder Chain and NSViewController in non-doc applications

2008-06-30 Thread j o a r


On Jun 30, 2008, at 9:52 AM, Jerry Isdale wrote:

Again, the NSViewController doesnt appear in the responder chain,  
unless it was designated by the initial Event Responder.  If it was  
designated, but doesnt respond, what happens? An Error or does it go  
back to the responder chain?



I'm not clear on what you mean by "designated by the initial Event  
Responder".



The NSViewController is a Responder, but the associated view does  
not patch it into the responder chain for either event or action  
responding. Correct?



Correct. Unless you manually insert it into the responder chain, in  
that case typically right after its view.



But if my design explicitly specifies the target (connecting  
IBActions in InterfaceBuilder), I dont have to worry about the  
Responder chain for actions.  Correct?



Correct.


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Some advice re. "saving" a variable so it is accessible to all classes/methods

2008-06-30 Thread Owen Yamauchi
On Mon, Jun 30, 2008 at 9:46 AM, Michael Kaye <[EMAIL PROTECTED]> wrote:
> So my question (finally) is where do I store the sessionid variable so it is
> accessible through out all classes and for as long as the app is running?
>
> My current approach is to save the value in an Extern NSString but I'm not
> convinced this is correct. I feel like the class that handles the login
> ought to maintain it some how, but if so how do I keep it alive and
> accessible after I release the login class object?
>
> I hope makes some sense and hopefully someone can provide me with a few
> pointers.

I don't see that the login object needs to be released at all.

Logically, the login object is the one responsible for obtaining the
session id, so it "owns" the session id. Maybe have the login object
be a singleton, so you can always access the instance, and give it an
accessor for the session id. Conceptually, think of the singleton
login object as "authentication to the server". It can give an opaque
certificate of authentication, in the form of the session id.

Owen
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDateComponents question

2008-06-30 Thread mmalc crawford


On Jun 30, 2008, at 9:45 AM, Jason Wiggins wrote:


5   NSDateComponents *comps = [[NSDateComponents alloc] init];
6   NSDateComponents *components = [[NSDateComponents alloc] init];


Why are you creating these objects -- you're just leaking them?

7	unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |   
NSDayCalendarUnit | NSWeekdayCalendarUnit;

8   int x = 0;
9   now = [NSDate date];
10  comps = [calendar components:unitFlags fromDate:now];
11  x = [comps weekday];
12  NSLog(@"Weekday is: %i", x);  // prints "Weekday is: 3" to the console
13  [comps setDay:-x];
14	startDate = [calendar dateByAddingComponents:comps toDate:now  
options:0];



What do you get if you print the other components of comps to the  
console?
Since you initialised 'comps' from 'now', the year component will be  
2008.  So add another 2008 years to 2008 and you'll get 4016 -- add  
another six months doubled and you'll get 4017...


If you simply want to subtract 3 days from the current date, create a  
new date components with a day component of -3.


NSDate *currentDate = [NSDate date];
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setDay:-3];
NSDate *date = [gregorian dateByAddingComponents:comps  
toDate:currentDate  options:0];

[comps release];


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Responder Chain and NSViewController in non-doc applications

2008-06-30 Thread Jerry Isdale
I'm trying to understand a bit more about the Responder chain,  
especially how it relates to regular (non-document) applications using  
NSView and NSViewController added into the View Hierarchy.
Katidev.com has a nice series of articles on the related issue for  
Document based applications. (It starts at http://katidev.com/blog/2008/04/09/nsviewcontroller-the-new-c-in-mvc-pt-1-of-3/)


However, it doesnt give me enough background to understand why I need  
a XSViewController (extension of NSViewController), and how the  
Controller hierarchy fits in with the View Hierarchy.


When does an application following the Responder Chain look at the  
ViewController?
The clues I have (from KatiDev and Apple's  "Cocoa Event-Handling  
Guide" (aka EventOverview.pdf) is that the EVENT chain starts with the  
current focus Window's First Responder, and then it traverses the View  
Hierarchy's responder chain which I think means going up to the  
parent (containing) view and checking its responder until you get to  
the Window, then the WindowDelegate, and then the NSWindowController.


Event Messages (aka events) dont get passed to the NSViewController in  
the normal (NS) world.  The XSController extension (katidev.com) puts  
these back in, such that it when the event gets to the  
XSWindowController it would get passed down the XS-responder chain  
(see the article).


Action Messages (actions) follow a slightly different path. Actions  
start by an Event responder (eg a ButtonCell) firing off a  
sendAction:to:from.  If there is a designated Target (to:)  defined by  
the responder, that object gets the action. Otherwise the  
sendAction:to:from goes to the First Responder, up the view hierarchy,  
to the NSWindow, to the WindowDelegate, to the NSApp then the  
AppDelegate.


Again, the NSViewController doesnt appear in the responder chain,  
unless it was designated by the initial Event Responder.  If it was  
designated, but doesnt respond, what happens? An Error or does it go  
back to the responder chain?


The NSViewController is a Responder, but the associated view does not  
patch it into the responder chain for either event or action responding.


Correct?

But if my design explicitly specifies the target (connecting IBActions  
in InterfaceBuilder), I dont have to worry about the Responder chain  
for actions.  Correct?


Thanks

Jerry Isdale
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Some advice re. "saving" a variable so it is accessible to all classes/methods

2008-06-30 Thread Michael Kaye

Hi all,

I hope you can offer a newbie some advice. I've been reading and  
reading the Design patterns documentation but have got myself somewhat  
confused. I hope if I explain what I'm trying to achieve someone can  
offer me some advice.


Basically I have an application that interrogates a web based database  
and displays the requested data accordingly.


1) When the app launches the first view displayed is a "login" screen  
with a username and password field.


2) if the user clicks the login button (and everything is OK such as  
there is a network connection etc), a url is sent to the web server  
and it responds with an XML response


(in fact this is handled by a "loginXMLReader" class I have a created  
which handles sending the request, parsing the response and returns a  
BOOL indicating whether login was successful).


3) If the login is successful, theML response also contains an element  
called "sessionID" which contains a string value which must be passed  
to subsequent url request/queries


So my question (finally) is where do I store the sessionid variable so  
it is accessible through out all classes and for as long as the app is  
running?


My current approach is to save the value in an Extern NSString but I'm  
not convinced this is correct. I feel like the class that handles the  
login ought to maintain it some how, but if so how do I keep it alive  
and accessible after I release the login class object?


I hope makes some sense and hopefully someone can provide me with a  
few pointers.


TIA. Michael.
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSDateComponents question

2008-06-30 Thread Jason Wiggins

Hi everyone,

Since NSCalendarDate is going to be deprecated in the future, I've  
started playing with NSDateComponents. I have a question regarding a  
problem I'm having. I'm getting a wacky date returned at line 15. I'm  
expecting it to add -3 to the current date, but I get something *way*  
in the future. I'm not trying to invent a time machine. Here is the  
code I have:


 1	NSCalendar *calendar = [[NSCalendar alloc]  
initWithCalendarIdentifier:NSGregorianCalendar];

 2  NSDate *now;
 3  NSDate *startDate;
 4  NSDate *endDate;
 5  NSDateComponents *comps = [[NSDateComponents alloc] init];
 6  NSDateComponents *components = [[NSDateComponents alloc] init];
 7	unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |   
NSDayCalendarUnit | NSWeekdayCalendarUnit;

 8  int x = 0;
 9  now = [NSDate date];
10  comps = [calendar components:unitFlags fromDate:now];
11  x = [comps weekday];
12  NSLog(@"Weekday is: %i", x);  // prints "Weekday is: 3" to the console
13  [comps setDay:-x];
14	startDate = [calendar dateByAddingComponents:comps toDate:now  
options:0];
15	NSLog(@"startDate is: %@", startDate);	// prints "startDate is:  
4017-02-01 02:32:04 +1100" to the console


If I change it to the following code, it works as expected:

 1	NSCalendar *calendar = [[NSCalendar alloc]  
initWithCalendarIdentifier:NSGregorianCalendar];

 2  NSDate *now;
 3  NSDate *startDate;
 4  NSDate *endDate;
 5  NSDateComponents *comps = [[NSDateComponents alloc] init];
 6  NSDateComponents *components = [[NSDateComponents alloc] init];
 7	unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |   
NSDayCalendarUnit | NSWeekdayCalendarUnit;

 8  int x = 0;
 9  now = [NSDate date];
10  components = [calendar components:unitFlags fromDate:now];
11  x = [components weekday];
12  NSLog(@"Weekday is: %i", x);  // prints "Weekday is: 3" to the console
13  [comps setDay:-x];
14	startDate = [calendar dateByAddingComponents:comps toDate:now  
options:0];
15	NSLog(@"startDate is: %@", startDate);	// prints "startDate is:  
2008-06-28 02:36:48 +1000" to the console


What I don't understand is why just trying to add -3 in the first lot  
of code gives me a strange date. Why do I need to get two different  
NSDateComponents to do what I want to do, or am I missing something?  
I've read the docs: file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/DatesAndTimes/Articles/dtCalendars.html 
 but haven't found an answer.


Thanks,
JJ
___

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

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

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

This email sent to [EMAIL PROTECTED]


[OT] Re: Style Question

2008-06-30 Thread Steve Byan


On Jun 28, 2008, at 1:25 AM, Jens Alfke wrote:



On 27 Jun '08, at 9:45 PM, Rob Ross wrote:

Btw, how many people realize this convention comes from the early  
K&R C book, and the *only* reason they wrote it this way was to  
minimize the number of lines of text their examples would take up  
on each page? It's a type-setting design decision, and has nothing  
to do with how "pure" a programmer you are.


Do you have any citation that shows that was their rationale? From  
the forward of K&R:


"The position of braces is less important, although people hold  
passionate beliefs. We have chosen one of several popular styles.  
Pick a style that suits you, then use it consistently."


Ergo, it was already a popular coding style in 1978. Understandably  
so, as a standard terminal fit even fewer lines (only 24) than did  
a page of print, so minimizing the number of lines was important in  
those days if you wanted to be able to see any amount of your code  
at a time.


If you read the source of Unix 6th edition (available in Lion's  
Commentary, ISBN 1-57398-013-7), you will see that they used the "One  
True Brace Style(tm)" :-)


Best regards,
-Steve

--
Steve Byan <[EMAIL PROTECTED]>
Littleton, MA 01460


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: trackmouse problems in Leopard

2008-06-30 Thread Corbin Dunn


On Jun 30, 2008, at 7:24 AM, Moray Taylor wrote:


Yes! it did!

Thanks a lot, I'm not sure if I'd ever have figured hat one out.


I highly recommend reading the AppKit release notes, which covers  
things like this problem.


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

--corbin




Moray


--- On Sat, 28/6/08, Andy Kim <[EMAIL PROTECTED]> wrote:


From: Andy Kim <[EMAIL PROTECTED]>
Subject: Re: trackmouse problems in Leopard
To: [EMAIL PROTECTED]
Cc: Cocoa-dev@lists.apple.com
Date: Saturday, 28 June, 2008, 8:10 PM
For a quick test, see if putting in the following in your
cell
subclass makes it work again:

- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:
(NSRect)cellFrame ofView:(NSView*)controlView
{
return NSCellHitContentArea | NSCellHitEditableTextArea |

NSCellHitTrackableArea;
}


___

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

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

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

This email sent to [EMAIL PROTECTED]


[ANN] CocoaHeads Frankfurt

2008-06-30 Thread Torsten Curdt

http://upcoming.yahoo.com/event/857251

Hope to see you there!

cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Process app.

2008-06-30 Thread Jean-Daniel Dupas


Le 30 juin 08 à 17:27, Jens Alfke a écrit :



On 30 Jun '08, at 6:23 AM, Толя Макаров wrote:


Yes, that's clear, but how to get this list? I have found 2 ways: ps
-ef and [[NSWorkspace sharedWorkspace] launchedApplications].


There are underlying APIs that tools like ps and top use; you can  
call those. I'm not familiar with the details, however. You can look  
in the Darwin repository for the source code of either of those  
tools, or you can ask on the darwin-userlevel mailing list. (Cocoa- 
dev is off topic for this, since it's not related to any Cocoa APIs.)


NSWorkspace isn't going to help, because it's in AppKit, and daemon  
processes (the only kind that could be running without loginwindow)  
aren't allowed to link against AppKit.


See QA1123: Getting List of All Processes on Mac OS X.

http://developer.apple.com/qa/qa2001/qa1123.html

To get notification, you can use kevent with the EVFILT_PROC and the  
NOTE_EXIT event. (man kqueue), but it's going off topics too.






smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

NSBroswer Column highlight

2008-06-30 Thread Micha Fuhrmann
I'm implementing DnD in an NSBrowser for 10.4. The Problem I have is  
to enable the Column selection (Blue line around the column), to show  
to the user that the drag-in is indeed working + its destination. I'm  
thinking in the line of using – draggingUpdated from my NSMatrix  
subclass used in the Browser to trigger that highlight.


1) How can highlight a specific column in the NSBrowser?

2) The other problem I see is that draggingUpdated is only triggered  
as the drag moves within the NSMatrix, not the entire column which  
includes the NSMatrix.


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


Re: Connecting to non-standard HTTP ports with authorization

2008-06-30 Thread Jens Alfke
Hm. I've never used NTLM authentication. Have you read the "Handling  
Authentication" section of the CFNetwork Programming Guide? It  
mentions that NTLM auth requires a domain as well as a username/ 
password. But I'm not sure how to configure that using the Obj-C  
wrapper APIs.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Process app.

2008-06-30 Thread Jens Alfke


On 30 Jun '08, at 6:23 AM, Толя Макаров wrote:


Yes, that's clear, but how to get this list? I have found 2 ways: ps
-ef and [[NSWorkspace sharedWorkspace] launchedApplications].


There are underlying APIs that tools like ps and top use; you can call  
those. I'm not familiar with the details, however. You can look in the  
Darwin repository for the source code of either of those tools, or you  
can ask on the darwin-userlevel mailing list. (Cocoa-dev is off topic  
for this, since it's not related to any Cocoa APIs.)


NSWorkspace isn't going to help, because it's in AppKit, and daemon  
processes (the only kind that could be running without loginwindow)  
aren't allowed to link against AppKit.


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: initWithFrame deosn't get called

2008-06-30 Thread Micha Fuhrmann

Thanks, that was it.

Micha
On 30 juin 08, at 16:27, Charles Steinman wrote:


--- On Mon, 6/30/08, Micha Fuhrmann <[EMAIL PROTECTED]> wrote:


I'm trying to registerForDraggedTypes a NSMatrix
subclass that's used
in a NSBrowser. When I override init or initWithFrame in my
Matrix
class in manner to include registerForDraggedTypes none of
the two
methods get called.


If you look at the NSMatrix docs, the designated initializer for  
NSMatrix is - 
initWithFrame:mode:prototype:numberOfRows:numberOfColumns:. Try  
overriding that.


Cheers,
Chuck





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Alternative to NSDate's dateWithNaturalLanguageString: ?

2008-06-30 Thread Jason Wiggins
Funnily enough, I've just found and been playing with NSCalendarDate  
and was unaware of the discouragement of using this class until now,  
thanks Jens. But it's not deprecated *yet*

From the docs:
Important: Use of NSCalendarDate strongly discouraged. It is not  
deprecated yet, however it may be in the next major OS release after  
Mac OS X v10.5. For calendrical calculations, you should use suitable  
combinations of NSCalendar, NSDate, and NSDateComponents, as described  
in Calendars in Dates and Times Programming Topics for Cocoa.


JJ

On 01/07/2008, at 1:14 AM, Jens Alfke wrote:



On 30 Jun '08, at 12:29 AM, David Arve wrote:


sqlite3_bind_int(sql_statement, 1, one_week);


Shouldn't that be sqlite3_bind_double? The variable one_week is  
declared as double, and I'm pretty sure that seconds-since-1970  
intervals are soon going to overflow a (signed) 32-bit int, if they  
haven't already.


Is there a better way for me to get e.g. the dates from my database  
from

this week, this month etc.?


Look at "Calendars" in the "Date & Time Programming Guide For  
Cocoa", which describes how to do manipulations with calendar dates.  
In a nutshell, you can find the beginning of the week by getting the  
current date/time, then breaking it into components and setting the  
day-of-week plus hour/minute/second to zero, then converting back to  
NSDate. Then you can call -timeIntervalSince1970.


(I'd give you an example, but my own code that does this uses the  
deprecated NSCalendarDate class. I haven't used NSCalendar myself,  
yet.)


—Jens___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jwiggins%40optusnet.com.au

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Alternative to NSDate's dateWithNaturalLanguageString: ?

2008-06-30 Thread Jens Alfke


On 30 Jun '08, at 12:29 AM, David Arve wrote:


sqlite3_bind_int(sql_statement, 1, one_week);


Shouldn't that be sqlite3_bind_double? The variable one_week is  
declared as double, and I'm pretty sure that seconds-since-1970  
intervals are soon going to overflow a (signed) 32-bit int, if they  
haven't already.


Is there a better way for me to get e.g. the dates from my database  
from

this week, this month etc.?


Look at "Calendars" in the "Date & Time Programming Guide For Cocoa",  
which describes how to do manipulations with calendar dates. In a  
nutshell, you can find the beginning of the week by getting the  
current date/time, then breaking it into components and setting the  
day-of-week plus hour/minute/second to zero, then converting back to  
NSDate. Then you can call -timeIntervalSince1970.


(I'd give you an example, but my own code that does this uses the  
deprecated NSCalendarDate class. I haven't used NSCalendar myself, yet.)


—Jens___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Why aren't my bindings firing?

2008-06-30 Thread Michael Ash
On Mon, Jun 30, 2008 at 12:38 AM, Hamish Allan <[EMAIL PROTECTED]> wrote:
> On Mon, Jun 30, 2008 at 5:33 AM, Charles Srstka
> <[EMAIL PROTECTED]> wrote:
>
>> Wait, what? Okay, that contradicts the understanding that I had come to...
>> so the built-in views establish two-way bindings *without* overriding
>> bind:toObject:withKeyPath:options:? Great, that puts us back to square one!
>
> It would seem so, but in fact I was mistaken about the equivalence
> between "value" and "objectValue" bindings: the binding to objectValue
> is only a one-way binding. I guess that difference would make it safer
> to use a separate namespace.

I am largely bindings clueless, so beware

NSObject's -bind:... method does two things. First, it sets up an
automatic one-way binding from the model object to the view object.
When the model is changed, the view's key is automatically set to the
new value. Second, it sets up an info dictionary for that binding.

Although Apple's sample code shows overriding -bind:... to store
information about the new binding, it doesn't look like this is
necessary. You can simply use -infoForBinding: to obtain the info
dictionary, extract the bound object and key, and use that information
to update the model object. I'd assume this is what the Apple classes
do, and it seems to me to be a lot simpler than overriding -bind:...
to stash away a bunch of information that's already being stored for
you anyway.

The reason the objectValue binding doesn't work both ways is because
NSControl doesn't implement this kind of thing when its objectValue
changes. You need to implement the view->model changes manually they
don't come for free just because you're KVC compliant, and NSControl
doesn't implement it for objectValue. You get the model->view
direction for free with KVC complaince, which is why it halfway works.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating AppControllers in InterfaceBuilder 3.1

2008-06-30 Thread Jean-Daniel Dupas


Le 30 juin 08 à 16:20, Tommy Nordgren a écrit :



On 30 jun 2008, at 16.14, [EMAIL PROTECTED] wrote:


Hi

I'm writing my first project in Leopard and can't figure out how to  
accomplish the old
"Subclass NSObject/Generate Files/Instantiate" series of steps in  
Interface Builder 3.1.


I'm sure Interface Builder has a new way to do that but I can't  
find it.


Any help appreciated




You create the files from an XCode file template,
and drag the header file into IB


I don't know in IB 3.1 that is under NDA, but in IB 3.0, the  
"instanciate" part is done by dragging an "Object" from the "Library"  
panel (in Cocoa > Objects & Controllers) into your document.
Then, select your custom object and in the "Identity inspector", you  
change the object class to whatever you want.






smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Creating AppControllers in InterfaceBuilder 3.1

2008-06-30 Thread kentozier
Perfect!. Thanks Joar

 -- Original message --
From: j o a r <[EMAIL PROTECTED]>
> 
> On Jun 30, 2008, at 7:14 AM, [EMAIL PROTECTED] wrote:
> 
> > I'm writing my first project in Leopard and can't figure out how to  
> > accomplish the old
> > "Subclass NSObject/Generate Files/Instantiate" series of steps in  
> > Interface Builder 3.1.
> 
> 
> What you typically do is to create the subclass in Xcode, and not in  
> IB. Once you've done that, switch back to IB and drag in a generic  
> NSObject from the Library (it looks like a blue cube). Hit Cmd+6 to  
> open the identity inspector, and type the name of the class that you  
> want to instantiate.
> 
> 
> 
> On Jun 30, 2008, at 7:20 AM, Tommy Nordgren wrote:
> 
> > You create the files from an XCode file template, and drag the  
> > header file into IB
> 
> 
> The thinking here is indeed that Xcode handles the creation of  
> classes, while IB handles instances of classes and their  
> configuration. The last part of that sentence is no longer required  
> though: Xcode and IB are now on better speaking terms, so you don't  
> have to manually tell IB to read header files for it to learn about  
> changes to classes in the project, it stays up to date automatically.
> 
> 
> j o a r
> 
> 

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating AppControllers in InterfaceBuilder 3.1

2008-06-30 Thread j o a r


On Jun 30, 2008, at 7:14 AM, [EMAIL PROTECTED] wrote:

I'm writing my first project in Leopard and can't figure out how to  
accomplish the old
"Subclass NSObject/Generate Files/Instantiate" series of steps in  
Interface Builder 3.1.



What you typically do is to create the subclass in Xcode, and not in  
IB. Once you've done that, switch back to IB and drag in a generic  
NSObject from the Library (it looks like a blue cube). Hit Cmd+6 to  
open the identity inspector, and type the name of the class that you  
want to instantiate.




On Jun 30, 2008, at 7:20 AM, Tommy Nordgren wrote:

You create the files from an XCode file template, and drag the  
header file into IB



The thinking here is indeed that Xcode handles the creation of  
classes, while IB handles instances of classes and their  
configuration. The last part of that sentence is no longer required  
though: Xcode and IB are now on better speaking terms, so you don't  
have to manually tell IB to read header files for it to learn about  
changes to classes in the project, it stays up to date automatically.



j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: initWithFrame deosn't get called

2008-06-30 Thread Charles Steinman
--- On Mon, 6/30/08, Micha Fuhrmann <[EMAIL PROTECTED]> wrote:

> I'm trying to registerForDraggedTypes a NSMatrix
> subclass that's used  
> in a NSBrowser. When I override init or initWithFrame in my
> Matrix  
> class in manner to include registerForDraggedTypes none of
> the two  
> methods get called.

If you look at the NSMatrix docs, the designated initializer for NSMatrix is 
-initWithFrame:mode:prototype:numberOfRows:numberOfColumns:. Try overriding 
that.

Cheers,
Chuck


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: trackmouse problems in Leopard

2008-06-30 Thread Moray Taylor
Yes! it did!

Thanks a lot, I'm not sure if I'd ever have figured hat one out.

Moray


--- On Sat, 28/6/08, Andy Kim <[EMAIL PROTECTED]> wrote:

> From: Andy Kim <[EMAIL PROTECTED]>
> Subject: Re: trackmouse problems in Leopard
> To: [EMAIL PROTECTED]
> Cc: Cocoa-dev@lists.apple.com
> Date: Saturday, 28 June, 2008, 8:10 PM
> For a quick test, see if putting in the following in your
> cell  
> subclass makes it work again:
> 
> - (NSUInteger)hitTestForEvent:(NSEvent *)event inRect: 
> (NSRect)cellFrame ofView:(NSView*)controlView
> {
>   return NSCellHitContentArea | NSCellHitEditableTextArea | 
> 
> NSCellHitTrackableArea;
> }
> 
> It might not be exactly what you want, but I'm pretty
> sure your  
> solution is a good implementation of this method.
> 
> Andy Kim
> 
> 
> On Jun 28, 2008, at 6:24 AM, Moray Taylor wrote:
> 
> > Hi, hope someone can help...
> >
> > I have an app that uses a custom NSCell that
> implements the
> >
> > - (BOOL)trackMouse:(NSEvent *)theEvent
> inRect:(NSRect)cellFrame  
> > ofView:(NSView *)controlView
> untilMouseUp:(BOOL)untilMouseUp
> >
> > method.
> >
> > In Tiger, this works just fine, if I build targeting
> the 10.5 API,  
> > it does not work, the method does not get called at
> all, I can put  
> > an NSLog right at the start, and it never happens.
> >
> > If I build targeting 10.4, it works great, even if the
> host machine  
> > is running Leopard, so it seems its an API difference.
> >
> > If anyone can shed any light on this, I'd be
> eternally grateful!
> >
> > Thanks a lot
> >
> > Moray


  __
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at 
Yahoo! http://uk.docs.yahoo.com/ymail/new.html
___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Style Question (Robert Claeson)

2008-06-30 Thread john darnell


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
On
> Behalf Of Roni Music
> Sent: Saturday, June 28, 2008 1:13 PM
> To: cocoa-dev@lists.apple.com
> Subject: Re: Style Question (Robert Claeson)
> 
> the bottom of the page below has one opinion why one style is superior
to
> the other,
> (at least when it comes to C++ and the way C++ objects behave when
going
> out
> of scope)
> 
> 
> http://www.relisoft.com/book/lang/scopes/2local.html

Actually, I couldn't agree more with the documentation!  As a matter of
fact, when I take over someone else's code, the first thing I do is
spend the time needed (however much required) to rearrange the position
of the braces to conform with the documented style indicated in the
above references.  Nevertheless, as I have said in previous posts, the
only thing I really insist on with religious fervor is that coders
include plenty of whitespace in their code.  To me that one choice
improves readability far, far more than any placement of braces style
that one might argue about.

And to forestall a firestorm of objections, let me reinforce the "take
over" part.  If I am merely looking at someone else's code or attempting
a change when the other party is sick (in emergency situations, and only
when pressed by my supervisor), I do my very best to conform to the
style they use.  Only when I am taking over complete control of the
project do I do this.

R, 
John
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating AppControllers in InterfaceBuilder 3.1

2008-06-30 Thread Tommy Nordgren


On 30 jun 2008, at 16.14, [EMAIL PROTECTED] wrote:


Hi

I'm writing my first project in Leopard and can't figure out how to  
accomplish the old
"Subclass NSObject/Generate Files/Instantiate" series of steps in  
Interface Builder 3.1.


I'm sure Interface Builder has a new way to do that but I can't find  
it.


Any help appreciated




You create the files from an XCode file template,
and drag the header file into IB
-
This sig is dedicated to the advancement of Nuclear Power
Tommy Nordgren
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Creating AppControllers in InterfaceBuilder 3.1

2008-06-30 Thread kentozier
Hi

I'm writing my first project in Leopard and can't figure out how to accomplish 
the old 
"Subclass NSObject/Generate Files/Instantiate" series of steps in Interface 
Builder 3.1. 

I'm sure Interface Builder has a new way to do that but I can't find it. 

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


Re: Core animation

2008-06-30 Thread Bill Dudney

Text is tricky because of the anti-aliasing issues.

Broaden your search though there are tons of examples on how to fade a  
layer in and out of a scene (apple's samples, my blog, others as well).


Basically though

- parent view needs to be layer backed (via setWantsLayer:YES)
- create a layer whose content is your text (or the text layer if you  
don't need fine control over the anti-aliasing)

- add the text layer as a sublayer of the view's layer
- fade to zero opacity, when the fade is complete remove the layer  
from its superlayer


that will give you a fade in and fade out, there are of course other  
ways to do this that might or might not be easier...


HTH,

-bd-
http://bill.dudney.net/roller/objc

On Jun 30, 2008, at 5:04 AM, Papa-Raboon wrote:


Hi All,
I was wondering if many of you have had a go at core animation yet?
I am personally looking at making a piece of text fade in and fade  
out as a
confirmation that something worked in my latest project. Currently I  
am just

popping a bit of text on screen using:
[succcessFlag setStringValue:@"Record Added"];

I presume we are talking pretty simple here but the question is how  
simple.
If any of you knows of any cool tutorials on really quick and simple  
core

animation text effects could you please give me the heads up.

I've Googled loads for this but no joy yet.


Cheers
Paul Randall
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: initWithFrame deosn't get called

2008-06-30 Thread Graham Cox

Try doing it from awakeFromNib:

I had an issue where registerForDraggedTypes wasn't working if called  
too early, though I forget the details exactly. Moving the  
registration to awakeFromNib (or even windowControllerDidLoadNib if  
you have an NSWindowController) fixed it so I didn't investigate the  
problem too deeply. I got the impression it was because if it's called  
before the view is added to the window, the registration was ignored,  
but I may be wrong abut that.


hth,

Graham


On 30 Jun 2008, at 11:11 pm, Micha Fuhrmann wrote:

How can I call registerForDraggedTypes for each one of the Browser's  
Matrix as ithey init?


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Process app.

2008-06-30 Thread Толя Макаров
Yes, that's clear, but how to get this list? I have found 2 ways: ps
-ef and [[NSWorkspace sharedWorkspace] launchedApplications]. 1 way
shows in the list  loginwindow.app, when it's on and doesn't work. 2
way doesn't show this application at all. What would you suggest?


  
Вы уже с Yahoo!? 
Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.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 [EMAIL PROTECTED]


initWithFrame deosn't get called

2008-06-30 Thread Micha Fuhrmann

Hi everyone,

I'm trying to registerForDraggedTypes a NSMatrix subclass that's used  
in a NSBrowser. When I override init or initWithFrame in my Matrix  
class in manner to include registerForDraggedTypes none of the two  
methods get called.


[Browser setMatrixClass:[BrowserMatrixView class]]; -> setting the  
browser's Matrix class


@interface BrowserMatrixView : NSMatrix -> BrowserMatrixView is a  
NSMatrix subclass


How can I call registerForDraggedTypes for each one of the Browser's  
Matrix as ithey init?


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


Re: Connecting to non-standard HTTP ports with authorization

2008-06-30 Thread Niklas Saers

Just a little update,
-1012 is NSURLErrorUserCancelledAuthentication, and that caught my  
suspicioun that perhaps data got sent anyway. So fire up Wireshark,  
and sure enough, my request is sent:


GET /Pages/Default.aspx HTTP/1.1
User-Agent: (myApp/0.1 (myApp)
Accept: */*
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: 192.168.0.5:42334

And a 401 is passed back, with NTLM authentication, not Basic. Sorry  
about that, but it doesn't really change anything with my problem as  
far as I know:


HTTP/1.1 401 Unauthorized
Content-Length: 1656
Content-Type: text/html
Server: Microsoft-IIS/6.0
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
MicrosoftSharePointTeamServices: 12.0.0.4518
X-Powered-By: ASP.NET
Date: Mon, 30 Jun 2008 12:55:40 GMT

And then of course it fails again, and the -1012 is returned saying  
the user cancled while in fact, no authentication info was sent. So my  
question is: how can I make a correct NTLM authentication via HTTP,  
because what I'm doing right now seems to be incorrect


Cheers

Nik


On Jun 30, 2008, at 11:54 AM, Niklas Saers wrote:


Hi,
I'm trying to connect to a server that requires HTTP authentication  
and that lives on a non-standard port. I've written a little bit of  
code that works great when it tries to connect to a server on port  
80, but I get an error when connecting to the non-standard port, and  
I get it without it trying to connect at all:


{
   NSErrorFailingURLKey = http://192.168.0.5:42334/;
   NSErrorFailingURLStringKey = "http://192.168.0.5:42334/";;
   NSUnderlyingError = Error Domain=kCFErrorDomainCFNetwork  
Code=-1012 UserInfo=0x1f0b40 "Operation could not be completed.  
(kCFErrorDomainCFNetwork error -1012.)";

}


Here is my code:

+ (void) test {
NSString *host = @"http://192.168.0.5:42334/";;
NSString *username = @"someuser";
NSString *password = @"somepass";
int port = 42334;

	NSURLCredential *newCredential =[NSURLCredential  
credentialWithUser:username password:password  
persistence:NSURLCredentialPersistenceForSession];
	NSURLProtectionSpace *space = [[NSURLProtectionSpace alloc]  
initWithHost:host port:port protocol:@"http" realm:nil  
authenticationMethod:nil];


	NSURLCredentialStorage *store = [NSURLCredentialStorage  
sharedCredentialStorage];

[store setCredential:newCredential forProtectionSpace:space];

	NSMutableURLRequest *urlRequest = [NSMutableURLRequest  
requestWithURL:[NSURL URLWithString:host]  
cachePolicy:NSURLCacheStorageNotAllowed timeoutInterval:30];


NSURLResponse *response;
NSError *error;
   	NSData *returnData = [NSURLConnection  
sendSynchronousRequest:urlRequest returningResponse:&response  
error:&error];


if(error) {
NSLog(@"test error: %@", error);
NSLog(@"test userinfo: %@", [error userInfo]);
} else {
NSLog(@"test response: %@", response);
NSLog(@"test result: %d", returnData);
}
}

What am I doing wrong? How should I modify the code to connect  
correctly? Also, do I need to do anything specific if I want to  
support servers that require NTLM or Digest authentication rather  
than Basic? Where can I look up errorcode -1012?


Cheers

  Nik


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Process app.

2008-06-30 Thread Mike Bellerby

Hi

If your process is running as root, you can get a list of all current  
processes.


Cheers
Mike

On 30 Jun 2008, at 10:07, Толя Макаров wrote:


HI.
Cocoa, Obj - C.
How can know a another program is started? The process is started up  
not from my program. I check if is started loginwindow.app
And it is possible to catch event that loginwindow.app was closed?  
Give me example, please.



 
Вы уже с Yahoo!?
Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.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/mdb%40realvnc.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Core animation

2008-06-30 Thread Papa-Raboon
Hi All,
I was wondering if many of you have had a go at core animation yet?
I am personally looking at making a piece of text fade in and fade out as a
confirmation that something worked in my latest project. Currently I am just
popping a bit of text on screen using:
[succcessFlag setStringValue:@"Record Added"];

I presume we are talking pretty simple here but the question is how simple.
If any of you knows of any cool tutorials on really quick and simple core
animation text effects could you please give me the heads up.

I've Googled loads for this but no joy yet.


Cheers
Paul Randall
___

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

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

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

This email sent to [EMAIL PROTECTED]


Connecting to non-standard HTTP ports with authorization

2008-06-30 Thread Niklas Saers

Hi,
I'm trying to connect to a server that requires HTTP authentication  
and that lives on a non-standard port. I've written a little bit of  
code that works great when it tries to connect to a server on port 80,  
but I get an error when connecting to the non-standard port, and I get  
it without it trying to connect at all:


{
NSErrorFailingURLKey = http://192.168.0.5:42334/;
NSErrorFailingURLStringKey = "http://192.168.0.5:42334/";;
NSUnderlyingError = Error Domain=kCFErrorDomainCFNetwork  
Code=-1012 UserInfo=0x1f0b40 "Operation could not be completed.  
(kCFErrorDomainCFNetwork error -1012.)";

}


Here is my code:

+ (void) test {
NSString *host = @"http://192.168.0.5:42334/";;
NSString *username = @"someuser";
NSString *password = @"somepass";
int port = 42334;

	NSURLCredential *newCredential =[NSURLCredential  
credentialWithUser:username password:password  
persistence:NSURLCredentialPersistenceForSession];
	NSURLProtectionSpace *space = [[NSURLProtectionSpace alloc]  
initWithHost:host port:port protocol:@"http" realm:nil  
authenticationMethod:nil];


	NSURLCredentialStorage *store = [NSURLCredentialStorage  
sharedCredentialStorage];

[store setCredential:newCredential forProtectionSpace:space];

	NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL: 
[NSURL URLWithString:host] cachePolicy:NSURLCacheStorageNotAllowed  
timeoutInterval:30];


NSURLResponse *response;
NSError *error;
	NSData *returnData = [NSURLConnection  
sendSynchronousRequest:urlRequest returningResponse:&response  
error:&error];


if(error) {
NSLog(@"test error: %@", error);
NSLog(@"test userinfo: %@", [error userInfo]);
} else {
NSLog(@"test response: %@", response);
NSLog(@"test result: %d", returnData);
}
}

What am I doing wrong? How should I modify the code to connect  
correctly? Also, do I need to do anything specific if I want to  
support servers that require NTLM or Digest authentication rather than  
Basic? Where can I look up errorcode -1012?


Cheers

   Nik
___

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

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

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

This email sent to [EMAIL PROTECTED]


Process app.

2008-06-30 Thread Толя Макаров
HI.
Cocoa, Obj - C. 
How can know a another program is started? The process is started up not from 
my program. I check if is started loginwindow.app
And it is possible to catch event that loginwindow.app was closed? Give me 
example, please.


  
Вы уже с Yahoo!? 
Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.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 [EMAIL PROTECTED]


Alternative to NSDate's dateWithNaturalLanguageString: ?

2008-06-30 Thread David Arve
Hi,
I have a sqlite3 database storing some time information as the time interval
since 1970 as a REAL type. To get the total time interval since for example
the beginning of this week I use something like the following.

const char *sql = "SELECT SUM(end - begin) FROM table WHERE begin>?";

sqlite3_prepare_v2(database, sql, -1, &sql_statement, NULL);

double one_week = [[NSDate dateWithNaturalLanguageString:@"last monday 00:00
"] timeIntervalSince1970];

sqlite3_bind_int(sql_statement, 1, one_week);


Though the method dateWithNaturalLanguageString is described as "It may give
unexpected results, and its use is strongly discouraged.".

Is there a better way for me to get e.g. the dates from my database from
this week, this month etc.?

Thank you very much,

David
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: viewing method calls

2008-06-30 Thread Owen Yamauchi
On Sun, Jun 29, 2008 at 10:18 PM, Nick Zitzmann <[EMAIL PROTECTED]> wrote:
>
> On Jun 29, 2008, at 3:25 PM, John Murphy wrote:
>
>> How do I view the messages (method calls) that are sent during the loading
>> of an application?
>
>
> You can do this using a profiler, such as Shark.

A DTrace script will serve you a lot better than Shark. Shark does
statistical profiling. If you take a time profile using Shark, all it
does is periodically (every millisecond, by default) interrupt your
application and check to see what it's doing. From this it assembles a
picture of where your app is spending its time. This is obviously not
guaranteed to see every message-send that happens: some very
short-running ones might just happen to occur between two Shark
interruptions, every time, and Shark will never see it.

With DTrace, you can automate collecting data *every* time
objc_msgSend is called, with perfect reliability. (Instruments is
backed by DTrace, for an idea of the scope of capabilities DTrace
has.)

Owen
___

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

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

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

This email sent to [EMAIL PROTECTED]