Re: Questions about Core Data and SQLite

2008-07-15 Thread Jeff Brown
Thanks guys for all this info.

Also can anyone point me to a good book or website where I can learn about and 
how to incorporate Core Data into my existing Cocoa App. 
I've found mac documentation isn't the easiest to learn from.

Cheers
Jeff


  Start at the new Yahoo!7 for a better online experience. www.yahoo7.com.au
___

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

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

2008-07-15 Thread Aron Nopanen

Jon,

Your post sounds like a statement of fact more than a question, but I  
assume you're wondering why you can't draw multiple ovals?
The view will be redrawn at various points, outside of your control,  
and your drawRect: routine must re-draw all previously-drawn ovals  
each time.  This means you have to store the ovals in an array or  
similar and iterate through them each time.


I have an implementation that does this, along with supporting undo/ 
redo and save to file/open from file; I'm happy to send you the source  
if you'd like to refer to it.


-Aron

On 15/07/2008, at 3:53 PM, Jon Buys wrote:


Hello All,
I'm working through the challenge app at the end of Chapter 18 of  
Cocoa
Programming, Third Edition.  I've got my app to the point where it  
can draw
ovals, but each time I click in the window it seems like the view  
redraws
itself.  I'm sure that this is a very simple question with a very  
simple
answer, but I'm stuck.  I've been looking at it for three days now,  
and I

think its time to let another set of eyes look at it.

Any help would be greatly appreciated.

Thanks,

Jon

On a separate note, anyone else working through this book, please  
feel free

to get in touch.  Maybe we can help each other out!

code follows:

ChalkBoard.m:

//

//  ChalkBoard.m

//  OvalDraw

//

//  Created by Jon on 7/10/08.

//  Copyright 2008 __MyCompanyName__. All rights reserved.

//


#import ChalkBoard.h



@implementation ChalkBoard


- (void)drawRect:(NSRect)rect

{

NSRect bounds = [self bounds];

[[NSColor blackColor] set];

[NSBezierPath fillRect:bounds];

NSRect ovalRect = [self currentRect];  //OK, so this should not be  
here,

but where can I put it so the window will remember it and not redraw?

[[NSColor whiteColor] set];

[[NSBezierPath bezierPathWithOvalInRect:ovalRect] stroke];


[oval stroke];

}



#pragma mark Events


- (void)mouseDown:(NSEvent *)event

{

NSLog(@mouseDown: %d, [event clickCount]);

NSPoint p = [event locationInWindow];

downPoint = [self convertPoint:p fromView:nil];

currentPoint = downPoint;

[self setNeedsDisplay:YES];

}



- (void)mouseDragged:(NSEvent *)event

{

NSPoint p = [event locationInWindow];

NSLog(@mouseDragged:%@, NSStringFromPoint(p));

currentPoint = [self convertPoint:p fromView:nil];

[self setNeedsDisplay:YES];


}


- (void)mouseUp:(NSEvent *)event

{

NSPoint p = [event locationInWindow];

NSLog(@mouseUp:%@, NSStringFromPoint(p));

currentPoint = [self convertPoint:p fromView:nil];


[self setNeedsDisplay:YES];


}



#pragma mark Accessors




- (NSRect)currentRect

{

float minX = MIN(downPoint.x, currentPoint.x);

float maxX = MAX(downPoint.x, currentPoint.x);

float minY = MIN(downPoint.y, currentPoint.y);

float maxY = MAX(downPoint.y, currentPoint.y);

return NSMakeRect(minX, minY, maxX-minX, maxY-minY);

}


@end
___

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

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

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

This email sent to [EMAIL PROTECTED]




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Hillegass, Third Edition, Chapter 18

2008-07-15 Thread Jeff Brown
Hi Jon

Just an aside - does Hillegass, Third Edition teach you Core Data?
The blurb on Amazon says it does but when I looked at the index online it 
didn't mention Core Data. 

Jeff 


  Start at the new Yahoo!7 for a better online experience. www.yahoo7.com.au
___

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

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

2008-07-15 Thread Antonio Nunes

On 15 Jul 2008, at 07:44, Jeff Brown wrote:


Just an aside - does Hillegass, Third Edition teach you Core Data?
The blurb on Amazon says it does but when I looked at the index  
online it didn't mention Core Data.


Yes, it does. Chapter 11: Basic Core Data.

António

---
Some things have to be believed to be seen.

--Ralph Hodgson
---



___

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

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

2008-07-15 Thread Glenn Sequeira
+ Chapter 30: Core Data Relationships
 
On Tuesday, July 15, 2008, at 12:02AM, Antonio Nunes [EMAIL PROTECTED] 
wrote:
On 15 Jul 2008, at 07:44, Jeff Brown wrote:

 Just an aside - does Hillegass, Third Edition teach you Core Data?
 The blurb on Amazon says it does but when I looked at the index  
 online it didn't mention Core Data.

Yes, it does. Chapter 11: Basic Core Data.

António

---
Some things have to be believed to be seen.

--Ralph Hodgson
---



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: KVV and the missing Discard Changes button

2008-07-15 Thread Scott Anguish


On 14-Jul-08, at 7:36 PM, Steve Green wrote:



It is not the case.. they both use bindings but in the case where I  
only see 1 button, the NSTextField and bindings are created  
programatically.  Neither bind through controllers.


why?  (NS*)Controller(s) are very important, especially in cases such  
as this (controls that don't necessarily update their content  
automatically)




___

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

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


custom NSButtonCell behaves different/wrong on Leopard

2008-07-15 Thread Mark Sanvitale
Summary of the problem is that I have a custom NSButton subclass which  
accomplishes a roll-over effect (title and background take on a  
special appearance when the mouse is over the cell).  On Leopard,  
these same cells appear to perform a state change on mouse-over (the  
title and the image switch to their alternate state), but the state  
has not actually changed (according to gdb interrogation) and the  
title and image return to the normal state when the mouse leaves the  
cell/button.


Anyone seen this problem?  Anyone know what is/could-be going wrong?

The details:

My custom NSButtonCell subclass defines some new, custom methods, and  
it completely overrides drawBezelWithFrame, while it augments (i.e.  
still call through to super) the methods drawInteriorWithFrame,  
drawTitle, and drawImage.  These cells appear in the window inside of  
a custom NSMatrix subclass which does the necessary mouse event  
handling to accomplish roll-over.


This all works fine and good on Tiger.  On Leopard (with no code  
changes and the binary compiled on either Tiger or compiled against  
the 10.4 sdk on Leopard), the same button behaves wrong.  The title  
and image being passed into the drawTitle and drawImage state are the  
alternates when the mouse is over the button, even though when I  
interrogate the cell in the debugger the state has not changed (still  
NSOffState, i.e. the normal, not alternate state).  I can counteract  
the problem by ignoring the passed in title/image and determining it  
myself according to the current cell state, i.e.


	image = ([self state] == NSOffState) ? [self image] : [self  
alternateImage];
	title = ([self state] == NSOffState) ? [self attributedTitle] : [self  
attributedAlternateTitle];


however, one problem still persists (beyond the obvious confusion as  
to why such a tactic is even necessary) whereby the dimming of the  
image does not happen on mouse-down but, rather, happens on roll-over  
when the button is in the alternate state.


I'm at a loss.  Please help me.

Mark Sanvitale
Exbiblio
[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: Hillegass, Third Edition, Chapter 18

2008-07-15 Thread Antonio Nunes

On 15 Jul 2008, at 04:53, Jon Buys wrote:

I'm working through the challenge app at the end of Chapter 18 of  
Cocoa
Programming, Third Edition.  I've got my app to the point where it  
can draw
ovals, but each time I click in the window it seems like the view  
redraws
itself.  I'm sure that this is a very simple question with a very  
simple
answer, but I'm stuck.  I've been looking at it for three days now,  
and I

think its time to let another set of eyes look at it.


You're constantly asking the whole view to redraw using  
setNeedsDisplay:. You only want to redraw the section of the screen  
that actually needs to be redrawn. I.e: you want to erase the portion  
that encompasses the previous bounds of the path, and draw only the  
portion the encompasses the new bounds of the path. For this there is  
setNeedsDisplayInRect:, plus you need to actually use the rect that is  
passed to you in the drawRect: method, instead of the view's bounds,  
since that tells you exactly what part of the view needs updating.


The following code solves the issue of updating only the required  
area. It does not solve drawing a new rect on every mouseDown while  
maintaining the previously drawn rects. That remains for you as an  
exercise.


Note that there are still problems with this implementation:
1. Copy the code as is and run it. Drag an oval around on the canvas:  
you'll see the problem soon enough. Think about possible causes for  
this. Then comment out the first line in the updateWithOldRect:  
method, and uncomment its second line. Then try again. Make sure you  
understand why the second line solves the issue.
2. Afer step 1, if you drag an oval around long enough, you will find  
that in 2 edge cases some ghosting still occurs. This one I'll leave  
you to figure out on your own, other than stating that the cause  
involves NSUnionRect and the result of the ANRectFromPoints function,  
and that reading the documentation on NSUnionRect should give you a  
good hint as to the cause of the issue and how to solve it.


Have fun,
António

 Header

@interface MyView : NSView {
NSRect  currentRect;
NSPoint downPoint;
}

@end

NSRect ANRectFromPoints(NSPoint p1, NSPoint p2);  // Given two  
corners, make an NSRect.


 Footer ;-)

@implementation MyView

- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
rects = [[NSMutableArray alloc] init];
}
return self;
}

- (void)drawRect:(NSRect)rect {
[[NSColor blackColor] set];
[NSBezierPath fillRect:rect];

[[NSColor whiteColor] set]; 
[[NSBezierPath bezierPathWithOvalInRect:currentRect] stroke];
}

- (void)updateWithOldRect:(NSRect)oldRect
{
[self setNeedsDisplayInRect:NSUnionRect(oldRect, currentRect)]; 
	//[self setNeedsDisplayInRect:NSInsetRect(NSUnionRect(oldRect,  
currentRect), -1, -1)];	

}

- (void)mouseDown:(NSEvent *)event
{   
NSRect oldRect = currentRect;
downPoint = [self convertPoint:[event locationInWindow] fromView:nil];  
currentRect = ANRectFromPoints(downPoint, downPoint);   
[self updateWithOldRect:oldRect];   
}

- (void)mouseDragged:(NSEvent *)event
{   
NSRect oldRect = currentRect;   
	currentRect = ANRectFromPoints(downPoint, [self convertPoint:[event  
locationInWindow] fromView:nil]);

[self updateWithOldRect:oldRect];   
}

- (void)mouseUp:(NSEvent *)event
{   
NSRect oldRect = currentRect;   
	currentRect = ANRectFromPoints(downPoint, [self convertPoint:[event  
locationInWindow] fromView:nil]);

[self updateWithOldRect:oldRect];   
}

@end

inline NSRect ANRectFromPoints(NSPoint p1, NSPoint p2)
{ // Given two corners, make an NSRect.
return NSMakeRect(MIN(p1.x, p2.x), MIN(p1.y, p2.y),
  fabs(p1.x - p2.x), fabs(p1.y - p2.y));
}



There is a world of difference between
searching for happiness and choosing
to be happy.





___

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

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


Calling an Apple Detector

2008-07-15 Thread Laurent Cerveau

Hi

Does anyone know if Is there a way to call an Apple Data Detector from  
Objective-C code. I'd like to use one that recognizes dates and events  
and that is working pretty well in Mail.


Thanks

laurent

___

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

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

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

This email sent to [EMAIL PROTECTED]


how to invoke the authentication dialog

2008-07-15 Thread 李国良
maybe the system have such kind of API that used to popup dialog for
authentication, i means if the user want to run an application which need
the administrator access right, so this dialog popup and request the
administrator's password.
my question is that i can not find out such API, can anyone help me? i


-- 
Best regards to you!

Li Guoliang
MSN: [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]


Keypaths

2008-07-15 Thread Niklas Saers

Hi,
I've implemented a little tree through my class Node that contains the  
properties NSString* name and NSMutableArray *subnodes


I'd love to say something like Give me the nodes that have a grand- 
father named Balbo Baggins and father named Ponto Baggins (should be  
Rosa and Polo Baggins) How do I express this with keypaths? How should  
I make a keypath that returns an array of Nodes and another keypath  
that creates an array of NSStrings with only the name properties of  
the nodes?


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: Hillegass, Third Edition, Chapter 18

2008-07-15 Thread Kyle Sluder
On Tue, Jul 15, 2008 at 7:25 AM, Jon Buys [EMAIL PROTECTED] wrote:
 How can I add a
 rect to an array?  Do I have to convert it first?

Wrap the NSRect in an NSValue using +[NSValue valueWithRect:].

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


how to add modal dialog once application begin to run

2008-07-15 Thread 李国良
the situation like this: when user launch the application, the main
window open, before user click any button in the window, there is a modal
dialog attached to the main window, warning any operation will be
un-protected..., so how to implement it, i have new a cocoa application.
maybe there is an initialization function for the application. i am a new
cocoa programmer, i am very appreciated for your help. thanks.

-- 
Best regards to you!

Li Guoliang
MSN: [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: Toolbar code in separate Controller?

2008-07-15 Thread John Love
As some of you realize, I have a fetish about compartimentalization, that
is, the making of separate files(.h,.m) as much as possible ... and I
erroneously concluded that the only way to do that was via the construction
of multiple Controllers within IB.  It turns out that that is one means when
it logically makes sense, as in the following:

Graham Cox crammed down me a lot of info about isolating the
SheetController(delegate) from the calling Controller, the delegat*or*; for
example, keeping the GUI data isolated within the SheetController and away
from the delegator.  I also learned about anonymous callback id pointers
that allowed me to create a separate Controller for calling sheets.  My
delegator, FileController, called my separate SheetController via the
latter's ShowSheet method.  I passed *self* from FileController as the
delegator to ShowSheet, within which the passed delegator was typed as an
anonymous id at the top of SheetController's implementation file.

 - (void) showSheet:(NSWindow*)parentWindow
delegator:(id)theDelegator
contextInfo:(void*)contextInfo {
 mFileCtrlDelegator = theDelegator;   // typed as id at the top

 [NSApp beginSheet:[self window]
   modalForWindow:parentWindow
   modalDelegate:self
   didEndSelector:@selector
(sheetDidEnd:returnCode:contextInfo:)
   contextInfo:contextInfo];
 [NSApp runModalForWindow:[self window]];
 }

Within SheetController's sheetDidEnd, I call:

 [mFileCtrlDelegator doSheetSelection:returnCode
contextInfo:contextInfo];

Since mFileCtrlDelegator is anonymous-ly typed as an id pointer within my
showSheet, I include the informal protocol:

 @interface NSObject (SheetController)
 - (void) doSheetSelection:(int)returnCode
contextInfo:(void*)contextinfo;
 @end

within SheetController's interface file.  The protocol is deliberately
anonymous to match showSheet's theDelegator so I do not get a compile
error.  The *real* doSheetSelection: lives in my delegator, FileController.
The anonymous id pointer is resolved at run-time, thus calling the *real*,
i.e. FileController's, doSheetSelection.  Everything works just as Graham
Cox taught ... and the real miracle is I believe I finally understand it,
and everything else Graham taught me.

My next challenge was to get various Menu Items to dim or not, depending on
the values of certain instance variables within that same FileController
object ... which is the only IBOutlet of MyDocument that I created.

As stated at the top, I erroneously concluded that the only way to achieve
compartimentalization (separate files) was via the creation of separate
Controllers within IB ... *wrong* ... and that is when I came across
Categories, and Extensions.

At the discovery of Categories, I noted Apple's words You can also use
categories to distribute the implementation of a new class into separate
source files—for example, you could group the methods of a large class into
several categories and put each category in a different file.

God is good ... I can compartimentalize (or, make separate files) using
separate Controllers as in Sheets, or via categories ... and I needed
categories because otherwise I would have had to play with the Responder
Chain had I chosen a separate Controller and, quite frankly, I do not know
how to do that.  MyDocument is already in the Responder Chain, so leave
well-enough alone.

So, I then created MyDocument+MenuCategory(.h,.m), within which I override
Apple's validateMenuItem: to use the values of several instance variables of
FileController to enable or disable one or more of the several MenuItems.
If I had any instance variables unique to MenuCategory, I would have to
place them in the main MyDocument.h because only instance methods are
permitted in the category's interface.  Within the category method I can
access the instance variables of FileController because the FileController
object is the only outlet of MyDocument (or the root) that I created.

Not only do categories work, but I also believe that I understand them.  I
view a category as an addition whereby unique capabilities or actions are
added to the root.  MyDocument is the root and MenuCategory is the
addition.  The root has all the required instance variables (the
original plus those added for the addition), and the addition adds new
actions using the added instance variables.  I'm tempted to use extension,
instead of addition because extension is really more meaningful, at
least for me.  However, Apple uses extension to mean something a little
bit different, as explained in Apple's Objective-C pdf.

The validateMenuItem: message is sent to the File's Owner = MyDocument,
which is the root that has been added to .. and it is the File's Owner
that is the target of the menu actions.

The category is not a new, separate class, just an addition 

Re: What is the best way?

2008-07-15 Thread Ronnie B
awakeFromNib was my first guess.  Thanks for the pointers.



On Mon, Jul 14, 2008 at 4:07 PM, Scott Ribe [EMAIL PROTECTED]
wrote:

  Thats correct.  The main window is not covered up.  The second window is
 not
  modal I agree.  In the second window I just need to collect some
 additional
  info that will go the the second's window controller.  There will be OK
 and
  Cancel buttons on that window to close it.  The main window will not
 change
  after.
 

 OK, so I think the bits you are looking for are:

 - the screen method of NSWindow to find what screen your main window is on

 - the visibleFrame method of NSScreen to get the bounds of that screen,
 less
 the menu bar and dock

 - the frame method of NSWindow to get the location of your main window

 - the setFrame:display: method of NSWindow to adjust the locations of your
 main  settings windows so they don't overlap

 You may also want to look at the awakeFromNib method in your controller,
 because that's a good point to do all this, the window size and location
 will be set from the nib, but it won't be displayed yet, and you can
 position it there, and it will be displayed at the location you set with
 any
 visible blink or move.

 Personally, I would consider displaying the settings window as a sheet on
 the main window, and require the user to choose the settings before
 proceeding--unless you think the user needs to see the main window while
 making the settings...

 --
 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: Hillegass, Third Edition, Chapter 18

2008-07-15 Thread Antonio Nunes

On 15 Jul 2008, at 12:25, Jon Buys wrote:

Thanks for your help, I'm going through your code now, comparing it  
to my old code and reading the documentation.  NSUnionRect doesn't  
seem to be much help in the docs though:


Returns the smallest rectangle that completely encloses both aRect  
and bRect. If one of the rectangles has 0 (or negative) width or  
height, a copy of the other rectangle is returned; but if both have  
0 (or negative) width or height, the returned rectangle has its  
origin at (0.0, 0.0) and has 0 width and height.


-http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#/ 
/apple_ref/c/func/NSUnionRect


Can you explain a little more why this results in the ghosting I saw  
in the view earlier?


The constant ghosting you saw when you first ran my code unmodified  
has very little to do with the NSUnionRect function. If you then  
swapped the commenting in


- (void)updateWithOldRect:(NSRect)oldRect
{
[self setNeedsDisplayInRect:NSUnionRect(oldRect, currentRect)]; 
	//[self setNeedsDisplayInRect:NSInsetRect(NSUnionRect(oldRect,  
currentRect), -1, -1)];	

}

... so that the second line gets executed instead of the first, you  
would see that the ghosting has as good as disappeared. However: if  
you narrow down an oval either horizontally or vertically to the  
thinnest possible width, and then drag straight into the visible line,  
you should still get some ghosting. If you setup to watch the values  
of oldRect and currentRect in the console (use a breakpoint that you  
edit to autocontinue and that logs these values to the console), then  
play around dragging extremely thin ovals, you should see an  
interesting pattern logged whenever the ghosting is triggered. The  
NSUnionRect documentation quoted above really provides the clue. It  
points to an edge case and you will want to find out if, and if so,  
why, that edge case happens.


António

-
Accepting others as they are
brings a wonderful freedom
to your own mind.

--The Peace Formula
-




___

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

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


IBPlugin cannot load

2008-07-15 Thread Anders Lassen

Hi,

I am pretty new to Xcode, and I hoped that I could create some custom  
controls using the Interface Builders plugin facility.


But ...

After completing all step in Chapter 2 in Interface Builder Plug-In  
Programming Guide, I cannot load the Plug-In. I get a error dialog  
saying:


The bundle MyButton could not be loaded because is is damaged or  
missing necessary resources.


This is very strange, since I followed the Plug-In Quick Start tour  
very carefully.


Steps to Reproduce:

1) Follow Chapter 2, or just build a plugin using the Xcode template
2) Load the plugin from Interface Builders preference window


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] Any document that shows differences of Cocoa programming for Mac and for the iPhone/iPod touch?

2008-07-15 Thread Stefan Arentz


On Jul 14, 2008, at 11:50 PM, Stefan Arentz wrote:



On Jul 14, 2008, at 4:15 PM, JongAm Park wrote:

...

(Well, I just looked up NSViewController document and it says  
that it was added to the Leopard.
Is there any document which explains why it is added and how the  
programming model is changed due to the addition of it? )


The NSViewController documentation does a good job. The Overview  
section outlines three things that the NSViewController will handle  
for you.


I have not used the NSViewController in my project. But I think it  
is mostly useful when you want to load a (custom) view from a NIB/ 
XIB file and hook it up to a bindings enabled data source.


For me the class reference is a bit dry. I would love to read more  
in the style of WHY you would want to use a certain class. A more  
pragmatic 'recipe' style documentation.


Just found this, should be interesting for other people ...

 http://katidev.com/blog/2008/04/09/nsviewcontroller-the-new-c-in-mvc-pt-1-of-3/
 http://katidev.com/blog/2008/04/17/nsviewcontroller-the-new-c-in-mvc-pt-2-of-3/
 http://katidev.com/blog/2008/05/26/nsviewcontroller-the-new-c-in-mvc-pt-3-of-3/

S.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Animation: Disabling Implicit Animations

2008-07-15 Thread Chilton Webb

Hi,

I am in the same boat. I have an NSTextView inside an NSScrollView  
that shows the default transitions when new text is added, or when the  
scroll view is resized. I don't want that.


However, I can't figure out where to override the default transition.

I subclassed both the NSTextView and the NSScrollView it's contained  
in, and put this in the subclass:


+ (id)defaultAnimationForKey:(NSString *)key
{
NSLog(@Animation Keys Are: [EMAIL PROTECTED],key);
return nil;
}

... I noticed that this function is only called once (when the nib is  
loaded), and the transitions still happen. What am I doing wrong?


Thank you!
-Chilton Webb

On Jun 24, 2008, at 9:52 PM, Scott Anguish wrote:


at the core animation level...

three options

1: disable actions in a explicit transaction and do everything  
inside that transaction


http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Transactions.html#/ 
/apple_ref/doc/uid/TP40006096-SW9


or 2:http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Actions.html#/ 
/apple_ref/doc/uid/TP40006095-SW9


basically, set the action to NSNull (listing 3)

3: override the default action method and return NSNull unless some  
condition you've already specified is true.


same chapter I think.


On Jun 24, 2008, at 6:11 PM, Wil Gieseler wrote:

Hello, a (hopefully) quick question. I have a view which I would  
like to use some Core Animation transitions on, so I've set it to  
[theContentView setWantsLayer:YES]. However, this causes all of its  
subviews to automatically gain fade transitions (which is the  
expected behavior). However, some of the subviews are a WebView and  
an IKImageBrowserView which apparently do not play nice with the  
automatic transitions and create some ugly funky behavior (the  
image browser view does not display anything at all). I simply want  
to disable ALL implicit transitions/animations and only animate  
when I explicitly tell the view to. How is this best accomplished?



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/chilton%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: Toolbar code in separate Controller?

2008-07-15 Thread Graham Cox
I should be careful about claiming what I told you and then posting  
code that definitely did *NOT* come from me.


What on earth is a delegator? Do you mean 'delegate'? I believe that  
is the terminology I used, and with good reason - it's the normal  
jargon for this design pattern (not just on Cocoa and Obj-C but most  
other languages too). In normal English, a 'delegator' would be one  
who delegates. That's not what the object is in this case, it's the  
delegate - the one who is delegated *TO*. I strongly advise you stick  
to convention because persisting with your own non-standard  
terminology will make your code difficult for others to understand,  
and will impede your own understanding of standard concepts in the  
long run.


In this case, the target object is quite definitely the delegate. If  
you think otherwise, you have missed something.


I also advised you to name your methods to be self-describing.  
Somewhere you seem to have gone backwards.


What I actually suggested was:

- (void) showSheetOnParentWindow:(NSWindow*) parent withDescription: 
(NSString*) msg delegate:(id) target contextInfo:(void*) contextInfo;


and

- (void) proceedWithReturnCode:(int) returnCode contextInfo:(void*)  
contextInfo;


which is intended to be self-describing, and eliminates implied  
implementations in one controller being exposed in the other. That's  
why my callback quite deliberately does not mention sheets! Ideally  
the other method shouldn't mention them either - I slipped up there.


Good method naming is not always easy, but some thought should be put  
into it. A good method name almost doesn't require documenting - it  
tells you what it does and what its parameters mean.




Graham


On 15 Jul 2008, at 11:13 pm, John Love wrote:

Graham Cox crammed down me a lot of info about isolating the  
SheetController(delegate) from the calling Controller, the  
delegat*or*; for example, keeping the GUI data isolated within the  
SheetController and away from the delegator.  I also learned about  
anonymous callback id pointers that allowed me to create a separate  
Controller for calling sheets.  My delegator, FileController, called  
my separate SheetController via the latter's ShowSheet method.  I  
passed *self* from FileController as the delegator to ShowSheet,  
within which the passed delegator was typed as an anonymous id at  
the top of SheetController's implementation file.


 - (void) showSheet:(NSWindow*)parentWindow
delegator:(id)theDelegator
contextInfo:(void*)contextInfo {
 mFileCtrlDelegator = theDelegator;   // typed as id at the  
top


 [NSApp beginSheet:[self window]
   modalForWindow:parentWindow
   modalDelegate:self

didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)

   contextInfo:contextInfo];
 [NSApp runModalForWindow:[self window]];
 }

Within SheetController's sheetDidEnd, I call:

 [mFileCtrlDelegator doSheetSelection:returnCode  
contextInfo:contextInfo];


Since mFileCtrlDelegator is anonymous-ly typed as an id pointer  
within my showSheet, I include the informal protocol:


 @interface NSObject (SheetController)
 - (void) doSheetSelection:(int)returnCode contextInfo: 
(void*)contextinfo;

 @end


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa : Drag/ drop from a table view onto a NSTextfield

2008-07-15 Thread vibhatha v
Hi,

I tried using concludeDragOperation method, but for some reason, it is not
getting called.

I did the following:
1. I created a controller which has a table view that serves as a drag/ drop
source.
Registered for the dragged types: NSTabularTextPboardType and
NSStringPboardType
Implemented the drag/ drop methods in the controller.

2. Created a subclass of NSTextField.
Implemented the methods, draggingEntered, draggingExited,
performDragOperation, concludeDragOperation, prepareForDragOperation in this
class.

3. The drag/ drop destination is another controller, in which the text field
exists as an outlet (of type custom class of NSTextField)

Now, when i drag and drop from table view onto the text field,
draggingEntered, draggingExited methods are called, where as the
performDragOperation, concludeDragOperation are not getting called.
Could you please tell me if i am missing something here?


Thanks,
Vibhatha



On Sun, Jul 13, 2008 at 12:43 PM, vibhatha v [EMAIL PROTECTED] wrote:

 Hi,

 I wanted some inputs regarding drag/ drop functionality in cocoa.
 I have two scenarios as below:

 1. I have a text field and a table view in 2 different windows.
 I drag and drop a row from the table view to the textfield.
 Now, after drop, i would want to have a database transaction.
 I would want to validate the text that i have dropped onto the text field,
 and save the text that i have dropped onto the text field in the database.
 Could you please let me know as to which method can i use to tell me that
 the drop has been completed? So that i can do my front end validations on
 the text that i have dropped.
 2. Suppose a text is already present in a text field. Now, since the text
 field is editable, i can drag and drop another row of the table view onto
 this text field.
  Now, the new text would be superimposed on the old text in the text field.
 Is there a way, i can prevent this from happening?


 Thanks and Regards,
 Vibhatha


___

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

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


Disc Burns, but is unreadable

2008-07-15 Thread J. Todd Slack

Hi All,

(I tried posting to the Disc-Recording List, but no replies.)

I have been troubleshooting an issue where I burn a DVD and the burn  
process happens, but the resulting disc is unreadable once burned. I  
insert the disc after burning and I am told it is unreadable.


This never happened except on Leopard.

I am doing something similar to the following:

[burn setLaunchPath:@/usr/bin/hdiutil];

	[burn setArguments:[NSArray  
arrayWithObjects:@burn,imagePath,burnVerify,@-speed,burnSpeed,@- 
verbose,@-noforceclose,@-device,drivePath,nil]];


	// And release the DRDevice here, just in case another application is  
holding it reserved.
	[[DRDevice deviceForIORegistryEntryPath:drivePath]  
releaseExclusiveAccess];
	[[DRDevice deviceForIORegistryEntryPath:drivePath]  
releaseMediaReservation];


[burn setStandardOutput:pipe];
[burn setStandardError:errorPipe];
handle=[pipe fileHandleForReading];
errorHandle=[errorPipe fileHandleForReading];

	[progressMessage setStringValue:  
NSLocalizedStringFromTable(@BURN_DIALOG_11_KEY, @Localized, nil)];


	[NSThread detachNewThreadSelector:@selector(copyStdOut:)  
toTarget:self withObject:handle];
	[NSThread detachNewThreadSelector:@selector(copyStdErr:)  
toTarget:self withObject:errorHandle];


[burn launch];

Can anyone provide advice?

Thanks!

-Jason
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Implementing search and index combo, like Contacts?

2008-07-15 Thread Michael Dupuis
I'm assuming the NDA has been lifted now, so here goes: I'm trying to
implement a combination search and index list, in the same way that
the 2.0 Contacts application does things, but I'm having trouble
getting anything to work as expected.

The first problem encountered is that you need to shorten the search
field, to accommodate the index along the right-hand side, otherwise
it overwrites the search field. Nothing I do has changed the search
field from spanning the full width though. I'm grabbing the first item
from the UISearchBar subviews, and resizing it in both my controller
init method, and in my viewDidAppear and viewWillAppear methods, but
nothing changes, it always spans the full width when the view is
displayed, even though I've updated the rect (and printing the rect
confirms that I've changed the bounds).

I've also tried setting the autoresizingMask to UIViewAutoresizingNone
thinking that this might be the problem, but this also showed no
change.

Another thing I've noticed is that adding the search field doesn't
automatically add the search icon to the top of the index. I assumed
that it would, but I'm guessing this is also custom code? It'd be
really nice if this were free. That said, how are we even supposed
to add this icon? You can return the letters for the index, as they
are strings, but I don't see a way to return an image (unicode symbol
maybe?).

I assume I'm not the only one who is trying to emulate this new 2.0
behavior so hopefully this query will help others as well. (Bonus
points for ideas on how to shift the index over when the user starts
to type a search string...)
___

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

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


NSMessagePort Invalidation

2008-07-15 Thread Ryan Brown
NSMessagePort doesn't seem to post the  
NSPortDidBecomeInvalidNotification notification when the remote port  
dies. It doesn't seem to matter if the remote port is closed via the  
invalidate method or by killing the process. The only way I am seeing  
the notification posted is when I send invalidate to the port locally.


This seems contrary to the documentation:

Posted from the invalidate method, which is invoked when the NSPort  
is deallocated or when it notices that its communication channel has  
been damaged.


Is this a legit bug or have I missed something?

Ryan
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Implementing search and index combo, like Contacts?

2008-07-15 Thread Paul Bailey
Your assumption is sadly incorrect.

On Tue, Jul 15, 2008 at 3:48 PM, Michael Dupuis [EMAIL PROTECTED]
wrote:

 I'm assuming the NDA has been lifted now, so here goes: I'm trying to
 implement a combination search and index list, in the same way that
 the 2.0 Contacts application does things, but I'm having trouble
 getting anything to work as expected.

 The first problem encountered is that you need to shorten the search
 field, to accommodate the index along the right-hand side, otherwise
 it overwrites the search field. Nothing I do has changed the search
 field from spanning the full width though. I'm grabbing the first item
 from the UISearchBar subviews, and resizing it in both my controller
 init method, and in my viewDidAppear and viewWillAppear methods, but
 nothing changes, it always spans the full width when the view is
 displayed, even though I've updated the rect (and printing the rect
 confirms that I've changed the bounds).

 I've also tried setting the autoresizingMask to UIViewAutoresizingNone
 thinking that this might be the problem, but this also showed no
 change.

 Another thing I've noticed is that adding the search field doesn't
 automatically add the search icon to the top of the index. I assumed
 that it would, but I'm guessing this is also custom code? It'd be
 really nice if this were free. That said, how are we even supposed
 to add this icon? You can return the letters for the index, as they
 are strings, but I don't see a way to return an image (unicode symbol
 maybe?).

 I assume I'm not the only one who is trying to emulate this new 2.0
 behavior so hopefully this query will help others as well. (Bonus
 points for ideas on how to shift the index over when the user starts
 to type a search string...)
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: iPhone: Implementing search and index combo, like Contacts?

2008-07-15 Thread Michael Kaye
unfortunately it's still in place...no idea when it will be lifted but  
the moderators have said they will inform us.


Sorry mate, I'm desperate to ask questions as well.

On 15 Jul 2008, at 15:48, Michael Dupuis wrote:


I'm assuming the NDA has been lifted now, so here goes: I'm trying to
implement a combination search and index list, in the same way that
the 2.0 Contacts application does things, but I'm having trouble
getting anything to work as expected.

The first problem encountered is that you need to shorten the search
field, to accommodate the index along the right-hand side, otherwise
it overwrites the search field. Nothing I do has changed the search
field from spanning the full width though. I'm grabbing the first item
from the UISearchBar subviews, and resizing it in both my controller
init method, and in my viewDidAppear and viewWillAppear methods, but
nothing changes, it always spans the full width when the view is
displayed, even though I've updated the rect (and printing the rect
confirms that I've changed the bounds).

I've also tried setting the autoresizingMask to UIViewAutoresizingNone
thinking that this might be the problem, but this also showed no
change.

Another thing I've noticed is that adding the search field doesn't
automatically add the search icon to the top of the index. I assumed
that it would, but I'm guessing this is also custom code? It'd be
really nice if this were free. That said, how are we even supposed
to add this icon? You can return the letters for the index, as they
are strings, but I don't see a way to return an image (unicode symbol
maybe?).

I assume I'm not the only one who is trying to emulate this new 2.0
behavior so hopefully this query will help others as well. (Bonus
points for ideas on how to shift the index over when the user starts
to type a search string...)
___

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

Please do not post admin requests or moderator comments to the list.
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]


Re: Toolbar code in separate Controller?

2008-07-15 Thread Andy Lee

On Jul 15, 2008, at 9:13 AM, John Love wrote:
To tell you the truth, I *really* prefer calling a category an  
extension

because extension just sounds more meaningful to me.  Or, maybe just
plain, ole, generic addition.  Category just sounds like type  
of or a

sub-class, but it's not that at all.

Yes, we're discussing words, but words are important ..  Look up  
category
in a dictionary where it talks about classification.  To me,  
classification

means sub-class.


The normal English meaning of category applies to the methods, not  
the object.  For example, a controller class might have a bunch of  
accessor methods and a bunch of action methods.  I think of each of  
those bunches as categories of methods.  When you extend a class with  
a category in the Objective-C sense, you're typically creating a  
logical bunch.  You typically use a logical name for the bunch as  
the name of your category.


Grepping for category declarations in, say, Foundation shows how  
category names identify logical grouping of methods:


% cd /System/Library/Frameworks/Foundation.framework/Headers
% grep @interface *.h | grep (
NSArchiver.h:@interface NSObject (NSArchiverCallback)
NSArray.h:@interface NSArray (NSExtendedArray)
NSArray.h:@interface NSArray (NSArrayCreation)
NSArray.h:@interface NSMutableArray (NSExtendedMutableArray)
NSArray.h:@interface NSMutableArray (NSMutableArrayCreation)
NSAttributedString.h:@interface NSAttributedString  
(NSExtendedAttributedString)
NSAttributedString.h:@interface NSMutableAttributedString  
(NSExtendedMutableAttributedString)

NSCalendarDate.h:@interface NSDate (NSCalendarDateExtras)
NSCalendarDate.h:@interface NSDate (NSNaturalLangage)
...(a hundred or so more)...

--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] Any document that shows differences of Cocoa, programmiing for Mac and for the iPhone/iPod touch?

2008-07-15 Thread JongAm Park

Thanks for the reply, Mr. Arentz.
Yeah.. I read the document but it doesn't really give me some idea on 
why it is made and why we need to use it.

Until the Tiger, views in a NIB file could be loaded, couldn't it?
So, I agree with your last comment. :)

The NSViewController documentation does a good job. The Overview  
section outlines three things that the NSViewController will handle  
for you.


I have not used the NSViewController in my project. But I think it is  
mostly useful when you want to load a (custom) view from a NIB/XIB  
file and hook it up to a bindings enabled data source.


For me the class reference is a bit dry. I would love to read more in  
the style of WHY you would want to use a certain class. A more  
pragmatic 'recipe' style documentation.


  S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: iPhone: Implementing search and index combo, like Contacts?

2008-07-15 Thread Steve Christensen

On Jul 15, 2008, at 7:48 AM, Michael Dupuis wrote:


I'm assuming the NDA has been lifted now...


Nope, still under NDA, as mentioned a few days ago:


From: Cocoa Dev Admins [EMAIL PROTECTED]
Date: July 10, 2008 7:01:39 PM PDT
To: Cocoa-Dev List cocoa-dev@lists.apple.com
Subject: [Moderator] iPhone SDK is still under NDA - Do not discuss  
openly.


Until an announcement is made otherwise, developers should be aware  
that the iPhone SDK is still under non-disclosure. It can't be  
discussed here, or anywhere publicly. This includes other mailing  
lists, forums, and definitely blogs.


___

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

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

2008-07-15 Thread Daniel Richman

Stefan Arentz wrote:



Hi Jon

Just an aside - does Hillegass, Third Edition teach you Core Data?
The blurb on Amazon says it does but when I looked at the index 
online it didn't mention Core Data.


No it does not teach you Core Data.

There are two Core Data chapters but they are more 'click here, type 
that, drag this, connect it to that' style chapters to get a simple 
Core Data application going. Which is fine to get started but it 
basically contains zero information about Core Data APIs.




I disagree. There is a lot of click here, drag this, etc., but would say 
I learned how to create simple Core Data apps, and I understand pretty 
much how the process works. My project right now is a to-do list program 
whose basic saving, undos, etc. is handled by Core Data.


I think you're right, though, about the APIs. You learn how to _use_ it, 
but not why and how it works the way it works.


Of course, that's what Apple's documentation is great for. (Among other 
things.)


Daniel
___

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

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

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

This email sent to [EMAIL PROTECTED]


CALayer with checkered background like Photoshop's

2008-07-15 Thread Richard Henry

Hello

I'm just beginning with Core Animation so sorry if this is a noob  
question. I searched but couldn't find anything relevant here or on  
google.


Is it possible to use a CICheckerboardGenerator filter to fill the  
entire background of a CALayer so that I get a similar effect to that  
which Photoshop has when the content is transparent?
I've tried a lot of things but the filters only seem to want to work  
on the content.


Any ideas? Is there another way to do this?

Thanks

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CALayer with checkered background like Photoshop's

2008-07-15 Thread Randall Meadows

On Jul 15, 2008, at 10:19 AM, Richard Henry wrote:

Is it possible to use a CICheckerboardGenerator filter to fill the  
entire background of a CALayer so that I get a similar effect to  
that which Photoshop has when the content is transparent?
I've tried a lot of things but the filters only seem to want to work  
on the content.


Any ideas? Is there another way to do this?


I *just* did this, but did not use it in a CALayer.  I simply created  
the CIImage from the generator, and then used the -drawImage... method  
on the CIContext to draw it in my view's -drawRect: method.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem on reload data source of a table view

2008-07-15 Thread JArod Wen
You are right. I found that the - 
tableView:objectValueForTableColumn:row: has never been called... Any  
way to fix this problem?


On Jul 13, 2008, at 1:43 AM, Jens Alfke wrote:



On 12 Jul '08, at 10:35 PM, JArod Wen wrote:

The problem is that after I update the data source, which is  
tableSource in tableController, [dataTable reloadData] will not  
update the table view in the window


You're sure that, at runtime, 'dataTable' is not nil? It's easy to  
overlook an outlet when wiring up the nib, and a nil object pointer  
acts as a no-op.


If that's not the problem, add an NSLog call to your - 
objectValueForTableColumn: method, so you can see whether it's  
getting called again after you call reloadData.


—Jens


---
JArod Wen




___

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

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


Detect/Disable Font Fallbacks in NSLayoutManager

2008-07-15 Thread Chip Bradford
I'm working on a program to generate bitmap font textures to use with  
OpenGL to render text. I have things mostly working, but I seem to run  
into issues when a font doesn't contain a glyph for a certain  
character and OS X uses a fallback font to render the glyph (at least,  
I believe this is what's happening).


My basic setup is that I have a bunch of single character strings,  
each with their own NSLayoutManager, NSTextStorage, and  
NSTextContainer. I loop through these objects to get a bounding  
rectangle for each character, and then draw the character to an  
NSBitmapImageRep.


The important bits are:

NSFont *myFont = [[NSFontManager sharedFontManager] selectedFont];
NSDictionary * attsDict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSColor whiteColor], NSForegroundColorAttributeName,
myFont, NSFontAttributeName,
nil];
textStorage.font = myFont;

	NSRect rect = [myFont boundingRectForGlyph:[layoutManager  
glyphAtIndex:0]];

[textStorage.string drawAtPoint:drawPoint withAttributes:attsDict];


This works great for normal characters in normal fonts, but when I  
tried a font like Computer Modern (which doesn't even contain a full  
set of ascii characters in a single font file) I still get all the  
characters to render, but the bounding boxes for some are wrong.


What seems to be happening is the [NSString  
drawAtPoint:withAttributes:] method is happily performing font  
substitution to render the missing glyphs, and [NSLayoutManager  
glyphAtIndex:] method is giving me the glyphID in that fallback font  
as well. However, I have no way of knowing when I'm getting back  
glyphIDs from my chosen font and when I'm getting glyphIDs from the  
fallback font (nor do I know what that fallback font is) so I can't  
figure out how I would go about looking up the correct bounding boxes.  
(I end up looking up the bounding-box for the glyphID in the wrong  
font).


Looking through the docs, it appears that I can disable font fallbacks  
if I switch to using ATSUI methods, but I'd really like to stick with  
the AppKit objects if possible. Is there any way to either disable an  
NSLayoutManager from using fallback fonts (so it just renders a dummy  
or blank glyph) or to detect when the fallback is happening so I have  
a chance to compute the correct bounding boxes in those cases?


Thanks,
- Chip
___

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

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

2008-07-15 Thread John Love
 Well, what are you asking? Does the code work or not? If not, what are the
 symptoms?


Yes, it works without a shred of doubt .. I'm just trying to get my hands
around Category .. there is no doubt whatsoever that unless I use
Category, no one will know what I'm talking about .. it just would be nice
if Cocoa's Category would meld with Merriam Webster's definition of
category .. probably too much to ask.

Programmers are rarely accused of using plain English all the time,
anyway.

Cheers,

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

2008-07-15 Thread Hamish Allan
On Tue, Jul 15, 2008 at 11:48 AM, Niklas Saers [EMAIL PROTECTED] wrote:

 Hi,
 I've implemented a little tree through my class Node that contains the
 properties NSString* name and NSMutableArray *subnodes

 I'd love to say something like Give me the nodes that have a grand-father
 named Balbo Baggins and father named Ponto Baggins (should be Rosa and Polo
 Baggins) How do I express this with keypaths?

I don't believe you can. Keypaths can contain certain expressions such
as @max or @sum but not arbitrary relations.

If you were using Core Data, expressing your familial relations as
to-many relationships with inverses, it would be straightforward to
achieve the query you want (and indeed, to create a GUI for that
query). You would get an NSSet of the results which you could display
in a table with just a single column for name, or whatever other
presentation suited you best.

Hamish
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how to add modal dialog once application begin to run

2008-07-15 Thread Hamish Allan
On Tue, Jul 15, 2008 at 1:15 PM, 李国良 [EMAIL PROTECTED] wrote:

 the situation like this: when user launch the application, the main
 window open, before user click any button in the window, there is a modal
 dialog attached to the main window, warning any operation will be
 un-protected..., so how to implement it, i have new a cocoa application.
 maybe there is an initialization function for the application. i am a new
 cocoa programmer, i am very appreciated for your help. thanks.

The application's delegate (see
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html)
is sent a message applicationDidFinishLaunching: when everything else
has been initialised -- you can launch your modal dialog from there.

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: Detect/Disable Font Fallbacks in NSLayoutManager

2008-07-15 Thread Douglas Davidson


On Jul 15, 2008, at 10:54 AM, Chip Bradford wrote:

What seems to be happening is the [NSString  
drawAtPoint:withAttributes:] method is happily performing font  
substitution to render the missing glyphs, and [NSLayoutManager  
glyphAtIndex:] method is giving me the glyphID in that fallback font  
as well. However, I have no way of knowing when I'm getting back  
glyphIDs from my chosen font and when I'm getting glyphIDs from the  
fallback font (nor do I know what that fallback font is) so I can't  
figure out how I would go about looking up the correct bounding  
boxes. (I end up looking up the bounding-box for the glyphID in the  
wrong font).


You can get the substituted font easily--just ask the text storage for  
the value of the font attribute for the corresponding character.   
However, you might be better off asking the layout manager for  
geometry information rather than asking the font for the bounding  
box.  In general, of course, you can't assume a one-to-one  
correspondence between characters and glyphs, so single-character  
strings won't reproduce all of the features of general layout.


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]


[[NSDate alloc] initWithString] crashes with valid string

2008-07-15 Thread Markus Spoettl

Hi List,

  I've a problem I am failing to track down (let alone understand)  
for a couple of weeks now. My application imports XML files that  
contain - amongst other things - dates. Once in a while, the string to  
date conversion causes a crash (EXC_BAD_ACCESS):


#0  0x90b1da14 in ures_getIntVector
#1  0x90b20eb0 in icu::Calendar::setWeekCountData
#2  0x90b1f463 in icu::GregorianCalendar::GregorianCalendar
#3  0x90b1ee16 in icu::Calendar::createInstance
#4  0x90b1c73e in ucal_open
#5  0x940a097b in __CFCalendarCreateUCalendar
#6  0x940a0a22 in __CFCalendarSetupCal
#7  0x940a15d7 in _CFCalendarComposeAbsoluteTimeV
#8  0x95428cbc in -[NSCFCalendar dateFromComponents:]
#9  0x9542879b in -[NSDate(NSDate) initWithString:]

This specific crash happened with the string: 2008-05-09 19:47:47  
+, which seems perfectly valid input for NSDate -initWithString:.


The string appears to be a valid object - if it is any indication (I  
don't know if it is) the debugger tells me the string value on the  
call stack just fine.


Any ideas what could be causing something like this?

Thanks!
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: KVO notifications and threads

2008-07-15 Thread Jerry Isdale
So I'm a bit confused by the ability to do bindings in IB, but if the  
data is updated anywhere but on the MainThread, your program may be in  
trouble.

This kinda blows out the use of KVO bindings in the UI to me.

If data comes in over the network, then the receiving tool must do the  
actual set calls on the MainThread.

that or we use something completely different.

If data is used as the left side (assignment) in a calculation, then  
the calculation must stop and do that assignment on MainThread, wait  
for its completion, and then restart.


So what probably happens is that you have two models... one that is  
the real data calculation, and one that gets updated on the main  
thread.  It would be the latter that actually gets observed.

That is -
1) network receiver captures packets, updates CalculationModel,  
possibly invoking calculation action

2) calculation function does its stuff, updating the CalculationModel
3) calculation model creates a Dictionary of all updated variables
4) calculation model invokes a selector on main thread to update View  
Model using dictionary

5) main thread executes update selector
6) updates trigger KVO of View objects

Means we have at least three copies of the data shuffling around  
memory, but hey thats why we buy machines with 2-4 Gb of ram.
and multiple processors/cores that sit idle (or run adobe updater in  
the background)


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]


Re: Problem on reload data source of a table view

2008-07-15 Thread JArod Wen
After the application was running, I debugged the code and checked the  
classes of TableController and TableSource. They are all connected in  
runtime.


For table view, I only connected it to TableController - dataTable,  
and its dataSource to TableController - tableSource. All of them are  
connected properly in runtime.


On Jul 15, 2008, at 1:45 PM, j o a r wrote:



On Jul 15, 2008, at 10:36 AM, JArod Wen wrote:

The dataSource of TableView is connected to tableSource. There is a  
TableController containing two IBOutlets to both tableSource and  
dataTable. Then dataTable.dataSource is connected to tableSource in  
IB. Anything I lost here?



You might want to verify, at runtime, that this connection is set.  
You can do this either in the debugger, or just using a standard  
debug log statement.


Btw.: Have you set up any bindings for this table view?

j o a r




---
JArod Wen




___

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

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

2008-07-15 Thread Tommy Nordgren


On 15 jul 2008, at 13.25, Jon Buys wrote:


...snip
Drawing a new rect on every mouseDown is the main problem I'm having  
now,
but I think it's because I'm not adding the rect to an  
NSMutableArray.  I'm
working on that now, but I've run out of time this morning.  How can  
I add a

rect to an array?  Do I have to convert it first?


...
Don't even think about storing the NSRects in an NSArray.
NSRect is a struct -- not a class
Instead store NSBezierPath instances, or create an oval class.
---
See the amazing new SF reel: Invasion of the man eating cucumbers from  
outer space.
On congratulations for a fantastic parody, the producer replies :  
What parody?


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]


Re: Detect/Disable Font Fallbacks in NSLayoutManager

2008-07-15 Thread Chip Bradford

On Jul 15, 2008, at 2:13 PM, Douglas Davidson wrote:



On Jul 15, 2008, at 10:54 AM, Chip Bradford wrote:

What seems to be happening is the [NSString  
drawAtPoint:withAttributes:] method is happily performing font  
substitution to render the missing glyphs, and [NSLayoutManager  
glyphAtIndex:] method is giving me the glyphID in that fallback  
font as well. However, I have no way of knowing when I'm getting  
back glyphIDs from my chosen font and when I'm getting glyphIDs  
from the fallback font (nor do I know what that fallback font is)  
so I can't figure out how I would go about looking up the correct  
bounding boxes. (I end up looking up the bounding-box for the  
glyphID in the wrong font).


You can get the substituted font easily--just ask the text storage  
for the value of the font attribute for the corresponding  
character.  However, you might be better off asking the layout  
manager for geometry information rather than asking the font for the  
bounding box.  In general, of course, you can't assume a one-to-one  
correspondence between characters and glyphs, so single-character  
strings won't reproduce all of the features of general layout.


Douglas Davidson



Perfect! Thank you :)

I'm now doing this:

NSFont *actualFont = [textStorage attribute:NSFontAttributeName  
atIndex:0 effectiveRange:NULL];
NSRect rect = [actualFont boundingRectForGlyph:[layoutManager  
glyphAtIndex:0]];


which seems to be doing exactly what I want.

I had tried using the NSLayoutManager methods initially to get the  
font metrics I wanted, but those seemed to only return the typographic  
bounding boxes and what I want is the actual image rectangles. For a  
while I thought I might have to fall back to ATSUI for the  
ATSUMeasureTextImage() function to get what I wanted, but then I found  
the font method.


I'm also definitely aware of the potential complexities when mapping  
characters to glyphs in general. However, in the end I'm basically  
implementing a text rendering system in OpenGL and this program is  
just to generate a texture that I can use to draw the glyphs with. I'm  
targeting the iPhone, so I can't really use several MB worth of  
textures to support Unicode character set with complicated ligatures,  
etc anyway, so simplifying things is just fine for what I'm doing.


Thanks again,
- Chip
___

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

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

2008-07-15 Thread Steve Green

On Jul 15, 2008, at 1:41 PM, Quincey Morris wrote:

On Jul 15, 2008, at 09:51, Steve Green wrote:


On Jul 15, 2008, at 3:15 AM, Scott Anguish wrote:

On 14-Jul-08, at 7:36 PM, Steve Green wrote:


It is not the case.. they both use bindings but in the case where  
I only see 1 button, the NSTextField and bindings are created  
programatically.  Neither bind through controllers.


why?  (NS*)Controller(s) are very important, especially in cases  
such as this (controls that don't necessarily update their content  
automatically)


I tried binding through an NSObjectController and I'm still missing  
the other button.


I don't remember what details you gave at the start of this thread,  
but is the difference a result of different binding options?  
Validates immediately springs to mind as one that might possibly  
affect the number of buttons in the validation dialog, and it's one  
I often forget to set even when I know I want it.


Nope.. same options.  Validation works great it's just that I don't  
get the Cancel Change button in one of the apps.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Problem on reload data source of a table view

2008-07-15 Thread Andy Lee

On Jul 15, 2008, at 2:45 PM, JArod Wen wrote:
After the application was running, I debugged the code and checked  
the classes of TableController and TableSource. They are all  
connected in runtime.


For table view, I only connected it to TableController - dataTable,  
and its dataSource to TableController - tableSource. All of them  
are connected properly in runtime.


I haven't been reading closely, so this might be a wasted question...   
Do you have an instance of TableController in your nib *as well as*  
having one be the File's Owner?  The dataSource connection should be  
to File's Owner, and there shouldn't be an instance of TableController  
in your nib.


Sorry if you're experienced enough to understand this.  It's bitten a  
couple of newcomers recently.


--Andy


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSDateFormatter -dateFromString Question

2008-07-15 Thread Steve Cronin

Folks;

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init] ;
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_0];
[dateFormatter setDateFormat:@%m/%d/%Y %H:%M:%S %z];
...
NSDate *myDate = [dateFormatter dateFromString:@06/27/2008 02:51:52  
-0500];


myDate = 06/27/20.

What am I missing here?  I expect the full date and time value to be  
reflected back in myDate...

I use 10_0 because I'm just more familiar..

I've tried adding:
[dateFormatter setDateStyle:NSDateFormatterLongStyle];
[dateFormatter setTimeStyle:NSDateFormatterFullStyle];

but that doesn't change anything...

Thanks for any help,
Steve

10.5.4 XC3.1
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: custom NSButtonCell behaves different/wrong on Leopard

2008-07-15 Thread Ken Ferry
Hi Mark,

Could you file a bug with a test app please?

There are basically two reasons for a button to display alternate content.

(1) The cell's state is not NSOffState and the showsStateBy mask
contains NSContentsCellMask.
(2) The cell is highlighted and the highlightsBy mask contains
NSContentsCellMask.

The 'button types' you see in IB (and in -[NSButtonCell
setButtonType:]) correspond to different configurations of the
showsStateBy and highlightsBy masks.  A 'momentary change' button has
NSContentsCellMask set in its highlightsBy mask and a 'toggle' button
has NSContentsCellMask in its showsStateBy mask.

-Ken

On Tue, Jul 15, 2008 at 12:39 AM, Mark Sanvitale [EMAIL PROTECTED] wrote:
 Summary of the problem is that I have a custom NSButton subclass which
 accomplishes a roll-over effect (title and background take on a special
 appearance when the mouse is over the cell).  On Leopard, these same cells
 appear to perform a state change on mouse-over (the title and the image
 switch to their alternate state), but the state has not actually changed
 (according to gdb interrogation) and the title and image return to the
 normal state when the mouse leaves the cell/button.

 Anyone seen this problem?  Anyone know what is/could-be going wrong?

 The details:

 My custom NSButtonCell subclass defines some new, custom methods, and it
 completely overrides drawBezelWithFrame, while it augments (i.e. still call
 through to super) the methods drawInteriorWithFrame, drawTitle, and
 drawImage.  These cells appear in the window inside of a custom NSMatrix
 subclass which does the necessary mouse event handling to accomplish
 roll-over.

 This all works fine and good on Tiger.  On Leopard (with no code changes and
 the binary compiled on either Tiger or compiled against the 10.4 sdk on
 Leopard), the same button behaves wrong.  The title and image being passed
 into the drawTitle and drawImage state are the alternates when the mouse is
 over the button, even though when I interrogate the cell in the debugger the
 state has not changed (still NSOffState, i.e. the normal, not alternate
 state).  I can counteract the problem by ignoring the passed in title/image
 and determining it myself according to the current cell state, i.e.

image = ([self state] == NSOffState) ? [self image] : [self
 alternateImage];
title = ([self state] == NSOffState) ? [self attributedTitle] : [self
 attributedAlternateTitle];

 however, one problem still persists (beyond the obvious confusion as to why
 such a tactic is even necessary) whereby the dimming of the image does not
 happen on mouse-down but, rather, happens on roll-over when the button is in
 the alternate state.

 I'm at a loss.  Please help me.

 Mark Sanvitale
 Exbiblio
 [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/kenferry%40gmail.com

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: KVV and the missing Discard Changes button

2008-07-15 Thread Kyle Sluder
 Nope.. same options.  Validation works great it's just that I don't get the
 Cancel Change button in one of the apps.

Does the app missing the button have a custom view or field in the binding?

--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: Hillegass, Third Edition, Chapter 18

2008-07-15 Thread Kyle Sluder
On Tue, Jul 15, 2008 at 2:54 PM, Tommy Nordgren
[EMAIL PROTECTED] wrote:
 Don't even think about storing the NSRects in an NSArray.
 NSRect is a struct -- not a class

NSRect can be wrapped up in an NSValue, as I mentioned above, and
stored in an array.  KVC will automatically do the same for properties
typed as NSRect.  It's an important and frequently-used type, so it
gets special support from the framework.

In other words, go ahead and think about putting NSRects in an
NSArray.  As a matter of fact, do it!  Just wrap them up first.

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

2008-07-15 Thread Kyle Sluder
On Tue, Jul 15, 2008 at 8:41 AM, Hamish Allan [EMAIL PROTECTED] wrote:
 If you were using Core Data, expressing your familial relations as
 to-many relationships with inverses, it would be straightforward to
 achieve the query you want (and indeed, to create a GUI for that
 query).

In fact, as long as you have modeled relationships from parent to
child you can do it, Core Data or not.  Get a reference to Balbo and
Ponto and then use a keypath involving @distinctUnionOfArrays to get
to it.  A bit of set theory is helpful here.

--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: Toolbar code in separate Controller?

2008-07-15 Thread Kyle Sluder
On Tue, Jul 15, 2008 at 2:01 PM, John Love [EMAIL PROTECTED] wrote:
 Programmers are rarely accused of using plain English all the time,
 anyway.

In fact we're notorious for redefining already well-defined words.
That's the fun of English; there is only usage, which makes it a very
ambiguous yet simultaneously incredibly precise language.

In other words, just get used to it.  :)

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


Mystery Thread - how to debug

2008-07-15 Thread James Bucanek

I'm looking for any thoughts or feedback on this problem.

I have an application that starts lots of threads. While it's 
cleaning up, it shuts most of them down. This is done through 
NSConditionalLock objects (i.e. tell task to quit, wait for 
conditional lock to transition to stopped state, while thread 
finishes up and sets conditional lock to stopped state before it exits).


My problem is that the application is hanging as it tries to 
quit. I've got one thread hung waiting for the conditional lock 
to indicate that the worker thread as stopped.


I've got another thread -- which I'll refer to as the mystery 
thread -- that is stuck in a spinlock. The sample looks like this:


7464 Thread_2a03
  7464 thread_start
7464 _pthread_start
  7464 __NSThread__main__
7464 -[NSThread main]
  7464 __spin_lock
7464 __spin_lock

I'm *assuming* that this is the worker thread exiting. But since 
there's no symbolic information associated with my application I 
can't figure out what thread this belongs to, what selector it 
will/did execute, or why the heck it's stuck on a spinlock.


Any ideas?

--
James Bucanek

___

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

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

2008-07-15 Thread Andy Lee

On Jul 15, 2008, at 2:01 PM, John Love wrote:

it just would be nice

if Cocoa's Category would meld with Merriam Webster's definition of
category .. probably too much to ask.


It does.  Did you see my earlier reply?


Programmers are rarely accused of using plain English all the time,
anyway.


It's true we redefine words a lot, and we don't always do so in a way  
that fits well with the original plain English meaning.  But in this  
case, I think category makes perfect sense.


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: KVV and the missing Discard Changes button

2008-07-15 Thread Steve Green

On Jul 15, 2008, at 4:01 PM, Kyle Sluder wrote:
Nope.. same options.  Validation works great it's just that I don't  
get the

Cancel Change button in one of the apps.


Does the app missing the button have a custom view or field in the  
binding?


No.. they are both NSTextFields directly bound to the model.
___

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

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

2008-07-15 Thread Chris Kane
Once you did the -setFormatterBehavior:NSDateFormatterBehavior10_0,   
setDateFormat: became a no-op.   setDateFormat: is a 10.4-behavior  
formatter method.


Per the doc:
http://developer.apple.com/documentation/Cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html#//apple_ref/doc/uid/TP40002369-SW1

The new methods in v10.4 do not do anything when invoked on a v10.0- 
style formatter, and return a generic return value when required to  
return something—you should therefore not invoke the new methods on a  
v10.0-style formatter. On a v10.4-style formatter, the old methods map  
approximately to one or more new methods or attributes, but you should  
use the new methods directly when possible.



setDateStyle: and setTimeStyle: are also 10.4-only.  The 10.0 - 10.3  
formatter basically had about 3 or 4 methods, only.



Chris Kane
Cocoa Frameworks, Apple


On Jul 15, 2008, at 12:52, Steve Cronin wrote:


Folks;

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init] ;
[dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_0];
[dateFormatter setDateFormat:@%m/%d/%Y %H:%M:%S %z];
...
NSDate *myDate = [dateFormatter dateFromString:@06/27/2008 02:51:52  
-0500];


myDate = 06/27/20.

What am I missing here?  I expect the full date and time value to be  
reflected back in myDate...

I use 10_0 because I'm just more familiar..

I've tried adding:
[dateFormatter setDateStyle:NSDateFormatterLongStyle];
[dateFormatter setTimeStyle:NSDateFormatterFullStyle];

but that doesn't change anything...

Thanks for any help,
Steve

10.5.4 XC3.1
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Inter-thread communications (live/deadlock?)

2008-07-15 Thread Nick Kitchener

Hi,

I have a problem with inter-thread communications with NSMachPort/ 
NSPortMessage - it works one way after initially working both ways..


The application has a main parent thread that spawns a child thread.  
The child thread runs inside an object instance.


The parent passes it's NSMachPort instance through the NSThread  
detachNewSelector to the child.  The parent runs a loop and drives  
it's RunLoop.


The child once spawned creates it's own NSMachPort instance and then  
packages it up and sends it to the parent (which the parent receives  
correctly). This is the classic Apple documented 'checkin'. It then  
enters the classic while(1) { RunLoop ... } to drive the runloop.


Assumption #1 - as the threads are both running currentRunLoop then  
I'm assuming that each thread has it's own RunLoop instance? I  
understand that the RunLoop is thread unsafe.


The parent can issue as many messages as it likes to the child  
process. Each message gets to the child thread without a problem -  
each and every time.


Now comes the interesting bit.
The child uses a single method for all it's send calls back to the  
parent thread - even the checkin uses it - where it calls  
[NSPortMessage sendMessage: ...]. The observed results are that the  
initial checkin message gets to the parent handlePortMessage: whereas  
subsequent calls don't show any errors but the message does not arrive  
at handlePortMessage on the parent. They just vanish. The child and  
parent threads continue as if nothing has happened. The parent can  
still issue messages to the child..


I've checked with gdb and the ports are correct at each call. I notice  
there's three threads (the thread that's not mine shows as a posix  
thread that runs __CFSocketManager and just sits at select 
$DARWIN_EXTSN). This may be handling the streams that my child thread  
manages (I assume).
Activity monitor sample shows the parent 100% in it's loop. The child  
100% sat at mach_msg_trap which I see from the Apple opensource is the  
send/receive for messages in the mach kernel.


Has anyone had this occur before? Is it a dead/live lock in the OS due  
to threads using each others ports or is it there's no messages being  
sent?


I'm a complete beginner to OSX/Cocoa but not threading.

Cheers,
Nick.
___

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

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


Duplicate rows appearing in outlineview after creating new Entity in moc, why?

2008-07-15 Thread Sean McBride
Hi all,

I have an outlineview populated by binding to a treecontroller.  It
displays CoreData entities of type Person.  Person has 'parent' and
'children' relationships.  Displaying everything works fine.

Now the outlineview must support drops.  In my windowcontroller, I
implement outlineView:acceptDrop:item:childIndex: and look for my custom
pasteboard type.  If it's there, I need to create a new Person
entity.  How should I do this?

I have tried:
 a) [myTreeController add:nil];

 b) Person* person = [myTreeController newObject];
[person setParent:...];

 c) Person* person = [NSEntityDescription
  insertNewObjectForEntityForName:@Person
  inManagedObjectContext:moc];
[person setParent:...];

In all cases, the outlineview shows 2 of the new person.  The problem is
not on the model side, since if I close and reopen the window, only 1
new person is there.

Thanks,

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how to add modal dialog once application begin to run

2008-07-15 Thread Erik Buck
Have a look at http://www.stepwise.com/Articles/2006/eb1/index.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: custom NSButtonCell behaves different/wrong on Leopard

2008-07-15 Thread Mark Sanvitale
Well (much experimentation and head-scratching later), it turns out  
that this issue is not really a bug in Leopard, rather, it appears to  
be a case where a bug in Tiger allowed my buggy code to execute  
flawlessly on Tiger while the lack of this bug on Leopard caused the  
same buggy code to now exhibit buggy behavior on Leopard.  True, the  
intention is that Tiger built apps will behave the same on Leopard,  
but in this case I can now understand and appreciate the discrepancy.


My custom NSButtonCell had an accessor and a setter method for getting/ 
setting the roll-over effect.  This roll-over effect is a highlight so  
I named the methods isHighlighted and setIsHighlighted.  Without  
realizing it, I had unintentionally overrode the standard NSCell  
method isHighlighted (while not overriding the setter method, which is  
named setHighlighted, i.e. no Is).


On Tiger, this mistake has no visual effect on the button behavior,  
but on Leopard this makes the button appear in the pressed state on  
mouse-over because my custom isHighlighted, meant to indicate do-the- 
roll-over-effect, will mistakenly tell the standard NSButtonCell code  
to do-the-pressed-effect.


Thus, I guess I should write a bug against Tiger ;-)

Thanks for responding.  I'm happy to have finally figured this out.


On Jul 15, 2008, at 12:56 PM, Ken Ferry wrote:


Hi Mark,

Could you file a bug with a test app please?

There are basically two reasons for a button to display alternate  
content.


(1) The cell's state is not NSOffState and the showsStateBy mask
contains NSContentsCellMask.
(2) The cell is highlighted and the highlightsBy mask contains
NSContentsCellMask.

The 'button types' you see in IB (and in -[NSButtonCell
setButtonType:]) correspond to different configurations of the
showsStateBy and highlightsBy masks.  A 'momentary change' button has
NSContentsCellMask set in its highlightsBy mask and a 'toggle' button
has NSContentsCellMask in its showsStateBy mask.

-Ken

On Tue, Jul 15, 2008 at 12:39 AM, Mark Sanvitale [EMAIL PROTECTED]  
wrote:
Summary of the problem is that I have a custom NSButton subclass  
which
accomplishes a roll-over effect (title and background take on a  
special
appearance when the mouse is over the cell).  On Leopard, these  
same cells
appear to perform a state change on mouse-over (the title and the  
image
switch to their alternate state), but the state has not actually  
changed
(according to gdb interrogation) and the title and image return to  
the

normal state when the mouse leaves the cell/button.

Anyone seen this problem?  Anyone know what is/could-be going wrong?

The details:

My custom NSButtonCell subclass defines some new, custom methods,  
and it
completely overrides drawBezelWithFrame, while it augments (i.e.  
still call

through to super) the methods drawInteriorWithFrame, drawTitle, and
drawImage.  These cells appear in the window inside of a custom  
NSMatrix

subclass which does the necessary mouse event handling to accomplish
roll-over.

This all works fine and good on Tiger.  On Leopard (with no code  
changes and
the binary compiled on either Tiger or compiled against the 10.4  
sdk on
Leopard), the same button behaves wrong.  The title and image being  
passed
into the drawTitle and drawImage state are the alternates when the  
mouse is
over the button, even though when I interrogate the cell in the  
debugger the
state has not changed (still NSOffState, i.e. the normal, not  
alternate
state).  I can counteract the problem by ignoring the passed in  
title/image

and determining it myself according to the current cell state, i.e.

  image = ([self state] == NSOffState) ? [self image] : [self
alternateImage];
  title = ([self state] == NSOffState) ? [self  
attributedTitle] : [self

attributedAlternateTitle];

however, one problem still persists (beyond the obvious confusion  
as to why
such a tactic is even necessary) whereby the dimming of the image  
does not
happen on mouse-down but, rather, happens on roll-over when the  
button is in

the alternate state.

I'm at a loss.  Please help me.

Mark Sanvitale
Exbiblio
[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/kenferry%40gmail.com

This email sent to [EMAIL PROTECTED]





___

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

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

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

This email sent to [EMAIL PROTECTED]


Newbie: How to understand Xcode's documentation

2008-07-15 Thread Phil Faber

Hi all.

As a relative newbie I'm eager to learn but my biggest stumbling block  
is understanding that the XCode's HelpDocumentation actually means;  
can someone guide me?


For example, if I want to put a substring of a larger string (eg.  
ertyu from qwertyuiop) into a second field, I search the  
documentation and come across a thing under NSString called  
getCharacters:range.  I assume this will do the job as it seems to get  
characters from a string as specified by a range;  I then look at the  
usage information which reads:


- (void)getCharacters:(unichar *)buffer range:(NSRange)aRange

My challenge is that I don't know what this means or how to convert  
this into actual code.  So I have to keep guessing which surely can't  
be the preferred way to learn!



So I try:

[newField setStringValue:[NSString getCharacters:buffer range:2,3]];

..and am told:

error: 'buffer' undeclared
warning: 'NSString' may not respond to '+getCharacters:range:'


..so I try:

[newField setStringValue:[NSString getCharacters:2,3]];

..and am told:

warning: 'NSString' may not respond to '+getCharacters:'


.. so I try:

[newField setStringValue:[NSString getCharacters:buffer range:2-3]];

..and am told:

error: 'buffer' undeclared
warning: 'NSString' may not respond to '+getCharacters:range:'


..and so on.

I'm a newbie; I'm still learning how to do simply stuff like add two  
numbers together, display 'hello world' and so on!  What I could  
really do with is the documentation giving examples.


Can anyone explain how I can 'decode' the usage information shown in  
the documentation into real code?  Not just for this example, but in  
general.


If I can't understand this, I fear I'll spend most of my time asking  
others how to achieve the most basic of tasks.


Thanks.

Phil
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [Q] Any document that shows differences of Cocoa, programming for Mac and for the iPhone/iPod touch?

2008-07-15 Thread JongAm Park

Oh.. Thank you very much for the links.
Actually I know the KATI blog. I even bookmarked it before, but I didn't 
noticed the article!

I found her blog from flickr link at Cocoa Head LA!

http://www.flickr.com/photos/kepi/2586194046/

What is more interesting here is that our beloved phone from a 
stripestar and a fruit company seems to be heavily modeled on the 
sibling of NSViewController, and I was curious if the design of Cocoa 
for the desktop also moves to that direction.



From: Stefan Arentz [EMAIL PROTECTED]
Just found this, should be interesting for other people ...

  
http://katidev.com/blog/2008/04/09/nsviewcontroller-the-new-c-in-mvc-pt-1-of-3/ 

  
http://katidev.com/blog/2008/04/17/nsviewcontroller-the-new-c-in-mvc-pt-2-of-3/ 

  
http://katidev.com/blog/2008/05/26/nsviewcontroller-the-new-c-in-mvc-pt-3-of-3/ 



S.
  

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Newbie: How to understand Xcode's documentation

2008-07-15 Thread Jason Sallis
You're not having a problem reading the docs. You're having a problem with
your basic understanding of Objective-C. There's nothing to convert and
what you're reading is actual code. I'd recommend taking a step back and
doing some reading before you go any further.

Perhaps here:
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/ObjC.pdf

and here:
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/ObjCTutorial.pdf

- Jason


On Tue, Jul 15, 2008 at 4:19 PM, Phil Faber [EMAIL PROTECTED] wrote:

 Hi all.

 As a relative newbie I'm eager to learn but my biggest stumbling block is
 understanding that the XCode's HelpDocumentation actually means; can
 someone guide me?

 For example, if I want to put a substring of a larger string (eg. ertyu
 from qwertyuiop) into a second field, I search the documentation and come
 across a thing under NSString called getCharacters:range.  I assume this
 will do the job as it seems to get characters from a string as specified by
 a range;  I then look at the usage information which reads:

 - (void)getCharacters:(unichar *)buffer range:(NSRange)aRange

 My challenge is that I don't know what this means or how to convert this
 into actual code.  So I have to keep guessing which surely can't be the
 preferred way to learn!


 So I try:

 [newField setStringValue:[NSString getCharacters:buffer range:2,3]];

 ..and am told:

 error: 'buffer' undeclared
 warning: 'NSString' may not respond to '+getCharacters:range:'


 ..so I try:

 [newField setStringValue:[NSString getCharacters:2,3]];

 ..and am told:

 warning: 'NSString' may not respond to '+getCharacters:'


 .. so I try:

 [newField setStringValue:[NSString getCharacters:buffer range:2-3]];

 ..and am told:

 error: 'buffer' undeclared
 warning: 'NSString' may not respond to '+getCharacters:range:'


 ..and so on.

 I'm a newbie; I'm still learning how to do simply stuff like add two
 numbers together, display 'hello world' and so on!  What I could really do
 with is the documentation giving examples.

 Can anyone explain how I can 'decode' the usage information shown in the
 documentation into real code?  Not just for this example, but in general.

 If I can't understand this, I fear I'll spend most of my time asking others
 how to achieve the most basic of tasks.

 Thanks.

 Phil
 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/jsallis%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: Newbie: How to understand Xcode's documentation

2008-07-15 Thread Dave DeLong
Hi Phil,

You're right: the documentation can take some getting used to.

Here are some tips:

When you see a method declared with a - out in front, such as:
- (NSString *) substringWithRange:(NSRange)range;
That means that you can only use that method on an instance of the
class.  For example:
NSString * someString = [myTextField stringValue];
NSString * subString = [someString substringWithRange:NSMakeRange(0,4)];

Methods that begin with a + are class methods and are used as such:
NSString * someString = [NSString stringWithString:someOtherString];
(Notice that I'm calling stringWithString on NSString itself and NOT
an instance of NSString)

There are a ton of resources out there for familiarizing yourself with
Objective-C and Xcode and whatnot.  Our local CocoaHeads group just
had a meeting last week about Objective-C and transitioning to it from
other languages, and we've got a screencast of it at our site:
http://cocoaheads.byu.edu/videos

HTH,

Dave
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [[NSDate alloc] initWithString] crashes with valid string

2008-07-15 Thread Tony Becker
I didn't see any code sniglet for this, but it's not something simple  
like:


[[NSDate alloc] initWithString:...];

vs

[[NSDate alloc] initWithString:@...];

i.e.: passing CString vs NSString?



On Jul 15, 2008, at 4:12 PM, Kyle Sluder wrote:


On Tue, Jul 15, 2008 at 2:36 PM, Markus Spoettl
[EMAIL PROTECTED] wrote:

Any ideas what could be causing something like this?


Doesn't look like it's your fault, unless for some reason the string
is being dealloc'd under the call stack's feet -- make sure that the
call stack eventually winds up in your code; if it doesn't, you've hit
the top of the runloop and the string has probably been released by an
autorelease pool.  After confirming this, file a bug at
http://bugreport.apple.com, as this is a pretty serious issue.

--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/aebecker%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: Newbie: How to understand Xcode's documentation

2008-07-15 Thread Nick Zitzmann


On Jul 15, 2008, at 4:19 PM, Phil Faber wrote:


- (void)getCharacters:(unichar *)buffer range:(NSRange)aRange

[...]
Can anyone explain how I can 'decode' the usage information shown in  
the documentation into real code?  Not just for this example, but in  
general.



OK, let's do this one part at a time, from left to right:

1. The - means that the method is an instance method, not a class  
method. That means you use it on an NSString instance you have  
initialized somewhere else.


2. The (void) means the method doesn't return anything, so depending  
on its return value makes no sense.


3. The unichar * means the first argument takes a unichar pointer.  
You have to declare this pointer beforehand.


4. The NSRange means the second argument is an NSRange data  
structure. You usually make these using the NSMakeRange() macro.


As others have said, I'd strongly recommend reading up first on the C  
programming language, and then on ObjC. Then this stuff will make more  
sense.


Nick Zitzmann
http://www.chronosnet.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: Inter-thread communications (live/deadlock?)

2008-07-15 Thread Ken Ferry
Hi Nick,

It sounds like this would be relatively easy to bundle up as a test
app.  If you can do so and post it somewhere, I'll think you'll have a
better chance of a helpful response.

Also, are you aware of -[NSObject
performSelector:onThread:withObject:] and friends?

 Assumption #1 - as the threads are both running currentRunLoop then I'm
 assuming that each thread has it's own RunLoop instance?

That's correct.


+ (NSRunLoop *)currentRunLoop

Return Value
The NSRunLoop object for the current thread.

Discussion
If a run loop does not yet exist for the thread, one is created and returned.


-Ken


On Tue, Jul 15, 2008 at 2:45 PM, Nick Kitchener
[EMAIL PROTECTED] wrote:
 Hi,

 I have a problem with inter-thread communications with
 NSMachPort/NSPortMessage - it works one way after initially working both
 ways..

 The application has a main parent thread that spawns a child thread. The
 child thread runs inside an object instance.

 The parent passes it's NSMachPort instance through the NSThread
 detachNewSelector to the child.  The parent runs a loop and drives it's
 RunLoop.

 The child once spawned creates it's own NSMachPort instance and then
 packages it up and sends it to the parent (which the parent receives
 correctly). This is the classic Apple documented 'checkin'. It then enters
 the classic while(1) { RunLoop ... } to drive the runloop.

 Assumption #1 - as the threads are both running currentRunLoop then I'm
 assuming that each thread has it's own RunLoop instance? I understand that
 the RunLoop is thread unsafe.

 The parent can issue as many messages as it likes to the child process. Each
 message gets to the child thread without a problem - each and every time.

 Now comes the interesting bit.
 The child uses a single method for all it's send calls back to the parent
 thread - even the checkin uses it - where it calls [NSPortMessage
 sendMessage: ...]. The observed results are that the initial checkin message
 gets to the parent handlePortMessage: whereas subsequent calls don't show
 any errors but the message does not arrive at handlePortMessage on the
 parent. They just vanish. The child and parent threads continue as if
 nothing has happened. The parent can still issue messages to the child..

 I've checked with gdb and the ports are correct at each call. I notice
 there's three threads (the thread that's not mine shows as a posix thread
 that runs __CFSocketManager and just sits at select$DARWIN_EXTSN). This may
 be handling the streams that my child thread manages (I assume).
 Activity monitor sample shows the parent 100% in it's loop. The child 100%
 sat at mach_msg_trap which I see from the Apple opensource is the
 send/receive for messages in the mach kernel.

 Has anyone had this occur before? Is it a dead/live lock in the OS due to
 threads using each others ports or is it there's no messages being sent?

 I'm a complete beginner to OSX/Cocoa but not threading.

 Cheers,
 Nick.
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Disc Burns, but is unreadable

2008-07-15 Thread Kevin Elliott


On Jul 15, 2008, at 7:44 AM, J. Todd Slack wrote:
	[burn setArguments:[NSArray  
arrayWithObjects:@burn,imagePath,burnVerify,@-speed,burnSpeed,@- 
verbose,@-noforceclose,@-device,drivePath,nil]];


My first guess is that the burnVerify syntax has changed.  Glancing at  
the man page for hdiutil makes no mention of it.  I'd suggest you  
start by confirming that the arguments your using work properly on the  
command line, and correct until they do.  If that's not working, why  
don't you include a full breakdown of what your passing on the command  
line, what drive your writing to, etc.


-Kevin Elliott
DTS Engineer
[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]


NSWindow delegate of unexpected class

2008-07-15 Thread Shawn Erickson
Does anyone know of a third-party haxie (input manager, etc.) that
when loaded into an application hijacks the delegate of NSWindow
instances? ...something that replaces the window's delegate with one
of its own objects that presumable forwards messages onto our
delegate.

We happen to have some debugging related assert code like the
following (in a class method) that validates that the delegate of a
window is of an expected class. These asserts made it into a release
version of our of product and we are getting runtime exception reports
from the field cause by this assert.

NSAssert([[someWindow delegate] isKindOfClass:self], @incorrect
delegate class);

We are fairly sure that the pointer to the window is valid and that
the window object is still valid because of code before this point
interacts with the window instance without issue.

Basically we are trying to reproduce this issue in house and so far
haven't been able to cause it. It appears to only affect a few
customers and those affected consistently hit the assert (still trying
to contact affected customers).

-Shawn
___

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

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

2008-07-15 Thread Shawn Erickson
On Tue, Jul 15, 2008 at 4:25 PM, Shawn Erickson [EMAIL PROTECTED] wrote:
 Does anyone know of a third-party haxie (input manager, etc.) that
 when loaded into an application hijacks the delegate of NSWindow
 instances? ...something that replaces the window's delegate with one
 of its own objects that presumable forwards messages onto our
 delegate.

 We happen to have some debugging related assert code like the
 following (in a class method) that validates that the delegate of a
 window is of an expected class. These asserts made it into a release
 version of our of product and we are getting runtime exception reports
 from the field cause by this assert.

NSAssert([[someWindow delegate] isKindOfClass:self], @incorrect
 delegate class);

 We are fairly sure that the pointer to the window is valid and that
 the window object is still valid because of code before this point
 interacts with the window instance without issue.

 Basically we are trying to reproduce this issue in house and so far
 haven't been able to cause it. It appears to only affect a few
 customers and those affected consistently hit the assert (still trying
 to contact affected customers).

So I think an unrelated crash log from a customer that is also affect
by this runtime exception (assert) gives me a hint...

...
0x11ac3000 - 0x11ad4ffc +com.unsanity.ape 2.5 (2.5b1)
/Library/Frameworks/ApplicationEnhancer.framework/Versions/A/ApplicationEnhancer
0x11ae - 0x11b02ff7 +com.unsanity.menumaster.ape 1.4.3b2 (1.4.3b2)
/Library/Application Enhancers/Menu Master.ape/Contents/MacOS/Menu
Master
0x11b52000 - 0x11b6dffd +com.unsanity.windowshadex.cocoa 4.2b1 (???)
c05f172c8a7efe32846e234cf9d416de /Library/Application
Enhancers/WindowShade X.ape/Contents/PlugIns/WindowShade X
Cocoa.ape/Contents/MacOS/WindowShade X Cocoa
0x11b9 - 0x11bc6fe3 +com.unsanity.fruitmenu 3.7b2 (207)
/Library/Application Enhancers/FruitMenu.ape/Contents/MacOS/FruitMenu
0x11bd8000 - 0x11bd8ffd +com.yazsoft.SDEnhancer ??? (1.0)
1c24784f37773ada58fa649b1df6a1b3
/Library/InputManagers/SpeedDownload
Enhancer/SpeedDownloadEnhancer.bundle/Contents/MacOS/SpeedDownloadEnhancer
0x11d5d000 - 0x11d66ff7 +com.unsanity.smartcrashreports Smart Crash
Reports version 1.5b2 (1.5b2) /Library/InputManagers/Smart Crash
Reports/Smart Crash Reports.bundle/Contents/MacOS/Smart Crash Reports
0x11d73000 - 0x11d74fff +com.1passwd.InputManager 2.5.7 (5899)
0ee7b2245d52c905764dad5b5072f832
/Library/InputManagers/1PasswdIM/1PasswdIM.bundle/Contents/MacOS/1PasswdIM
0x11d79000 - 0x11d79ffd +com.unsanity.menumaster.menuisequalcat ???
(1.4.3b2) 01d0234b2be80aa79976d3fabccd06c4 /Library/Application
Enhancers/Menu 
Master.ape/Contents/Resources/MenuIsEqualCat.bundle/Contents/MacOS/MenuIsEqualCat
0x11e2 - 0x11e92fff +com.DivXInc.DivXDecoder 6.4.0 (6.4.0)
/Library/QuickTime/DivX Decoder.component/Contents/MacOS/DivX Decoder
0x15d68000 - 0x15fa8fd2 +net.telestream.wmv.import 2.2.0.49 (2.2.0.49)
/Library/QuickTime/Flip4Mac WMV
Import.component/Contents/MacOS/Flip4Mac WMV Import
0x15fe - 0x161a2fea +net.telestream.wmv.advanced 2.2.0.49
(2.2.0.49) /Library/QuickTime/Flip4Mac WMV
Advanced.component/Contents/MacOS/Flip4Mac WMV Advanced
0x16ed8000 - 0x16edbfff +com.stclairsoft.DefaultFolderX.osax Default
Folder X Addition version 1.0 (kBundleVersion)
abea579c554b7767792fd3c4acaf0771
/Users/gbr1/Library/ScriptingAdditions/Default Folder X
Addition.osax/Contents/MacOS/Default Folder X Addition
0x170c6000 - 0x170dcfff +com.rainmaker.SpellCatcher.InputMethod 10.2.3
(10.2.3) /Users/gbr1/Library/Components/Spell
Catcher.component/Contents/MacOS/Spell Catcher
0x170e7000 - 0x17108ff3 +com.stclairsoft.DefaultFolderX.CarbonPatcher
kBundleVersion (kBundleVersion) e4d0fe7b5eb0290c63d11fc2fb5d4176
/Library/PreferencePanes/Default Folder
X.prefPane/Contents/Resources/Default Folder
X.bundle/Contents/Resources/Carbon
Patcher.bundle/Contents/MacOS/Carbon Patcher
0x1711c000 - 0x1713aff7 +Cocoa Patcher ??? (???)
34f21cf95eb2ed1d2bc0e5ac6616b420 /Library/PreferencePanes/Default
Folder X.prefPane/Contents/Resources/Default Folder
X.bundle/Contents/Resources/Cocoa Patcher.bundle/Contents/MacOS/Cocoa
Patcher
...

-Shawn
___

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

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


Flicker from NSResponder Chain?

2008-07-15 Thread John MacMullin
I read in the archives of a method to implement Tiger's approach to  
tabbing through a table in Leopard.  While my approach works as to the  
tabbing, it is slightly different than the approach discussed in the  
archives.  It also results in a problem that is discussed below.  I  
have two tables in the tabview.  One is a transaction table, which I  
tab through.  The other is a static table from which I develop  
transactions for the transaction table.


The code for tabbing is in three parts:

I have an observer for the NSTextDidEndEditingNotification with the  
selector being localTextEditingDidEnd, which follows.  This is  
different from the subclass approach but works nonetheless.  There is  
a second observer for the select_EditedTableColumAndRow notification.


-(void)localTextEditingDidEnd:(NSNotification *)notification
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init];
NSDictionary *userInfo = [notification userInfo];
int textMovement = [[userInfo valueForKey:@NSTextMovement] intValue];
if ([transactionTableView selectedRow] =  0) {
int selectedRowOfTable = [transactionTableView selectedRow];
		if ((lastColumnEdited == (int)columnOne) || (lastColumnEdited ==  
(int)columnTwo)) {

int numberOfEntries = 0;
if (local_Tran_Array) {
numberOfEntries = [local_Tran_Array count];
}   
BOOL lastRow = NO;
int indexOfLastRow = numberOfEntries - 1;
if (indexOfLastRow == selectedRowOfTable) {
lastRow = YES;
}
int nextColumn = 0;
int nextRow = 0;
			if ((textMovement == NSTabTextMovement) || (textMovement ==  
NSReturnTextMovement)) {

switch (lastColumnEdited) {
case columnOne:
nextColumn = columnTwo;
nextRow = selectedRowOfTable;
break;
case columnTwo:
if (lastRow) {
nextRow = 0;
} else {
nextRow = 
selectedRowOfTable + 1;
};
nextColumn = columnOne;
break;
default:
break;
}
NSNumber *next_column = [NSNumber 
numberWithInt:nextColumn];
NSNumber *next_row = [NSNumber 
numberWithInt:nextRow];
NSMutableDictionary *userInfo = [[[NSMutableDictionary  
alloc]init]autorelease];

[userInfo setObject: next_column 
forKey:@next_column];
[userInfo setObject: next_row 
forKey:@next_row];
[[NSNotificationQueue defaultQueue] enqueueNotification: 
[NSNotification notificationWithName:@select_EditedTableColumAndRow  
object:nil userInfo:[NSDictionary dictionaryWithDictionary:userInfo]]  
postingStyle: NSPostWhenIdle coalesceMask:NSNotificationNoCoalescing  
forModes:nil];

}   
}
} else {
lastColumnEdited = -1;
}
[pool release];
}

3. The common editcolum routine is also used by the tableview  
selectionDidChange delegate hence the notification approach.


-(void)select_EditedTableColumAndRow:(NSNotification *)aNotification
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init];
NSDictionary *userInfo = [aNotification userInfo];
	NSNumber *next_column = (NSNumber *)[userInfo  
objectForKey:@next_column];

NSNumber *next_row = (NSNumber *)[userInfo objectForKey:@next_row];
	[myWindowOutlet makeFirstResponder:[[[transactionTableView  
tableColumnWithIdentifier:[next_column stringValue]] dataCellForRow: 
[next_row intValue]] controlView]];

[transactionTableView scrollRowToVisible:(int)[next_row intValue]];
	[transactionTableView selectRow:[next_row intValue]  
byExtendingSelection:NO];
	[transactionTableView editColumn:[next_column intValue] row:[next_row  
intValue] withEvent:nil select:(BOOL)YES];

lastColumnEdited = [transactionTableView editedColumn];
[pool release];
}

This code works.  The problem however is that the static table  
flickers upon tabbing from one row to another row in the transaction  
table.  I suspect that this is a responder 

Re: [[NSDate alloc] initWithString] crashes with valid string

2008-07-15 Thread Nick Zitzmann


On Jul 15, 2008, at 12:36 PM, Markus Spoettl wrote:


Any ideas what could be causing something like this?



In addition to what everyone else has suggested, have you tried  
running your application under Guard Malloc to make sure memory is not  
being corrupted? I've caught all sorts of weird behavior in  
applications before by using Guard Malloc.


Nick Zitzmann
http://www.chronosnet.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: Keypaths

2008-07-15 Thread Scott Anguish


On 15-Jul-08, at 4:08 PM, Kyle Sluder wrote:

On Tue, Jul 15, 2008 at 8:41 AM, Hamish Allan [EMAIL PROTECTED]  
wrote:

If you were using Core Data, expressing your familial relations as
to-many relationships with inverses, it would be straightforward to
achieve the query you want (and indeed, to create a GUI for that
query).


In fact, as long as you have modeled relationships from parent to
child you can do it, Core Data or not.  Get a reference to Balbo and
Ponto and then use a keypath involving @distinctUnionOfArrays to get
to it.  A bit of set theory is helpful here.


The Key-Value Coding Programming Guide has more info on this,  
including a sample data relationship and what the various operators  
will return when used.


http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/ArrayOperators.html#/ 
/apple_ref/doc/uid/20002176



___

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

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


Blue lines

2008-07-15 Thread Andrew Thompson
How do Interface Builder and Quartz Composer draw the blue line connections
from object to object?
I have been looking through the APIs, but I can't find anything that looks
right.

I thought of just drawing my own line on a custom view (shouldn't be that
hard), but interface builder manages to do it between objects that aren't
connected by ANY view, and I am not sure how to do that.

I am trying to build an HTML GUI editor.

Thanks in advance!

~Andrew
___

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

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

2008-07-15 Thread Shawn Erickson
On Tue, Jul 15, 2008 at 5:31 PM, Andrew Thompson
[EMAIL PROTECTED] wrote:

 I thought of just drawing my own line on a custom view (shouldn't be that
 hard), but interface builder manages to do it between objects that aren't
 connected by ANY view, and I am not sure how to do that.

 I am trying to build an HTML GUI editor.

 Thanks in advance!

Likely a transparent overlay window size as needed with a content view
that does the drawing of the line.

-Shawn
___

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

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

2008-07-15 Thread j o a r


On Jul 15, 2008, at 5:31 PM, Andrew Thompson wrote:

How do Interface Builder and Quartz Composer draw the blue line  
connections

from object to object?
I have been looking through the APIs, but I can't find anything that  
looks

right.

I thought of just drawing my own line on a custom view (shouldn't be  
that
hard), but interface builder manages to do it between objects that  
aren't

connected by ANY view, and I am not sure how to do that.



IB probably uses one or more separate transparent windows to hold the  
connection lines.


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: Blue lines

2008-07-15 Thread Greg Titus
Interface Builder actually makes a couple of windows to do that. One  
wide window for the horizontal part of the line, and another tall and  
thin window for the vertical part. The positions of the windows change  
as your mouse moves, and they have simple views inside that draw  
basically just blue over their entire contents.


Hope this helps,
- Greg

On Jul 15, 2008, at 5:31 PM, Andrew Thompson wrote:

How do Interface Builder and Quartz Composer draw the blue line  
connections

from object to object?
I have been looking through the APIs, but I can't find anything that  
looks

right.

I thought of just drawing my own line on a custom view (shouldn't be  
that
hard), but interface builder manages to do it between objects that  
aren't

connected by ANY view, and I am not sure how to do that.

I am trying to build an HTML GUI editor.

Thanks in advance!

~Andrew
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/greg%40omnigroup.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: Blue lines

2008-07-15 Thread Scott Anguish


On 15-Jul-08, at 8:31 PM, Andrew Thompson wrote:

How do Interface Builder and Quartz Composer draw the blue line  
connections

from object to object?
I have been looking through the APIs, but I can't find anything that  
looks

right.


I can't say how either app is written..

if you're drawing in a custom view between visual items that you  
control you can do it all yourself.





I thought of just drawing my own line on a custom view (shouldn't be  
that
hard), but interface builder manages to do it between objects that  
aren't

connected by ANY view, and I am not sure how to do that.



You'd need to use an overlay window that is transparent and ignores  
clicks. There is an example of this technique on developer.apple.com.




I am trying to build an HTML GUI editor.


Please, please an XML GUI editor. :-) Then the HTML version can be  
done via an XML schema, and users needing an XML editor will be all  
good.

___

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

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

2008-07-15 Thread Graham Cox
Along with what others have said, for this specific task you would  
probably want to use:


-(NSString*) substringWithRange:(NSRange) range;

instead. It's fairly rare to break down strings into individual  
characters.


So with your newly learned knowledge of Objective-C, you could now  
write a bit of code such as:



[newField setStringValue:[[oldField stringValue]  
substringWithRange:NSMakeRange(2, 3)]];




cheers, Graham



On 16 Jul 2008, at 8:19 am, Phil Faber wrote:

For example, if I want to put a substring of a larger string (eg.  
ertyu from qwertyuiop) into a second field, I search the  
documentation and come across a thing under NSString called  
getCharacters:range.  I assume this will do the job as it seems to  
get characters from a string as specified by a range;  I then look  
at the usage information which reads:


- (void)getCharacters:(unichar *)buffer range:(NSRange)aRange


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [[NSDate alloc] initWithString] crashes with valid string

2008-07-15 Thread Markus Spoettl

On Jul 15, 2008, at 5:00 PM, Nick Zitzmann wrote:
In addition to what everyone else has suggested, have you tried  
running your application under Guard Malloc to make sure memory is  
not being corrupted? I've caught all sorts of weird behavior in  
applications before by using Guard Malloc.



Thanks for the suggestion, I just tried this and now it crashes in  
initialization of NSXMLDocument (see call stack below). My (unfounded)  
suspicion was that the XMLDocument somehow was responsible for all the  
trouble.


The call stack tells me something strange is going on when opening the  
URL. So I changed the NSXMLDocument initialization to use a NSData  
instance that I load from the file manually and viola, the random  
crashing is gone. So apparently there is a big difference between  
loading an XMLDocument using URL and loading from NSData. Which I  
don't know, the documentation doesn't indicate special behaviour.  
Apparently it didn't like the XML URL but it does work with the data  
in it.


Thanks everyone for your suggestions, this issue gave me quite a  
number of sleepless nights.


Thanks again!

Regards
Markus


#0  0x00332556 in _mach_msg_trap at syscall_sw.h:83
#1  0x0033c8ad in mach_msg
#2  0x00360861 in vm_protect
#3  0x0009a034 in GMmalloc_zone_malloc
#4  0x940eb451 in _CFRuntimeCreateInstance
#5  0x940795a8 in __CFArrayInit
#6  0x940e0ebf in parseXMLElement
#7  0x940e27ea in parseDictTag
#8  0x940e0e95 in parseXMLElement
#9  0x940e27ea in parseDictTag
#10 0x940e0e95 in parseXMLElement
#11 0x940e0ad0 in parseXMLElement
#12 0x940e2082 in _CFPropertyListCreateFromXMLData
#13 0x940e262b in CFPropertyListCreateFromXMLData
#14 0x96e62075 in loadPolicyFromFile
#15 0x96e61faa in initializePolicy
#16 0x003588a9 in pthread_once
#17 0x96e6071e in _LSCopyDownloadAssessmentDictionaryInternal
#18 0x96e6038a in _LSCopyDownloadAssessmentDictionary
#19 0x93e3ccfd in _initDownloadAssessment
#20 0x93e50f20 in _CFURLResponseGuessMIMEType
#21 0x93e8122b in sniffForContentTypeWithData
#22 0x93e3d608 in sendDidReceiveDataCallback
#23 0x93e3ac22 in _CFURLConnectionSendCallbacks
#24 0x93e3a573 in muxerSourcePerform
#25 0x940e9615 in CFRunLoopRunSpecific
#26 0x940e9cf8 in CFRunLoopRunInMode
#27 0x93e5db42 in CFURLConnectionSendSynchronousRequest
#28	0x9545680b in +[NSURLConnection  
sendSynchronousRequest:returningResponse:error:]

#29 0x9554fe56 in -[NSXMLDocument initWithContentsOfURL:options:error:]
#30	0x0003d601 in -[RubiData(Import) importFromFile:] at RubiData 
+Import.m:257





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

[OT] XML GUI editor [was Re: Blue lines]

2008-07-15 Thread Gary L. Wade
On 15-Jul-08, at 5:36 PM, Scott Anguish wrote:

Please, please an XML GUI editor. :-) Then the HTML version can be  
done via an XML schema, and users needing an XML editor will be all  
good.

Hmmm...veering off-topic and divergent from the original question, but how 
would you personally expect XML to appear GUI-like?  I'm just curious about 
your ideas, as I always think of an XML document visually as an encompassing 
set with its data as islands of text ordered in a way only meaningful to that 
type of data (e.g., calendar info from an ICU LDML as desk calendars, etc.), 
which really can't be predicted programmatically.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [[NSDate alloc] initWithString] crashes with valid string

2008-07-15 Thread Nick Zitzmann


On Jul 15, 2008, at 7:28 PM, Markus Spoettl wrote:

Thanks for the suggestion, I just tried this and now it crashes in  
initialization of NSXMLDocument (see call stack below). My  
(unfounded) suspicion was that the XMLDocument somehow was  
responsible for all the trouble.



Have you reported this to Apple through http://bugreport.apple.com/?  
That is very strange behavior that obviously shouldn't be happening.


Nick Zitzmann
http://www.chronosnet.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: Problem on reload data source of a table view

2008-07-15 Thread JArod Wen
Finally the problem is solved. There is a missing line to set the  
identifier of each column so -tableView:objectValueForTableColumn:row:  
always return nil since it cannot retrieve the correct key of column.  
Thanks for all of your helps, and wish this helpful to any other guys.


On Jul 15, 2008, at 1:45 PM, j o a r wrote:



On Jul 15, 2008, at 10:36 AM, JArod Wen wrote:

The dataSource of TableView is connected to tableSource. There is a  
TableController containing two IBOutlets to both tableSource and  
dataTable. Then dataTable.dataSource is connected to tableSource in  
IB. Anything I lost here?



You might want to verify, at runtime, that this connection is set.  
You can do this either in the debugger, or just using a standard  
debug log statement.


Btw.: Have you set up any bindings for this table view?

j o a r




---
JArod Wen




___

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

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

2008-07-15 Thread Jens Alfke


On 15 Jul '08, at 3:19 PM, Phil Faber wrote:


- (void)getCharacters:(unichar *)buffer range:(NSRange)aRange

My challenge is that I don't know what this means or how to convert  
this into actual code.  So I have to keep guessing which surely  
can't be the preferred way to learn!



What you're looking at is an Objective-C method declaration. You're  
going to have to know how to write these as well as read them, so you  
should carefully read the Class Interface section of the Defining a  
Class chapter of the Objective-C Language Guide, which explains  
method declarations in detail.


—Jens

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: [[NSDate alloc] initWithString] crashes with valid string

2008-07-15 Thread Markus Spoettl

On Jul 15, 2008, at 6:33 PM, Nick Zitzmann wrote:
Have you reported this to Apple through http://bugreport.apple.com/ 
? That is very strange behavior that obviously shouldn't be  
happening.


I will do this once I can confirm my crashes are gone. Obviously this  
takes a little extra effort because they most certainly will ignore  
the issue unless I produce a test application that recreates the crash  
reliably (which could be tricky).


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: Hillegass, Third Edition, Chapter 18

2008-07-15 Thread Jason Stephenson

Tommy Nordgren wrote:

...
Don't even think about storing the NSRects in an NSArray.
NSRect is a struct -- not a class
Instead store NSBezierPath instances, or create an oval class.



If you're feeling ambitious, you'd make your own class to hold the oval 
information, such as its NSRect, NSColor, and a BOOL to indicate whether 
or not it should be drawn filled.


If you're truly ambitious, you'd include a fill pattern or fill graphic

'Course, it was my second time doing the exercise. ;)

Cheers,
Jason
___

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

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

2008-07-15 Thread Scott Ribe
 Any ideas?

Cold comfort perhaps, but the way I've debugged similar problems in the past
involved *lots* of logging, which of course can affect the bug ;-(
 
-- 
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]


how do I make chat bubbles using a custom cell

2008-07-15 Thread TARUN CHAPLOT
Hello Everyone

I am very new to objective C and working on some application which needs to 
create Chat bubbles similar to iChat. 
Can anybody help me to find some documentation or the sample code which will 
help me to make chat bubbles using custom cell.

Any help would be greatly appreciated.

Thanks
Tarun



  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Blue lines (nice example app including quartz compositions)

2008-07-15 Thread Patrick Mau
Andrew Thompson wrote:
 How do Interface Builder and Quartz Composer draw the blue line connections
 from object to object?
 I have been looking through the APIs, but I can't find anything that looks
 right.
 
 I thought of just drawing my own line on a custom view (shouldn't be that
 hard), but interface builder manages to do it between objects that aren't
 connected by ANY view, and I am not sure how to do that.
 
 I am trying to build an HTML GUI editor.
 
 Thanks in advance!

Hi Andrew

If have been looking at the code below to do something similar.

The program below draws quartz compositions on your desktop,
can control 'click-through' behaviour and also let's you
control the layering order (i.e it stays at desktop level or
above all windows)

All that is needed is a subclass of NSWindow, because IB does not let
you create complely transparent windows.

I wanted to program an activity notification for my application
similar to the transparent indicator that is displayed on
your desktop when you change the volume.

It's also a nice example for using quartz composition parameters and
getting iTunes current song information from within your program.

The code is located here:

http://borderless.vade.info/

I'd like to publicly thank the author for providing this. It contained
very useful information that I was looking for.

Regards,
Patrick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how do I make chat bubbles using a custom cell

2008-07-15 Thread Nick Zitzmann


On Jul 15, 2008, at 9:08 PM, TARUN CHAPLOT wrote:

I am very new to objective C and working on some application which  
needs to create Chat bubbles similar to iChat.
Can anybody help me to find some documentation or the sample code  
which will help me to make chat bubbles using custom cell.



That sounds like something that would be way over the top for a  
beginner's project, unless you have a lot of experience with vector  
drawing on other platforms. But FWIW, I suspect iChat internally uses  
a WebView to draw the chat area. You can probably also MacGuyver such  
a view by using NSCollectionView, NSBezierPath, and text drawing,  
using NSLayoutManager to calculate the sizes of the text. Good luck...


Nick Zitzmann
http://www.chronosnet.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]


Log Into a Website

2008-07-15 Thread Bridger Maxwell
Hey,
I am writing a Cocoa app that will access a user's account that is set up on
a server. How do I log in and keep logged in? Do I keep a connection open?
Also, from the server side (php, ruby, etc.) can I use sessions to keep
track of a user being logged in from a Cocoa application, or does that only
work when using a browser? Perhaps there is an example or an open source
program I can pick apart? This will have to be a secure connection too.

Thank You,
Bridger Maxwell
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how do I make chat bubbles using a custom cell

2008-07-15 Thread Andrew Farmer

On 15 Jul 08, at 21:50, Nick Zitzmann wrote:

On Jul 15, 2008, at 9:08 PM, TARUN CHAPLOT wrote:
I am very new to objective C and working on some application which  
needs to create Chat bubbles similar to iChat.
Can anybody help me to find some documentation or the sample code  
which will help me to make chat bubbles using custom cell.



That sounds like something that would be way over the top for a  
beginner's project, unless you have a lot of experience with vector  
drawing on other platforms. But FWIW, I suspect iChat internally  
uses a WebView to draw the chat area.


It doesn't, actually - iChat came before Safari. Adium does use a  
WebView to great effect, though - that may be worth taking a look at,  
though you'll need to know HTML / JS reasonably well to use it  
effectively.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Redrawing CALayer subclass when super layer is scaled

2008-07-15 Thread Rick Mann


On Jul 9, 2008, at 12:59:33, David Duncan wrote:

A tiled layer will trigger redraws when it detects that higher (or  
lower) resolution content is available. It caches this drawing as  
well, so you won't get called to redraw just because of a resize of  
content at that level is already available.



So, this isn't really working they way I want it to.

I have a canvas, which is my window's root layer. In that I have an  
arbitrary number of sublayers. If I set the scaling (via  
transform.scale) of the root layer to x2, everything is redrawn to  
double the size (and it smoothly animates up to that scale).


However, at the time that my drawing code is called, the CGContextRef  
that's handed to me is NOT scaled. So my drawing is done small, and  
then only scaled afterward by some blit operation. The result is very  
pixilated lines.


I've tried making my root layer a CATiledLayer, and I've tried making  
my individual sublayers CATiledLayers (and setting levels of detail  
for both). Nothing works.


I don't really want to have to set the scale on each sublayer; this  
seems to defeat the purpose of the drawing transform.


The documentation says that any transform applied to a layer also  
applies to its sublayers, but this is not what I'm seeing; at least,  
not at draw time.


Any suggestions?

--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how do I make chat bubbles using a custom cell

2008-07-15 Thread Jens Alfke


On 15 Jul '08, at 8:08 PM, TARUN CHAPLOT wrote:

I am very new to objective C and working on some application which  
needs to create Chat bubbles similar to iChat.
Can anybody help me to find some documentation or the sample code  
which will help me to make chat bubbles using custom cell.


A custom cell isn't a good way to go about this! If you do that, you  
have to do text layout inside every cell to compute its height, which  
is quite expensive, and has to be recalculated any time the view  
changes width. It also makes it impossible to select text in more than  
one cell.


iChat used an NSTextView subclass for the chat display, which overrode  
-drawViewBackgroundInRect (?) to draw the bubbles before the regular  
text-view code drew the text on top. To find the bounds of the bubbles  
it searched the backing store for text ranges marked with a custom  
attribute that indicated they were chat messages, then asked the  
layout manager for the bounding box of each glyph range. That's the  
gist of it; the details got very nasty, especially making it perform  
well as the number of messages increased.


In Leopard I believe they switched to using a WebView with a special  
CSS stylesheet. Safari supports some CSS 3 selectors that make this a  
lot easier than it's been in the past; in particular, there's a  
selector to specify a single background image for a block that slices  
the image into 9 pieces that get applied to the center, edges and  
corners.


It's probably pretty clear that this is not a newbie project. : 
(  Ironically, I did start working on the first iChat prototype the  
day I left the Cocoa training class, but my first implementation used  
an NSMatrix with a cell for each balloon, which is how I learned that  
this approach doesn't work very well. It's fairly simple, though. You  
just make an NSMatrix of NSTextFieldCells and add a row for every  
message. You can subclass NSTextFieldCell and override one of the  
drawing methods to draw the balloon background (at the time I just  
made an NSBezierPath and filled and outlined it with a solid color.)


—Jens

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]

Text selection in NSTableView

2008-07-15 Thread Satoshi Nakagawa
Hi,

I have a custom table view cell.
The cell made of an image and some text.
The text includes URL link, it should be rendered like a html link.

To implement it, I made a custom cell class.
It renders an image and text in drawInteriorWithFrame:inView:.

But I cannot implement text selection on it.
Is there a good way to implement it?

-- 
Satoshi Nakagawa
___

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

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