Re: Managed Object with Getter

2010-01-13 Thread Kyle Sluder
On Tue, Jan 12, 2010 at 6:53 PM, Richard Somers
rsomers.li...@infowest.com wrote:
 A property declaration attribute with the getter shown below does not work
 for a NSManagedObject subclass.

     @property (nonatomic, retain, getter=isSelected) NSNumber *selected;

 It produces error unrecognized selector sent to instance.

 What did I do wrong?

This code cannot generate that error because it doesn't send any
messages. You need to post the code to which the error actually
refers.

--Kyle
___

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

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

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

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


Application help window size

2010-01-13 Thread Alexander Bokovikov

Hi, All,

Does anybody know how could I define default help window width?
I've created a navigation menu, which is too wide for default window,  
so horizontal scrollbar appears.


Or should I adjust my help design to the existing help window default  
size?


Thanks,
Alexander
___

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

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

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

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


Re: Application help window size

2010-01-13 Thread Ron Fleckner


On 13/01/2010, at 7:35 PM, Alexander Bokovikov wrote:


Hi, All,

Does anybody know how could I define default help window width?
I've created a navigation menu, which is too wide for default  
window, so horizontal scrollbar appears.


Or should I adjust my help design to the existing help window  
default size?


Thanks,
Alexander


The Help viewer window size is determined by the user.  If I open help  
in AppA and resize it, then close it and later open help in AppB, the  
window is the size it was set to by the user in AppA.  You might be  
able to use javascript to set the window size, but if I, as a user,  
like to have my help window a particular size, your app will change  
that and I, as a user, will be unhappy with your app.  Consequences  
may flow :)



Ron

___

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

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

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

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


NSWeekCalendarUnit and DIN 1355 / ISO 8601

2010-01-13 Thread Alexander Spohr
Hi list,

I just fell over NSWeekCalendarUnit. It delivers the week of a date.
Sadly it seems to do so only for the US but not for e.g. Germany and all ISO 
8601 countries (most of europe) - except UK.

The current week is 3 in the US but 2 in Europe (except UK ;)

For a list see:
http://en.wikipedia.org/wiki/Seven-day_week#Week_numbering

Currently we use something like this:

[[[NSCalendar currentCalendar]
components:NSWeekCalendarUnit fromDate:[NSDate date]]
week];

Is this a bug of NSCalendar or am I doing something wrong?

atze

___

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

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

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

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


Re: Managed Object with Getter

2010-01-13 Thread Richard Somers

On Jan 13, 2010, at 1:17 AM, Kyle Sluder wrote:


This code cannot generate that error because it doesn't send any
messages. You need to post the code to which the error actually
refers.


This works.

 @property (nonatomic, retain) NSNumber *selected;

 if ([[self selected] boolValue]) { ... }

This produces error unrecognized selector sent to instance.

 @property (nonatomic, retain, getter=isSelected) NSNumber  
*selected;


 if ([[self isSelected] boolValue]) { ... }

--Richard

___

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

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

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

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


Re: Managed Object with Getter

2010-01-13 Thread Jim Correia
On Jan 13, 2010, at 8:39 AM, Richard Somers wrote:

 On Jan 13, 2010, at 1:17 AM, Kyle Sluder wrote:
 
 This code cannot generate that error because it doesn't send any
 messages. You need to post the code to which the error actually
 refers.
 
 This works.
 
 @property (nonatomic, retain) NSNumber *selected;
 
 if ([[self selected] boolValue]) { ... }
 
 This produces error unrecognized selector sent to instance.
 
 @property (nonatomic, retain, getter=isSelected) NSNumber *selected;
 
 if ([[self isSelected] boolValue]) { … }

Assuming you are using @dynamic and relying on Core Data to generate the 
accessors for you, that isn’t going to work. Core Data doesn’t support the 
isPropertyName getter style.

This style is typically used for non-object BOOL values. If you use it for an 
NSNumber attribute, you run the risk of someone familiar with the pattern 
assuming it is a BOOL property and writing

if ([managedObject isSelected]) {

}

which will of course be be true whenever the property is non-nil, no regardless 
of the actual value.

If you want or need to use custom getters/setters, you’ll have to provide your 
own accessors rather than relying on the @dynamic generated ones.

- Jim___

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

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

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

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


iPhone: CATransition done (get the key?)

2010-01-13 Thread Eric E. Dolecki
Currently I am using CATransition to display a subview:

[window addSubview:monthView.view];

CATransition *animation = [CATransition animation];

[animation setDuration:0.25];

*[animation setDelegate:self];*

[animation setType:kCATransitionPush];

[animation setSubtype:kCATransitionFromLeft];

[animation setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

[[monthView.view layer] addAnimation:animation forKey:@fadeIn];


So that delegate opens up a callback for animationDidStop:

- (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag {

However I also have a method to dismiss a subView using CATransition - and
the same callback is called. How can I determine what the *key* is in the
animationDidStop? I basically just need to determine in what context the
animationDidStop is being called.

Thanks for any pointers. Continuing to Google.

Eric
___

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

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

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

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


Scaled NSImage size of NSImageView?

2010-01-13 Thread Gustavo Pizano
Hello all.
I want to get the actual size of the NSImage which I dragged into an 
NSImaveView that has the imageScaling to NSImageScaleProportionallyUpOrDown.

I have found some answers on the web, but it seems Im still missing something, 
or those answer don't apply to me.. On of them was to create a Category of 
NSImageCell and there add a method like this


@implementation NSImageCell  (XWSImageCellCategory); 

-(NSRect)rectCoveredByImageInBounds:(NSRect) bounds{
return [super  imageRectForBounds:bounds];
}


I have done that.. but Im getting still the size of the NSImageView.

I dunno if  Im missing something in my Custom NSImageView, overriding some 
method, but I don't see what might help me.

Thanks a lot

Best Regards

Gustavo Pizano

___

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

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

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

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


coreAnimation CALayers and NSViews, which to use ?

2010-01-13 Thread Nicolas Berloquin
Hi !

I'm new to coreAnimation, and there is something that I don't grasp yet.
I'd like to composite a series of images (sometimes a few hundred) inside a
view.
Those images will sometimes remain where they are, or be resized or moved
around.
From what I understand, backing an NSView with a CALayer brings an optimized
rendering
pipeline (I guess using the GPU etc).
From the docs, CALayers are described as model objects, used to orchestrate
the drawings
and animations. Alright.
But the docs also describe how to use CALayer delegates to handle the actual
drawing
(drawLayer: inContext:).
So this is getting me a bit confused.

I've started to create a simple view hierarchy with a scrollview and an
NSView in it, in IB, and I
checked the wants coreAnimation layer on my NSView.
Should I then override drawRect: in my view and draw each of my images there
(intersecting the visible rect),
or rather should I not create an NSView, and add programmatically a CALayer
to the
scrollview and override drawLayer: inContext: and do the drawing there ?
Or (but this sound much heavier) should I add many NSViews or NSImageViews
to the
backing layer and move/resize them afterwards ?

hm

any light on this will be more than welcome !

thanks
___

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

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

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

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


Re: Cocoa-dev Digest, Vol 7, Issue 57

2010-01-13 Thread Daniel Meachum
NSImage *image = [imageView image]; //IBOutlet to ImageView
NSSize imageSize = [image size];
NSLog(@Height: %f, Width: %f, imageSize.height, imageSize.width);

This number stayed the same for me regardless of the scaling and matched the 
dimensions specified in the Finder.
 
On Jan 14, 2010, at 12:46 AM, cocoa-dev-requ...@lists.apple.com wrote:

 Hello all.
 I want to get the actual size of the NSImage which I dragged into an 
 NSImaveView that has the imageScaling to NSImageScaleProportionallyUpOrDown.
 
 I have found some answers on the web, but it seems Im still missing 
 something, or those answer don't apply to me.. On of them was to create a 
 Category of NSImageCell and there add a method like this
 
 
 @implementation NSImageCell  (XWSImageCellCategory); 
 
 -(NSRect)rectCoveredByImageInBounds:(NSRect) bounds{
   return [super  imageRectForBounds:bounds];
 }
 
 
 I have done that.. but Im getting still the size of the NSImageView.
 
 I dunno if  Im missing something in my Custom NSImageView, overriding some 
 method, but I don't see what might help me.
 
 Thanks a lot
 
 Best Regards
 
 Gustavo Pizano

___

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

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

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

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


Problem printing offscreen PDFViews

2010-01-13 Thread Waldo Lee Sharvey
I have a situation where I want to print a multi-page PDF. While I
could use the PDFKit utility classes and/or quartz functions to get
the information to manually write drawing/pagination code for a NSView
subclass, I had thought that quicker alternative would be to create an
off-screen PDFView and tell it to print itself. When I tried this
solution, the print dialog didn't go away, all of the print settings
controls on the right half of the print dialog disappeared, and the
application froze.

I then wrote a tiny test application with the following method that
illustrates the problem. When the test program is compiled without the
USE_PDF_VIEW preprocessor macro defined, the blank view displays fine.
If USE_PDF_VIEW is defined, the document doesn't print, most of the
print dialog controls disappear, and the app freezes. While I have
other ways of accomplishing my goal, I'm curious as to why this
shortcut doesn't work. Is there something about Cocoa drawing I still
don't understand? Am I banging into Apple Voodoo Magic(tm) behind the
scenes that makes PDFView behave in a completely different way than
other NSViews?

- (void)printMyStuff:(id)sender {

NSPrintInfo *currInfo = [NSPrintInfo sharedPrintInfo];

#ifdef USE_PDF_VIEW


PDFView *pdfView = [[PDFView alloc] init];
PDFDocument *pdfDoc = [[PDFDocument alloc] initWithURL:[NSURL
fileURLWithPath:@/Users/wls/Documents/my_document.pdf]];
[pdfView setDocument: pdfDoc];
[pdfView printWithInfo:currInfo autoRotate:YES];


#else

NSView *myView = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 500, 
500)];
NSPrintOperation *myop = [NSPrintOperation
printOperationWithView:myView printInfo:currInfo];
[myop runOperation];


#endif

}
___

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

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

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

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


Re: iPhone: CATransition done (get the key?)

2010-01-13 Thread Fritz Anderson
On 13 Jan 2010, at 8:44 AM, Eric E. Dolecki wrote:

 Currently I am using CATransition to display a subview:
 
 [window addSubview:monthView.view];
 
 CATransition *animation = [CATransition animation];
 
 [animation setDuration:0.25];
 
 *[animation setDelegate:self];*
 
 [animation setType:kCATransitionPush];
 
 [animation setSubtype:kCATransitionFromLeft];
 
 [animation setTimingFunction:[CAMediaTimingFunction
 functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
 
 [[monthView.view layer] addAnimation:animation forKey:@fadeIn];
 
 
 So that delegate opens up a callback for animationDidStop:
 
 - (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag {
 
 However I also have a method to dismiss a subView using CATransition - and
 the same callback is called. How can I determine what the *key* is in the
 animationDidStop? I basically just need to determine in what context the
 animationDidStop is being called.
 
 Thanks for any pointers. Continuing to Google.

Do I understand correctly that you want to know which animation the 
animationDidStop:finished: refers to? Why not use the theAnimation parameter? 
You can retain a reference to your two animations and do 

if (theAnimation == dismissAnimation)

to choose the proper action.

BTW, terminology nit: Delegate refers to the object responding to the 
callback methods, not to any action of a delegate, object using a delegate, or 
any occurrence of setting a delegate object.

— F

___

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

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

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

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


Re: Scaled NSImage size of NSImageView?

2010-01-13 Thread David Duncan
On Jan 13, 2010, at 6:57 AM, Gustavo Pizano wrote:

 I want to get the actual size of the NSImage which I dragged into an 
 NSImaveView that has the imageScaling to NSImageScaleProportionallyUpOrDown.


Does requesting the size from the NSImage not do what you want?
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: coreAnimation CALayers and NSViews, which to use ?

2010-01-13 Thread David Duncan
On Jan 13, 2010, at 7:43 AM, Nicolas Berloquin wrote:

 Hi !
 
 I'm new to coreAnimation, and there is something that I don't grasp yet. I'd 
 like to composite a series of images (sometimes a few hundred) inside a view.
 Those images will sometimes remain where they are, or be resized or moved 
 around.
 
 From what I understand, backing an NSView with a CALayer brings an optimized 
 rendering pipeline (I guess using the GPU etc).
 From the docs, CALayers are described as model objects, used to orchestrate 
 the drawings and animations. Alright.
 But the docs also describe how to use CALayer delegates to handle the actual 
 drawing (drawLayer: inContext:).
 So this is getting me a bit confused.

You can get content into a CALayer either by drawing content from Quartz (which 
is what the -drawLayer:inContext: delegate method is for) or by setting the 
contents property of the layer to one of a view supported class types 
(CGImageRef, NSImage on 10.6+, or the contents of another layer).

When you layer back an NSView, it implements the machinery to get whatever 
drawing occurs inside of -drawRect: into the contents of the layer.

 I've started to create a simple view hierarchy with a scrollview and an 
 NSView in it, in IB, and I checked the wants coreAnimation layer on my NSView.
 Should I then override drawRect: in my view and draw each of my images there 
 (intersecting the visible rect),
 or rather should I not create an NSView, and add programmatically a CALayer 
 to the scrollview and override drawLayer: inContext: and do the drawing there 
 ?
 Or (but this sound much heavier) should I add many NSViews or NSImageViews to 
 the backing layer and move/resize them afterwards ?


The simplest way to get started is to pretend like layers don't exist and just 
build your view hierarchy as normal. Then as you already have, just turn on the 
Core Animation layer for root view (which will automatically turn on core 
animation for all child views). Once you've gotten the hang of what AppKit has 
to offer (and it does have quite a bit to offer) then you can consider diving 
deeper into using Core Animation directly.
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: Scaled NSImage size of NSImageView?

2010-01-13 Thread Gustavo Pizano

On Jan 13, 2010, at 5:53 PM, David Duncan wrote:

 On Jan 13, 2010, at 6:57 AM, Gustavo Pizano wrote:
 
 I want to get the actual size of the NSImage which I dragged into an 
 NSImaveView that has the imageScaling to NSImageScaleProportionallyUpOrDown.
 
 
 Does requesting the size from the NSImage not do what you want?

it gives me the size of the original image but not the scaled that is inside 
the NSImageView.

G.


 --
 David Duncan
 Apple DTS Animation and Printing
 

___

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

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

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

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


Re: iPhone: CATransition done (get the key?)

2010-01-13 Thread Eric E. Dolecki
Is there a way to do it without retaining a reference? I could do that, but
what is that key used for if not for referencing later somehow?

On Wed, Jan 13, 2010 at 11:43 AM, Fritz Anderson fri...@manoverboard.orgwrote:

 On 13 Jan 2010, at 8:44 AM, Eric E. Dolecki wrote:

  Currently I am using CATransition to display a subview:
 
  [window addSubview:monthView.view];
 
  CATransition *animation = [CATransition animation];
 
  [animation setDuration:0.25];
 
  *[animation setDelegate:self];*
 
  [animation setType:kCATransitionPush];
 
  [animation setSubtype:kCATransitionFromLeft];
 
  [animation setTimingFunction:[CAMediaTimingFunction
  functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
 
  [[monthView.view layer] addAnimation:animation forKey:@fadeIn];
 
 
  So that delegate opens up a callback for animationDidStop:
 
  - (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag
 {
 
  However I also have a method to dismiss a subView using CATransition -
 and
  the same callback is called. How can I determine what the *key* is in the
  animationDidStop? I basically just need to determine in what context the
  animationDidStop is being called.
 
  Thanks for any pointers. Continuing to Google.

 Do I understand correctly that you want to know which animation the
 animationDidStop:finished: refers to? Why not use the theAnimation
 parameter? You can retain a reference to your two animations and do

 if (theAnimation == dismissAnimation)

 to choose the proper action.

 BTW, terminology nit: Delegate refers to the object responding to the
 callback methods, not to any action of a delegate, object using a delegate,
 or any occurrence of setting a delegate object.

— F




-- 
http://ericd.net
Interactive design and development
___

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

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

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

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


Re: Scaled NSImage size of NSImageView?

2010-01-13 Thread David Duncan
On Jan 13, 2010, at 9:17 AM, Gustavo Pizano wrote:

 On Jan 13, 2010, at 5:53 PM, David Duncan wrote:
 
 On Jan 13, 2010, at 6:57 AM, Gustavo Pizano wrote:
 
 I want to get the actual size of the NSImage which I dragged into an 
 NSImaveView that has the imageScaling to NSImageScaleProportionallyUpOrDown.
 
 Does requesting the size from the NSImage not do what you want?
 
 it gives me the size of the original image but not the scaled that is inside 
 the NSImageView.


I see. That wasn't how I interpreted the question :).

That said, I don't see how you couldn't just calculate this yourself. Just grab 
the size of the image, figure out what the less of the two scales you need to 
fit the width or height of the image view, then scale the other component by 
the same value.
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: Snapshotting hidden UIViews

2010-01-13 Thread Matt Neuburg
On Tue, 12 Jan 2010 14:18:05 -0600, Michael Gardner gardne...@gmail.com
said:
I'm trying to create a snapshot UIImage from a UITextView that's inside a
larger, hidden UIView. renderInContext: works fine for visible UIView layers,
but I can't get consistent results for hidden views.

I read somewhere (can't recall the source, but it wasn't authoritative) that
this is expected behavior, and that -renderInContext: is only guaranteed to work
for visible UIViews' layers. Is this true? If so, how else can I replicate
*exactly* what my UITextView would look like when visible?

In my JACTVocab app I have a similar problem: I need to make a snapshot of
a situation in my window that doesn't exist yet. In other words, my window
is in situation A, but I need a snapshot of situation B. I will eventually
show the user situation B, but I need the snapshot first.

So what I do is: I take a snapshot of situation A, and cover the window with
a borderless window containing that snapshot. This hides what I am about to
do in the real window. Now I change the situation in the window to situation
B. The user cannot see this happening because snapshot of situation A is
covering the window. Now I take the snapshot of situation B (this works
perfectly well even though the second window is covering it).

The hand is quicker than the eye, and the user never notices (I hope).

Also, I use cacheDisplayInRect, not renderInContext. But it may be that
there are reasons why you don't have that option...

Hope this helps some - m.

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



___

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

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

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

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


Re: Search multiple / all properties in single NSPredicate statement

2010-01-13 Thread Kirk Kerekes
Create a property for the target class that concatenates the text value of all 
the other properties of interest, and then search on that?

On Jan 13, 2010, at 9:46 AM, cocoa-dev-requ...@lists.apple.com wrote:

 Message: 5
 Date: Tue, 12 Jan 2010 17:10:10 -0800
 From: Mike Chambers mikechamb...@gmail.com
 Subject: Search multiple / all properties in single NSPredicate
   statement
 To: cocoa-dev@lists.apple.com
 Message-ID:
   844fa2bc1001121710y1603e480rcc3147de3eaf5...@mail.gmail.com
 Content-Type: text/plain; charset=ISO-8859-1
 
 I am using NSPredicate to filter Mutable Arrays of objects. This works
 great. However, I have a need to filter on multi object properties in
 the Array. Basically, a full text search of the object properties.
 
 I know I can do this by creating a compound predicate for each field,
 but I wanted to check and see if there was an easier way to accomplish
 this.
 
 I tried to use a wildcard for the keypath:
 
 [NSPredicate predicateWithFormat@* == 'foo'];
 
 But, that doesnt work. Looking at the docs, I dont see a way to do
 this, but wanted to ping the list.
 
 So, is there anyway to search multiple / all object fields in a single
 predicate statement?

___

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

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

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

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


Displaying a non-contentual menu attachPopUpWithFrame

2010-01-13 Thread Eric Gorr
In the 'Application Menu and Pop-up List Programming Topics for Cocoa' document 
it says:

The preferred approach for programmatically displaying a non-contextual menu is 
to create an NSPopUpButtonCell object, set its menu, and then call send a 
attachPopUpWithFrame:inView: message to the pop-up button cell.

I was wondering if anyone was aware of some sample code demonstrating this 
technique.

Thank you.

___

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

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

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

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


Re: CATransition done (get the key?)

2010-01-13 Thread Matt Neuburg
On Wed, 13 Jan 2010 09:44:55 -0500, Eric E. Dolecki edole...@gmail.com
said:
Currently I am using CATransition to display a subview:

[window addSubview:monthView.view];

CATransition *animation = [CATransition animation];

[animation setDuration:0.25];

*[animation setDelegate:self];*

[animation setType:kCATransitionPush];

[animation setSubtype:kCATransitionFromLeft];

[animation setTimingFunction:[CAMediaTimingFunction
functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

[[monthView.view layer] addAnimation:animation forKey:@fadeIn];


So that delegate opens up a callback for animationDidStop:

- (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag {

However I also have a method to dismiss a subView using CATransition - and
the same callback is called. How can I determine what the *key* is in the
animationDidStop? I basically just need to determine in what context the
animationDidStop is being called.

Thanks for any pointers. Continuing to Google.

I think this is what you're looking for:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreAn
imation_guide/Articles/KVCAdditions.html

What this extremely cool first section is trying to tell you is that you can
set an arbitrary non-existent key on your animation and retrieve it later.
Arbitrary means you define the key - as if a CAAnimation were an
NSDictionary. So you can mark your animation in any way you want, as a way
of identifying it later. Example code typed in mail, don't take literally:

CATransition *animation = [CATransition animation];
[animation setValue: @fadeIn forKey: @wtfIsThis];

And later:

- (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag {
   id wtf = [theAnimation valueForKey: @wtfIsThis]; // and so on

m.

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



___

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

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

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

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


Re: iPhone: CATransition done (get the key?)

2010-01-13 Thread glenn andreas

On Jan 13, 2010, at 11:18 AM, Eric E. Dolecki wrote:

 Is there a way to do it without retaining a reference? I could do that, but
 what is that key used for if not for referencing later somehow?
 

The key is used by the layer, not the animation.  Animations are just generic 
generators that take a time value and create a value - it's up to the layer 
to decide what to do with that value.

You can always use CALayer's animationForKey: to find out if it the animation 
for a specific key:

if ([theLayer animationForKey:@fadeIn] == theAnimation) {
}




Glenn Andreas  gandr...@gandreas.com 
 http://www.gandreas.com/ wicked fun!
Mad, Bad, and Dangerous to Know

___

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

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

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

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


Re: Scaled NSImage size of NSImageView?

2010-01-13 Thread Gustavo Pizano
Thanks David.. I did so.. I just thought there was such a methohd or something 
due that the image its already being scaled, so to don't make recalculations 
that were already done.. Anyway..

Thanks

Gustavo

On Jan 13, 2010, at 6:20 PM, David Duncan wrote:

 On Jan 13, 2010, at 9:17 AM, Gustavo Pizano wrote:
 
 On Jan 13, 2010, at 5:53 PM, David Duncan wrote:
 
 On Jan 13, 2010, at 6:57 AM, Gustavo Pizano wrote:
 
 I want to get the actual size of the NSImage which I dragged into an 
 NSImaveView that has the imageScaling to 
 NSImageScaleProportionallyUpOrDown.
 
 Does requesting the size from the NSImage not do what you want?
 
 it gives me the size of the original image but not the scaled that is inside 
 the NSImageView.
 
 
 I see. That wasn't how I interpreted the question :).
 
 That said, I don't see how you couldn't just calculate this yourself. Just 
 grab the size of the image, figure out what the less of the two scales you 
 need to fit the width or height of the image view, then scale the other 
 component by the same value.
 --
 David Duncan
 Apple DTS Animation and Printing
 

___

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

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

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

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


Best practice example for a setup wizard?

2010-01-13 Thread Ian Piper
Hi all,

For one of my applications I want to do a check at startup to see whether a 
profile and password has been set for the current user, and if not to take them 
through a setup wizard. I'm sure I can mug my way through writing this but it 
feels like the kind of thing for which there might be an example illustrating 
best practice. Can anyone point me at some documentation or examples that might 
help?

Thanks,


Ian.
--
Ian Piper
ianpi...@mac.com
--
If I'd asked people what they wanted, they would have said faster horses (Henry 
Ford)





___

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

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

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

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


Re: setTailIndent problems

2010-01-13 Thread Ross Carter
On Jan 11, 2010, at 3:31 PM, Fabry, Geza wrote:
 I try to set tailIndent for an NSMutableParagraphStyle attribute of an 
 NSMutableAttributedString. The documentation says:
   If positive, this is the distance from the leading margin (for example, 
 the left margin in left-to-right text). That is, it's the absolute line 
 width. If 0 or negative, it's the distance from the trailing margin-the value 
 is added to the line width.
 I found however that both positive and negative values are measured from the 
 right margin, positive values make the text narrower, negative values make it 
 wider. (The same seems to be true for kCTParagraphStyleSpecifierTailIndent in 
 CoreText).
 Is it a bug in the documentation, in functionality or in my code?

Almost certainly your code. NSMutableParagraphStyle has been around a long time 
and as far as I can tell, it works as advertised.

I don't know what you mean by positive values make the text narrower, negative 
values make it wider. Wider than what? Can you state specifically what you are 
observing?

If both positive and negative values are measured from the right margin, then 
the line fragment widths would be the same whether the value is positive or 
negative, but you say they are different.

-Ross
___

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

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

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

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


NSDirectoryEnumerator and URLs

2010-01-13 Thread Jamie Hardt
Hello all,

I'm using a directory enumerator to recurse through a series of directories, 
and it always fails after going through a certain number of enumerations.  If I 
enumerate through the same directory over and over, it tends to fail in about 
the same place, but if I enumerate through other directories, it will fail but 
after completing a different number of enumerations, so I don't think it's 
necessarily a memory thing or something wrong with my file system.

It always comes back with the same error number (256), which macerror cannot 
identify:

2010-01-13 10:14:34.078 afindex[821:1b03] directoryEnumerator failed on enum 
1598, error description: The operation couldn\U2019t be completed. 
(NSCocoaErrorDomain error 256.)

Here's my code, I can't figure out why it's failing...

/* enumeration.m */

__block NSUInteger i = 0;
NSFileManager *fm = [[NSFileManager alloc] init];
NSDirectoryEnumerator *dirEnum = [fm enumeratorAtURL:folderURL
includingPropertiesForKeys:nil
  options:NSDirectoryEnumerationSkipsHiddenFiles ^ 
NSDirectoryEnumerationSkipsPackageDescendants
  errorHandler:^(NSURL *url, NSError *error){
 NSLog(@directoryEnumerator failed on enum %i, 
error description: %@,i,[error localizedDescription]);
 return NO;
  }];


NSAutoreleasePool *ap = [[NSAutoreleasePool alloc] init];
NSURL *aPath;
while (aPath = [dirEnum nextObject]) {
if ( 1 ) {
  NSDictionary *metadataDict = [engine metadataDictionaryForFile:[aPath path] ];
  [database indexMetadata:metadataDict forFileAtURL:aPath];
}
if (++i % 50 == 0 ) {
  [ap release];
  ap = [[NSAutoreleasePool alloc] init];
}

}
[path release];
[ap release];
[fm release];___

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

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

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

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


NSScroller knob reposition

2010-01-13 Thread David Blanton

I am seeing some strange behavior.

I set the knob position of the horz and vert scrollers as follows:

- (void)centerScrollers {

[m_hScroller setDoubleValue:0.5];
[m_vScroller setDoubleValue:0.5];

}

Then when I move either knob with the mouse the other knob moves as  
well by some random amount.


Doesn't seem like correct behavior to me.

-db
___

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

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

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

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


Cocoaheads Lake Forest (92630) meeting TODAY Wed 1/13/2010 at 7 pm on topics including Core Animation

2010-01-13 Thread Scott Ellsworth
CocoaHeads Lake Forest will be meeting on the second Wednesday of the
month.  We will be meeting at the Orange County Public Library (El
Toro) community room, 24672 Raymond Way, Lake Forest, CA 92630

Please join us tonight from 7pm to 9pm on Wednesday, 1/13.

We will have a selection of topics tonight, including looking at the
code from Core Animation by Bill Dudney.  (If you have experience
with this book, and want to comment or bring alternative code samples,
please do so.  This is to be an interactive session.

We are planning our topics for 2010.  If you are able and willing to
speak on Core Animation, Open GL, Mac Open Source, or Cocoa 101 for
either iPhone or Mac, please contact me.

As I mentioned a few days ago, Google Irvine is having an open house
on the 27th, and I can answer questions about it and arrange invites.
There are several active 20% projects on the Mac platform.

Bring your comments, your books, and your bugs, and we will leap right in.

As always, details and the upcoming meeting calendar can be found at
the cocoaheads web site at www.cocoaheads.org in the Lake Forest, CA
section.
___

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

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

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

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


Re: NSDirectoryEnumerator and URLs

2010-01-13 Thread Robert Martin
Isn't the path returned by NSDirectoryEnumerator a relative path to the path 
you initialize it with?

The docs say: An NSDirectoryEnumerator object enumerates the contents of a 
directory, returning the pathnames of all files and directories contained 
within that directory. These pathnames are relative to the directory.

Have a look at the value of aPath - you might need to append it to the string 
path of the folderURL...unless your engine is appending it.


On Jan 13, 2010, at 1:32 PM, Jamie Hardt wrote:

 Hello all,
 
 I'm using a directory enumerator to recurse through a series of directories, 
 and it always fails after going through a certain number of enumerations.  If 
 I enumerate through the same directory over and over, it tends to fail in 
 about the same place, but if I enumerate through other directories, it will 
 fail but after completing a different number of enumerations, so I don't 
 think it's necessarily a memory thing or something wrong with my file system.
 
 It always comes back with the same error number (256), which macerror cannot 
 identify:
 
 2010-01-13 10:14:34.078 afindex[821:1b03] directoryEnumerator failed on enum 
 1598, error description: The operation couldn\U2019t be completed. 
 (NSCocoaErrorDomain error 256.)
 
 Here's my code, I can't figure out why it's failing...
 
 /* enumeration.m */
 
 __block NSUInteger i = 0;
 NSFileManager *fm = [[NSFileManager alloc] init];
 NSDirectoryEnumerator *dirEnum = [fm enumeratorAtURL:folderURL
includingPropertiesForKeys:nil
  options:NSDirectoryEnumerationSkipsHiddenFiles ^ 
 NSDirectoryEnumerationSkipsPackageDescendants
  errorHandler:^(NSURL *url, NSError *error){
 NSLog(@directoryEnumerator failed on enum %i, 
 error description: %@,i,[error localizedDescription]);
 return NO;
  }];
 
 
 NSAutoreleasePool *ap = [[NSAutoreleasePool alloc] init];
 NSURL *aPath;
 while (aPath = [dirEnum nextObject]) {
 if ( 1 ) {
  NSDictionary *metadataDict = [engine metadataDictionaryForFile:[aPath path] 
 ];
  [database indexMetadata:metadataDict forFileAtURL:aPath];
 }
 if (++i % 50 == 0 ) {
  [ap release];
  ap = [[NSAutoreleasePool alloc] init];
 }
 
 }
 [path release];
 [ap release];
 [fm release];
___

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

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

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

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


Re: iCal-style NSTextFields

2010-01-13 Thread Brad Gibbs
I'm trying to implement this.

I created a custom NSTextField subclass, called ICNTextField.  When an 
ICNTextField instance receives a mouseDown event, it initializes a custom 
NSWindow subclass with a borderless window mask.  In the window subclass, I've 
overridden -canBecomeKeyWindow: so that it always returns yes.  

When ICNTextField receives the controlTextDidEndEditing notification, it takes 
the string value from the text field in the borderless window and displays it 
properly, but the Core Data attribute to which the original text field is bound 
does not update its value.

I've looked into endEditing and endEditing:, nextKeyView and various forms of 
commit, but can't seem to find a way to get the bindings to recognize the new 
string value.  

I'd like to do this in a generic fashion, so I can make any text field an 
ICNTextField and know that its bound attributes will be updated without having 
to write additional code for each text field.  Any help would be appreciated. 


On Jan 10, 2010, at 2:54 PM, Josh Abernathy wrote:

 If you're asking about the shadow, create a child window and move them to 
 that when they're editing.
 
 
 On Jan 10, 2010, at 11:56 AM, Seth Willits wrote:
 
 On Jan 10, 2010, at 11:49 AM, Ulai Beekam wrote:
 
 Go into iCal (in Snow Leopard) and create a new event and and then click 
 outside that event. Then double-click on that event and hit the Edit 
 button.
 
 In the window you see, you have some neat looking text fields that show 
 only text when not in focus but show you a white background with a shadow 
 effect when in edit mode.
 
 How can I make such text fields? Does anyone happen to have them ready-made?
 
 They're just text fields. Change the background color, turn off the border, 
 and make them read-only when not in edit mode. 
 
 
 --
 Seth Willits
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/joshaber%40gmail.com
 
 This email sent to josha...@gmail.com
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/bradgibbs%40mac.com
 
 This email sent to bradgi...@mac.com

___

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

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

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

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


Changing FirstResponder with Inputmethod

2010-01-13 Thread imai asato
Hello,

I have NSTextField and some views(NSTableView etc).
I want interrupt keydown event when NSTextField is not first responder to input 
the key to NSTextField.
I wrote keyDown: method of my NSWindowController class like below.

- (void)keyDown:(NSEvent *)event
{
// IBOutlet NSTextField*  myInput;

if ([[self window] firstResponder] != myInput) {
[[self window] makeFirstResponder:myInput]; // to change 
keyView
[[self window] sendEvent:event];
// to process keydown event
}
}

This works well when keyboard layout is US.
But when Japanese inputmethod is on, EXC_BAD_ACCESS on CopyRgn of 
GetPortVisionRegion of CTextensionDisplay::Focus… is occur.

Does anyone have any idea?


--
imai asato




___

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

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

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

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


Trying to create an alias file by using the new NSURL methods available with Mac OS X 10.6 !

2010-01-13 Thread rohan a
Hello All,

Using the new NSURL methods available with Cocoa on Mac OS X 10.6, I am
trying to create an alias file to a certain file. However, this method
requires a NSURL data type. But I am writing a C program along with an
objective-C program to accomplish this. The C program would accept the
inputs as C strings. I would then convert them to NSString and then to NSURL
strings. However, this is not working :(
By hardcoding the NSURL strings the program works fine.

Below are the programs:

alias.c ===
/*==*/
#includestdio.h
#includeAvailabilityMacros.h

int CreateAlias(char *, char *);

int main(int argc, char *argv[])
{
   #ifdef MAC_OS_X_VERSION_10_6
   if (CreateAlias(argv[1], argv[2]))
   printf(Successful\n);
   else
   printf(Failed\n);
   #else
   printf(Cannot create Alias files\n);
   #endif
   return 0;
}
/**/

createalias.m (I use the NSURL methods for creating Aliases )
/**/
#import Foundation/Foundation.h

int CreateAlias(const char *target, const char *aliasname)
{
   CFStringRef Ref1 = CFStringCreateWithCString(NULL, target,
kCFStringEncodingASCII);

   CFStringRef Ref2 = CFStringCreateWithCString(NULL, aliasname,
kCFStringEncodingASCII);

   if (Ref1 == NULL || Ref2 == NULL)
   exit(1);

   NSString *Destination = (NSString *)Ref1;
   NSString *Alias   = (NSString *)Ref2;
   //NSURL *src =  [NSURL URLWithString:@file:///Alias_dir/aliastext];
   //NSURL *dest = [NSURL URLWithString:@
file:///Alias_dir/aliastext.alias];

   NSURL *src =  [NSURL URLWithString:Destination];
   NSURL *dest = [NSURL URLWithString:Alias];

   if (src == nil || dest == nil)
   exit(1); *// Did not exit here.*

   NSData *bookmarkData =
 [
 src
bookmarkDataWithOptions:NSURLBookmarkCreationSuitableForBookmarkFile
 includingResourceValuesForKeys:nil
 relativeToURL:nil
 error:NULL
 ];
   if (bookmarkData == NULL)
   exit(1);  // Did not exit here.

   BOOL ok = [NSURL writeBookmarkData:bookmarkData *// The program is
failing here*
   toURL:dest
   options:0
   error:NULL];
   if (ok == NO)
   return 0;

   return 1;
}
/*===*/

I also read that CFStringRef can be directly typecasted to NSString *which i
have done.

Can anyone tell me what the problem may be ?
Any comments ?

Thanks
___

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

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

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

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


Re: Displaying a non-contentual menu attachPopUpWithFrame

2010-01-13 Thread Peter Ammon
Hi Eric,

On SnowLeopard and later, use the NSMenu method popUpMenuPositioningItem: 
atLocation: inView:.

Before SnowLeopard, this is probably the easiest way:

NSPopUpButtonCell *cell = [[NSPopUpButtonCell alloc] initTextCell:@ 
pullsDown:NO];
[cell setMenu:menu];
[cell performClickWithFrame:NSMakeRect(menuLoc.x, menuLoc.y, 0, 0) 
inView:theView];
[cell release];

Hope this helps,

-Peter

On Jan 13, 2010, at 9:38 AM, Eric Gorr wrote:

 In the 'Application Menu and Pop-up List Programming Topics for Cocoa' 
 document it says:
 
 The preferred approach for programmatically displaying a non-contextual menu 
 is to create an NSPopUpButtonCell object, set its menu, and then call send a 
 attachPopUpWithFrame:inView: message to the pop-up button cell.
 
 I was wondering if anyone was aware of some sample code demonstrating this 
 technique.
 
 Thank you.

___

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

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

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

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


Re: NSDirectoryEnumerator and URLs (PS)

2010-01-13 Thread Jamie Hardt

On Jan 13, 2010, at 11:38 AM, Robert Martin wrote:

 PS - Also, when I use NSDirectoryEnumerator, it returns a string, not an 
 URL...

The documentation actually doesn't say... I assumed that a directory enumerator 
that is created with a URL would return URLs, but I guess not...  In any case, 
mutatis mutandis, this code still fails in about the same way:

/* enumeration2.h */ 

-(void)indexFolder:(NSString *)folderPath {
  NSString *localFolderPath = [folderPath copy];

  NSFileManager *fm = [[NSFileManager alloc] init];
  NSDirectoryEnumerator *dirEnum = [fm enumeratorAtPath:localFolderPath];

  NSAutoreleasePool *ap = [[NSAutoreleasePool alloc] init];
  NSString *aPath;
  while (aPath = [dirEnum nextObject]) {
 NSString *fullPath = [localFolderPath 
stringByAppendingPathComponent:aPath];
 BOOL isDir = NO;
 if ( [fm fileExistsAtPath:fullPath isDirectory:isDir]  !isDir  ) {
NSDictionary *metadataDict = [engine metadataDictionaryForFile:fullPath 
];
[database indexMetadata:metadataDict forFileAtPath:fullPath];
 }
 if (++i % 50 == 0 ) {
[ap release];
ap = [[NSAutoreleasePool alloc] init];
 }
  }
  [localFolderPath release];
  [ap release];
  [fm release];
}___

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

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

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

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


Re: Best practice example for a setup wizard?

2010-01-13 Thread Oftenwrong Soong
Hi Ian,

When you speak of a setup wizard, I think of those Windows-based apps with the 
Next and Back buttons. In my opinion, those wizards are very Windows-like, and 
therefore, annoying. ;)

Have you considered displaying a regular dialog box that asks for the relevant 
information? Unless the profile must contain a high number of settings, a 
single dialog box, without multiple pages, should be the best interface to 
request a username and password. Even if the profile contains many settings, it 
may be best not to prompt for those at all, but rather to set up a profile with 
sensible defaults. The majority of users can start using the application 
without much up-front configuration (all they enter is a username and password) 
and can play with the configuration later to their heart's content.

There is another benefit to this idea: when a user opens your application for 
the first time, he likely won't know what answers to provide to most of your 
setup questions. People often have a better idea of what they want after using 
a new application for a little while (and often they'll leave the defaults 
alone).

Soong



- Original Message 
From: Ian Piper ianpi...@mac.com
To: list-cocoa-dev Developers cocoa-dev@lists.apple.com
Sent: Wed, January 13, 2010 9:54:52 AM
Subject: Best practice example for a setup wizard?

Hi all,

For one of my applications I want to do a check at startup to see whether a 
profile and password has been set for the current user, and if not to take them 
through a setup wizard. I'm sure I can mug my way through writing this but it 
feels like the kind of thing for which there might be an example illustrating 
best practice. Can anyone point me at some documentation or examples that might 
help?

Thanks,


Ian.
--
Ian Piper
ianpi...@mac.com
--
If I'd asked people what they wanted, they would have said faster horses (Henry 
Ford)





___

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

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

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

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



  
___

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

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

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

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


Re: iPhone: CATransition done (get the key?)

2010-01-13 Thread Eric E. Dolecki
If I try this:

- (void)animationDidStop:(CAAnimation *)theAnimation finished: (BOOL)flag {

NSLog(@%@, [theAnimation type]);

}


I get a warning - but it displays reveal when I use
kCATransitionReveal. (CAAnimation
may not respond to '-type')


If I used two different types of animation, I could use that to determine
what to do next - but I don't like that warning.




On Wed, Jan 13, 2010 at 12:40 PM, glenn andreas gandr...@mac.com wrote:


 On Jan 13, 2010, at 11:18 AM, Eric E. Dolecki wrote:

  Is there a way to do it without retaining a reference? I could do that,
 but
  what is that key used for if not for referencing later somehow?
 

 The key is used by the layer, not the animation.  Animations are just
 generic generators that take a time value and create a value - it's up to
 the layer to decide what to do with that value.

 You can always use CALayer's animationForKey: to find out if it the
 animation for a specific key:

 if ([theLayer animationForKey:@fadeIn] == theAnimation) {
 }




 Glenn Andreas  gandr...@gandreas.com
  http://www.gandreas.com/ wicked fun!
 Mad, Bad, and Dangerous to Know




-- 
http://ericd.net
Interactive design and development
___

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

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

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

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


NSArrayControllers not repopulating after NSPersistentDocument load

2010-01-13 Thread Daniel Wambold
Dear List,

I have an NSPersistentDocument app using CoreData for storage. I have three 
NSArrayControllers to mediate between the three Entities in my Model and three 
NSTableViews. Everything works fine until I load a previously saved file. At 
that point, the controllers seem to have no content despite the fact that the 
tables are properly populated. That is, the NSTableView shows data, but po 
[self arrangedObjects] in GDB shows an empty array.
At first I figured it was a timing issue, so I delayed the attempt to 
manipulate an object (accessed by [[self arrangedObjects] objectAtIndex:0]) 
with a message delayed by up to several seconds with no improvement. If I force 
a fetch, I can retrieve the data, but for some reason the controller is not 
taking care of this on its own. I have verified that the controller 
automatically prepares content, and it's not fetching lazily, per IB. I'm 
sure I've missed something obvious, but I'm stuck. I'm not sure if it's 
relevant, but the value of [self managedObjectContext] is different if I check 
it in the NSPersistentDocument object immediately after - 
(BOOL)configurePersistentStoreCoordinatorForURL:(NSURL *)url ofType:(NSString 
*)fileType modelConfiguration:(NSString *)configuration 
storeOptions:(NSDictionary *)storeOptions error:(NSError **)error versus later, 
when my controller tries to manipulate its content. Although I modified the 
document's load method to investigate this (just a call to super followed by a 
break point), the same behavior exists even without overriding this method. If 
the answer is in the Apple Docs, I've missed it because I've read them several 
times now. Incidentally, the Cannot access contents of an object controller 
after a nib is loaded section of Core Data Programming Guide looked 
promising, and fetchWithRequest:merge:error returns YES, but it still doesn't 
cause the controller to repopulate. I've got perhaps 50 pieces of string data 
stored in this document, so it's not a volume of data issue, I don't think.

Thanks for any insight.
-Dan

The troublesome code, from my NSArrayController subclass, follows. The object, 
myNote, is sent, after a brief delay, from the Nib file of another object. I 
verified it contains a valid NSDate object.

- (void) myChangeStartTime:(NSNotification *)myNote
{
[self setFilterPredicate:nil];
[self rearrangeObjects];
[[[self arrangedObjects] objectAtIndex:0] setValue:[[myNote object] 
dateValue] forKey:kMyDateBindingKey];
}___

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

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

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

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


Re: NSDirectoryEnumerator and URLs

2010-01-13 Thread Quincey Morris
On Jan 13, 2010, at 10:32, Jamie Hardt wrote:

 I'm using a directory enumerator to recurse through a series of directories, 
 and it always fails after going through a certain number of enumerations.  If 
 I enumerate through the same directory over and over, it tends to fail in 
 about the same place, but if I enumerate through other directories, it will 
 fail but after completing a different number of enumerations, so I don't 
 think it's necessarily a memory thing or something wrong with my file system.

On the contrary, that behavior sounds *exactly* like a memory thing, or at 
least like a memory management problem.

I notice that you don't take ownership of (retain) the NSDirectoryEnumerator 
object. There's no obvious reason why it should disappear before the next 
regular draining of its autorelease pool, but perhaps something is triggering 
an early draining.

Also, if there happened to be any memory management bugs in the 
NSDirectoryEnumerator class itself, code like yours (using a subsidiary 
autorelease pool, in which any autoreleased memory allocated by the enumerator 
during the enumeration would be placed) would expose it.


___

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

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

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

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


Image of minimized window using 10.4 APIs

2010-01-13 Thread David Alter
I want to get the image of a minimized window that is in the dock and modify
it. But here is the catch. I need this to work on 10.4 and up. The API
miniwindowImage from NSWindow will only return something if you have
modified the image. Is there a way to do this?

Another way to do this is if I could create an image of a Window. I know how
I would do that with the contentView but not the entire window. Any ideas on
that?

thanks
-dave
___

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

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

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

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


Re: iCal-style NSTextFields

2010-01-13 Thread Josh Abernathy
This sounds more like a CoreData or general controller problem than anything 
specific to iCal-style text fields. You might want to create a new thread for 
this.


On Jan 13, 2010, at 11:44 AM, Brad Gibbs wrote:

 I'm trying to implement this.
 
 I created a custom NSTextField subclass, called ICNTextField.  When an 
 ICNTextField instance receives a mouseDown event, it initializes a custom 
 NSWindow subclass with a borderless window mask.  In the window subclass, 
 I've overridden -canBecomeKeyWindow: so that it always returns yes.  
 
 When ICNTextField receives the controlTextDidEndEditing notification, it 
 takes the string value from the text field in the borderless window and 
 displays it properly, but the Core Data attribute to which the original text 
 field is bound does not update its value.
 
 I've looked into endEditing and endEditing:, nextKeyView and various forms of 
 commit, but can't seem to find a way to get the bindings to recognize the new 
 string value.  
 
 I'd like to do this in a generic fashion, so I can make any text field an 
 ICNTextField and know that its bound attributes will be updated without 
 having to write additional code for each text field.  Any help would be 
 appreciated. 
 
 
 On Jan 10, 2010, at 2:54 PM, Josh Abernathy wrote:
 
 If you're asking about the shadow, create a child window and move them to 
 that when they're editing.
 
 
 On Jan 10, 2010, at 11:56 AM, Seth Willits wrote:
 
 On Jan 10, 2010, at 11:49 AM, Ulai Beekam wrote:
 
 Go into iCal (in Snow Leopard) and create a new event and and then click 
 outside that event. Then double-click on that event and hit the Edit 
 button.
 
 In the window you see, you have some neat looking text fields that show 
 only text when not in focus but show you a white background with a shadow 
 effect when in edit mode.
 
 How can I make such text fields? Does anyone happen to have them 
 ready-made?
 
 They're just text fields. Change the background color, turn off the border, 
 and make them read-only when not in edit mode. 
 
 
 --
 Seth Willits
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/joshaber%40gmail.com
 
 This email sent to josha...@gmail.com
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/bradgibbs%40mac.com
 
 This email sent to bradgi...@mac.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/joshaber%40gmail.com
 
 This email sent to josha...@gmail.com

___

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

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

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

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


Re: NSScroller knob reposition

2010-01-13 Thread Fritz Anderson
On 13 Jan 2010, at 12:32 PM, David Blanton wrote:

 I set the knob position of the horz and vert scrollers as follows:
 
 - (void)centerScrollers {
   
   [m_hScroller setDoubleValue:0.5];
   [m_vScroller setDoubleValue:0.5];
   
 }
 
 Then when I move either knob with the mouse the other knob moves as well by 
 some random amount.

I think programmatically hauling the NSScrollers around just puts the UI out of 
sync with the actual position of the scroll view. 

If you want to make a certain part of a view visible inside an NSScrollView, 
send scrollRectToVisible: to that view. See also the cousin scroll... methods 
of NSView.

— F

___

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

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

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

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


Re: Snapshotting hidden UIViews

2010-01-13 Thread Michael Gardner
On Jan 13, 2010, at 11:24 AM, Matt Neuburg wrote:

 On Tue, 12 Jan 2010 14:18:05 -0600, Michael Gardner gardne...@gmail.com
 said:
 I'm trying to create a snapshot UIImage from a UITextView that's inside a
 larger, hidden UIView. renderInContext: works fine for visible UIView layers,
 but I can't get consistent results for hidden views.
 
 I read somewhere (can't recall the source, but it wasn't authoritative) that
 this is expected behavior, and that -renderInContext: is only guaranteed to 
 work
 for visible UIViews' layers. Is this true? If so, how else can I replicate
 *exactly* what my UITextView would look like when visible?
 
 In my JACTVocab app I have a similar problem: I need to make a snapshot of
 a situation in my window that doesn't exist yet. In other words, my window
 is in situation A, but I need a snapshot of situation B. I will eventually
 show the user situation B, but I need the snapshot first.
 
 So what I do is: I take a snapshot of situation A, and cover the window with
 a borderless window containing that snapshot. This hides what I am about to
 do in the real window. Now I change the situation in the window to situation
 B. The user cannot see this happening because snapshot of situation A is
 covering the window. Now I take the snapshot of situation B (this works
 perfectly well even though the second window is covering it).
 
 The hand is quicker than the eye, and the user never notices (I hope).
 
 Also, I use cacheDisplayInRect, not renderInContext. But it may be that
 there are reasons why you don't have that option...
 
 Hope this helps some - m.

Thanks for this useful tip, but I hope I don't have to resort to your method. 
It just feels... dirty, you know?

I'm not using -cacheDisplayInRect: because it doesn't exist in UIView, as far 
as I know.

I also tried calling -drawRect: on my hidden view (after setting the context 
with UIGraphicsBeginImageContext()), but it doesn't seem to do anything.

-Michael___

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

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

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

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


Re: NSArrayControllers not repopulating after NSPersistentDocument load

2010-01-13 Thread Quincey Morris
On Jan 13, 2010, at 13:28, Daniel Wambold wrote:

 I have an NSPersistentDocument app using CoreData for storage. I have three 
 NSArrayControllers to mediate between the three Entities in my Model and 
 three NSTableViews. Everything works fine until I load a previously saved 
 file. At that point, the controllers seem to have no content despite the fact 
 that the tables are properly populated. That is, the NSTableView shows data, 
 but po [self arrangedObjects] in GDB shows an empty array.
 At first I figured it was a timing issue, so I delayed the attempt to 
 manipulate an object (accessed by [[self arrangedObjects] objectAtIndex:0]) 
 with a message delayed by up to several seconds with no improvement. If I 
 force a fetch, I can retrieve the data, but for some reason the controller is 
 not taking care of this on its own. I have verified that the controller 
 automatically prepares content, and it's not fetching lazily, per IB. I'm 
 sure I've missed something obvious, but I'm stuck. I'm not sure if it's 
 relevant, but the value of [self managedObjectContext] is different if I 
 check it in the NSPersistentDocument object immediately after - 
 (BOOL)configurePersistentStoreCoordinatorForURL:(NSURL *)url ofType:(NSString 
 *)fileType modelConfiguration:(NSString *)configuration 
 storeOptions:(NSDictionary *)storeOptions error:(NSError **)error versus 
 later, when my controller tries to manipulate its content. Although I 
 modified the document's load method to investigate this (just a call to super 
 followed by a break point), the same behavior exists even without overriding 
 this method. If the answer is in the Apple Docs, I've missed it because I've 
 read them several times now. Incidentally, the Cannot access contents of an 
 object controller after a nib is loaded section of Core Data Programming 
 Guide looked promising, and fetchWithRequest:merge:error returns YES, but it 
 still doesn't cause the controller to repopulate. I've got perhaps 50 pieces 
 of string data stored in this document, so it's not a volume of data issue, I 
 don't think.

Your problem description is too wide to suggest an particular cause, but there 
are two *typical* causes of this sort of behavior:

1. You've created two objects where you only want one. For example, you've 
created an object in code, but also instantiated one in a nib file.

2. You've tried to follow connections during the nib loading processes, when 
some of them haven't been established yet.

Your problem sounds a bit like #1 -- if a NSTableView shows data, its 
NSArrayController has data, so if the debugger shows no data, the object you're 
looking at isn't the NSTableView's array controller. Also, the existence of two 
NSManagedObjectContext objects points in the same direction.

 The troublesome code, from my NSArrayController subclass, follows. The 
 object, myNote, is sent, after a brief delay, from the Nib file of another 
 object. I verified it contains a valid NSDate object.
 
 - (void) myChangeStartTime:(NSNotification *)myNote
 {
   [self setFilterPredicate:nil];
   [self rearrangeObjects];
   [[[self arrangedObjects] objectAtIndex:0] setValue:[[myNote object] 
 dateValue] forKey:kMyDateBindingKey];
 }

I happen to think that subclassing a NSController object is a terrible idea, if 
it can be avoided. [Apologies in advance to those who've successfully and/or 
necessarily subclassed NSController -- I've no doubt there are times when it's 
a good idea, but I'm not going to let the facts stand in the way of an opinion. 
;) ] NSController objects are glue objects, making any code you add to them 
turn into glue code, when it should likely be either data model code or user 
interface code.

One warning sign is the invocation of 'rearrangeObjects', which is in general a 
very big hammer. One of the purposes of bindings [my opinion, again] is to 
avoid the need to do anything to *all* objects whenever possible, since that 
may be expensive.

That last line of code is a bit worrying, too. Why is it a NSArrayController's 
responsibility to set up a data model's properties, and why isn't the 
notification being sent to the data model instead?


___

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

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

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

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


Re: NSDirectoryEnumerator and URLs (PS) [resolved]

2010-01-13 Thread Jamie Hardt
Yeah that works, I had an assertion failing in there somewhere…

Now I have to go pester the sqlite-users list.  Yick.

Jamie

On Jan 13, 2010, at 1:38 PM, Robert Martin wrote:

 Assuming that the original path is valid, this looks ok to me - maybe you 
 might try commenting out the lines:
 
  BOOL isDir = NO;
  if ( [fm fileExistsAtPath:fullPath isDirectory:isDir]  !isDir  ) {
 NSDictionary *metadataDict = [engine metadataDictionaryForFile:fullPath 
 ];
 [database indexMetadata:metadataDict forFileAtPath:fullPath];
  }
 
 and just have the app log the fullPath at that point - it should work.
 
 Perhaps also checking the folderPath that's passed in to make sure it's a 
 directory?

___

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

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

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

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


Re: Best practice example for a setup wizard?

2010-01-13 Thread Marcel Weiher
Hi Ian,

well, in a sense the lack of examples *is* illustrating the best practices 
concerning setup wizards :-)

Cheers,

Marcel


On Jan 13, 2010, at 9:54 , Ian Piper wrote:

 For one of my applications I want to do a check at startup to see whether a 
 profile and password has been set for the current user, and if not to take 
 them through a setup wizard. I'm sure I can mug my way through writing this 
 but it feels like the kind of thing for which there might be an example 
 illustrating best practice. Can anyone point me at some documentation or 
 examples that might help?

___

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

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

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

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


Re: Snapshotting hidden UIViews

2010-01-13 Thread glenn andreas

On Jan 13, 2010, at 4:48 PM, Michael Gardner wrote:

 
 I also tried calling -drawRect: on my hidden view (after setting the context 
 with UIGraphicsBeginImageContext()), but it doesn't seem to do anything.
 
Many built in views do not draw anything at all (and have no useful drawRect:) 
- all of their rendering is handled by the view's layer.



Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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

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

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

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


Re: Best practice example for a setup wizard?

2010-01-13 Thread Kyle Sluder
On Wed, Jan 13, 2010 at 9:54 AM, Ian Piper ianpi...@mac.com wrote:
 For one of my applications I want to do a check at startup to see whether a 
 profile and password has been set for the current user, and if not to take 
 them through a setup wizard. I'm sure I can mug my way through writing this 
 but it feels like the kind of thing for which there might be an example 
 illustrating best practice. Can anyone point me at some documentation or 
 examples that might help?

I can only think of a few Assistants (they are not called Wizards) in OS X:

1. Creating an iCal account. This one sticks out because it is so
unnecessary and buggy that it makes me want to shoot my monitor every
time it appears.
2. The Bluetooth mouse and keyboard detection ones.
3. The Certificate Signing Request generator in Keychain Access.app.
4. First-launch of Mail.app

Think long and hard before you decide you want to replicate these user
experiences. Particularly at the first launch.

--Kyle Sluder
___

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

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

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

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


Re: Displaying a non-contentual menu attachPopUpWithFrame

2010-01-13 Thread Kyle Sluder
On Wed, Jan 13, 2010 at 11:59 AM, Peter Ammon pam...@apple.com wrote:
 Hi Eric,

 On SnowLeopard and later, use the NSMenu method popUpMenuPositioningItem: 
 atLocation: inView:.

Don't forget to file a documentation bug about mentioning this new
method in the menu and popup list documentation.

--Kyle Sluder
___

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

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

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

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


Re: Best practice example for a setup wizard?

2010-01-13 Thread PCWiz
If you really want to do a wizard, this might be a good starting point:

http://www.cimgf.com/2008/03/03/core-animation-tutorial-wizard-dialog-with-transitions/

Independent Cocoa Developer, Macatomy Software
http://macatomy.com


On 2010-01-13, at 4:11 PM, Kyle Sluder wrote:

 On Wed, Jan 13, 2010 at 9:54 AM, Ian Piper ianpi...@mac.com wrote:
 For one of my applications I want to do a check at startup to see whether a 
 profile and password has been set for the current user, and if not to take 
 them through a setup wizard. I'm sure I can mug my way through writing this 
 but it feels like the kind of thing for which there might be an example 
 illustrating best practice. Can anyone point me at some documentation or 
 examples that might help?
 
 I can only think of a few Assistants (they are not called Wizards) in OS X:
 
 1. Creating an iCal account. This one sticks out because it is so
 unnecessary and buggy that it makes me want to shoot my monitor every
 time it appears.
 2. The Bluetooth mouse and keyboard detection ones.
 3. The Certificate Signing Request generator in Keychain Access.app.
 4. First-launch of Mail.app
 
 Think long and hard before you decide you want to replicate these user
 experiences. Particularly at the first launch.
 
 --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/pcwiz.support%40gmail.com
 
 This email sent to pcwiz.supp...@gmail.com

___

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

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

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

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


Re: Trying to create an alias file by using the new NSURL methods available with Mac OS X 10.6 !

2010-01-13 Thread Sean McBride
On 1/13/10 10:42 PM, rohan a said:

int CreateAlias(const char *target, const char *aliasname)
{
   CFStringRef Ref1 = CFStringCreateWithCString(NULL, target,
kCFStringEncodingASCII);

Don't use kCFStringEncodingASCII, filenames can have non-ASCII characters.

Save yourself the trouble of all these conversions, and just use the
NDAlias classes/categories.  See here:
http://github.com/nathanday/ndalias

It doesn't currently support bookmarks, but a patch would be welcome
(and pretty easy to add)!

Would it be possible to create an alias for a non-existent file ?

No.  But if its parent folder exists, you could create an alias to the
parent folder and store the filename.

Lastly, please don't post the same message to two lists.  Not everyone
is subscribed to both.

--

Sean McBride, B. Eng s...@rogue-research.com
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 arch...@mail-archive.com


set the label for the left hand expression / popup in an NSPredicateEditorRowTemplate?

2010-01-13 Thread Mike Chambers
I am looking for some input on how to set the label for the left hand
expression / popup in an NSPredicateEditorRowTemplate.

I need to programmatically create a NSPredicateEditorRowTemplate so I
can populate the right side expression / drop down with dynamically
generated values.

In my subclass, I populate the values like so:

---
-(id)initWithArray:(NSArray *)arr
{
NSString *keyPath = @professions;

NSMutableArray *expressions = [NSMutableArray arrayWithCapacity:[arr 
count]];
for(NSString *s in arr)
{
[expressions addObject:[NSExpression 
expressionForConstantValue:s]];
}   

if(!(self = [super initWithLeftExpressions:[NSArray
arrayWithObjects:[NSExpression expressionForKeyPath:keyPath], nil]
  
rightExpressions:expressions
  
modifier:NSDirectPredicateModifier
 
operators:[NSArray arrayWithObjects:

[NSNumber numberWithInt:NSContainsPredicateOperatorType],nil]
   
options:NSCaseInsensitivePredicateOption
 ]))
{
return nil;
}

//...
}
---

I then add this to the NSPredicateEditor, and it works as expect.
However, the left column in the editor for this row shows
professions (the key value). I want it to show Profession. If I
was using IB this would be very simple, as I could just rename it in
the popup.

How can I set the label for the left hand name in the editor?

Do I have to completely override all of the
NSPredicateEditorRowTemplate methods and manage all of the popups /
controls myself? I only need to change the label. Ive been trying to
figure this out off ad on for the past week, and havent come up with
any solutions other than override all APIs.

mike
___

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

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

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

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


Re: NSArrayControllers not repopulating after NSPersistentDocument load

2010-01-13 Thread Daniel Wambold
Quincey-

I have not created a controller in code, to my knowledge, so I don't know how 
I'd have two. (I had, previously, made this error by creating an instantiation 
of NSDocument in IB, but I realized the error in my ways and cleared that up, I 
believe, by resetting the File's Owner to the MyDocument subclass. which is not 
instantiated in IB). I can't see any evidence that I missed any part of fixing 
that.

What I have done is dragged an NSArrayController into the nib file, assigned it 
to the MyVSController subclass, then wired it to the NSTextView. I used code to 
create the table columns and bindings. The NSArrayController behaves properly 
(able to show an array of arrangedObjects, make decisions based on these, etc.) 
prior to saving the file. I *HAD* tried creating and assigning an 
NSManagedObjectContext object in IB, but realized that was probably a mistake 
so I removed it and any reference in code to such a thing.

The original code did not include the rearrangeObjects call. I put that in to 
be certain I wasn't missing something that would trigger a re-filtering, thus 
revealing contents that were otherwise filtered out.

The last line of code is simply a way to set an NSDatePicker in the UI to the 
last clock time the user had chosen. I didn't bind the NSDatePicker because I 
wanted to be able to do a number of parameter checks on it before allowing its 
value to slip into the data store. Nevertheless, I agree that the situation 
seems to suggest that the File  Open (load) method that is being invoked by 
the NSPersistentDocument is creating a new managed object context that is not 
being attached to the controller. Despite my efforts to force this issue (such 
as posting the new MOC in a notification object), it fails. I assume this is 
because I was using the NSPersistentDocument persistent store assignment 
method, which occurs before the Nib is reconstituted, meaning that the value is 
lost in the initialization.

I don't know if this is a clue, but I have never been able to get this program 
to respond to the request for [[NSApp delegate] managedObjectContext]. I DO 
have a delegate to the Application, but I have not yet done anything with it. 
Could this be part of the problem?

In any event, I appreciate any further insight you or anyone else might have.

Thanks again.

-Dan___

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

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

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

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


Re: set the label for the left hand expression / popup in an NSPredicateEditorRowTemplate?

2010-01-13 Thread Peter Ammon

On Jan 13, 2010, at 3:46 PM, Mike Chambers wrote:
 [...]
 I then add this to the NSPredicateEditor, and it works as expect.
 However, the left column in the editor for this row shows
 professions (the key value). I want it to show Profession. If I
 was using IB this would be very simple, as I could just rename it in
 the popup.
 
 How can I set the label for the left hand name in the editor?

You can simply change the title of the menu item in the NSPopUpButton.  You can 
access the first popup button with [[template templateViews] objectAtIndex:0].

-Peter

___

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

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

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

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


Re: Problem printing offscreen PDFViews

2010-01-13 Thread Kyle Sluder
Why are you using a different pattern for printing your PDF view than
you are using for your regular view?  Use NSPrintOpertaion and
-setShowPanels: as described in
http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/Printing/Tasks/UsingPrintPanel.html

--Kyle Sluder

On Wed, Jan 13, 2010 at 8:35 AM, Waldo Lee Sharvey
waldoleeshar...@gmail.com wrote:
 I have a situation where I want to print a multi-page PDF. While I
 could use the PDFKit utility classes and/or quartz functions to get
 the information to manually write drawing/pagination code for a NSView
 subclass, I had thought that quicker alternative would be to create an
 off-screen PDFView and tell it to print itself. When I tried this
 solution, the print dialog didn't go away, all of the print settings
 controls on the right half of the print dialog disappeared, and the
 application froze.

 I then wrote a tiny test application with the following method that
 illustrates the problem. When the test program is compiled without the
 USE_PDF_VIEW preprocessor macro defined, the blank view displays fine.
 If USE_PDF_VIEW is defined, the document doesn't print, most of the
 print dialog controls disappear, and the app freezes. While I have
 other ways of accomplishing my goal, I'm curious as to why this
 shortcut doesn't work. Is there something about Cocoa drawing I still
 don't understand? Am I banging into Apple Voodoo Magic(tm) behind the
 scenes that makes PDFView behave in a completely different way than
 other NSViews?

 - (void)printMyStuff:(id)sender {

 NSPrintInfo *currInfo = [NSPrintInfo sharedPrintInfo];

 #ifdef USE_PDF_VIEW


        PDFView *pdfView = [[PDFView alloc] init];
        PDFDocument *pdfDoc = [[PDFDocument alloc] initWithURL:[NSURL
 fileURLWithPath:@/Users/wls/Documents/my_document.pdf]];
        [pdfView setDocument: pdfDoc];
        [pdfView printWithInfo:currInfo autoRotate:YES];


 #else

        NSView *myView = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 500, 
 500)];
        NSPrintOperation *myop = [NSPrintOperation
 printOperationWithView:myView printInfo:currInfo];
        [myop runOperation];


 #endif

 }
 ___

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

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

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

 This email sent to kyle.slu...@gmail.com

___

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

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

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

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


Re: Managed Object with Getter

2010-01-13 Thread Richard Somers

On Jan 13, 2010, at 7:14 AM, Jim Correia wrote:

This style is typically used for non-object BOOL values. If you use  
it for an NSNumber attribute, you run the risk of someone familiar  
with the pattern assuming it is a BOOL property and writing


if ([managedObject isSelected]) {

}

which will of course be be true whenever the property is non-nil, no  
regardless of the actual value.


Thanks for the reply and the information. The attribute is a bool in  
the Xcode data modeler. When you copy the Obj-C 2.0 method  
declarations for the bool attribute to the clipboard this is what you  
get.


 @property (nonatomic, retain) NSNumber *selected;

So I assume that Core Data frameworks default is to use a NSNumber for  
a bool value.


--Richard



___

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

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

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

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


Re: Managed Object with Getter

2010-01-13 Thread Jim Correia
On Jan 13, 2010, at 7:29 PM, Richard Somers wrote:

 On Jan 13, 2010, at 7:14 AM, Jim Correia wrote:
 
 This style is typically used for non-object BOOL values. If you use it for 
 an NSNumber attribute, you run the risk of someone familiar with the pattern 
 assuming it is a BOOL property and writing
 
  if ([managedObject isSelected]) {
 
  }
 
 which will of course be be true whenever the property is non-nil, no 
 regardless of the actual value.
 
 Thanks for the reply and the information. The attribute is a bool in the 
 Xcode data modeler. When you copy the Obj-C 2.0 method declarations for the 
 bool attribute to the clipboard this is what you get.
 
 @property (nonatomic, retain) NSNumber *selected;
 
 So I assume that Core Data frameworks default is to use a NSNumber for a bool 
 value.

That is correct. Core Data always expresses its attribute as object values.

If you want to have a scalar BOOL property on your object, you can, but you 
must write your own accessors. (And be aware of and deal with 
-setNilValueForKey: as appropriate.)

For example:

- (BOOL)isSelected 
{
NSNumber *selected = nil;

[self willAccessValueForKey: @selected];
selected = [self primitiveSelected];
[self didAccessValueForKey: @selected];

return (selected != nil) ? [selected boolValue] : NO;
}

- (void)setSelected:(BOOL)selected 
{
[self willChangeValueForKey: @selected];
[self setPrimitiveSelected: [NSNumber numberWithBool: selected]];
[self didChangeValueForKey: @selected];
}

- Jim



___

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

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

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

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


Analyzer in error?

2010-01-13 Thread Graham Cox
Hi all, I have the following code in a category on NSData:


@implementation NSData (SHA1Hash)

- (NSData*) sha1Hash
{
// calculates the 160 bit SHA-1 digest of the given data

unsigned char* digest = (unsigned char*) malloc(20);
SHA1([self bytes], [self length], digest);

return [[self class] dataWithBytesNoCopy:digest length:20];
}


@end


The static analyzer reports this:

Potential leak of an object allocated on line 622

Method returns an Objective-C object with a +1 retain count 
(owning reference)
Object returned to caller as an owning reference (single retain 
count transferred to caller)
Object allocated on line 622 is returned from a method whose 
name ('sha1Hash') does not contain 'copy' or otherwise starts with 'new' or 
'alloc'.  This violatesthe naming convention rules given in the 
Memory Management Guide for Cocoa (object leaked)

But I think this is wrong - [NSData dataWithBytesNoCopy] returns an object I 
don't own, and it in turn takes ownership of digest. So where's the leak? Is 
clang simply mistaking the fact that +dataWithBytesNoCopy CONTAINS 'copy' and 
not STARTS WITH copy?

--Graham


___

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

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

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

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


Re: Analyzer in error?

2010-01-13 Thread Roland King
Possibly - do you want to try the XCode list for that one, I've been 
asking CLANG questions over there.


Graham Cox wrote:

Hi all, I have the following code in a category on NSData:


@implementation NSData (SHA1Hash)

- (NSData*) sha1Hash
{
// calculates the 160 bit SHA-1 digest of the given data

unsigned char* digest = (unsigned char*) malloc(20);
SHA1([self bytes], [self length], digest);

return [[self class] dataWithBytesNoCopy:digest length:20];
}


@end


The static analyzer reports this:

Potential leak of an object allocated on line 622

Method returns an Objective-C object with a +1 retain count 
(owning reference)
Object returned to caller as an owning reference (single retain 
count transferred to caller)
Object allocated on line 622 is returned from a method whose 
name ('sha1Hash') does not contain 'copy' or otherwise starts with 'new' or 
'alloc'.  This violatesthe naming convention rules given in the 
Memory Management Guide for Cocoa (object leaked)

But I think this is wrong - [NSData dataWithBytesNoCopy] returns an object I don't 
own, and it in turn takes ownership of digest. So where's the leak? Is clang 
simply mistaking the fact that +dataWithBytesNoCopy CONTAINS 'copy' and not STARTS 
WITH copy?

--Graham


___

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

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

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

This email sent to r...@rols.org

___

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

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

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

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


Re: Analyzer in error?

2010-01-13 Thread Greg Parker
On Jan 13, 2010, at 5:54 PM, Graham Cox wrote:
 @implementation NSData (SHA1Hash)
 
 - (NSData*)   sha1Hash
 {
   // calculates the 160 bit SHA-1 digest of the given data
   
   unsigned char* digest = (unsigned char*) malloc(20);
   SHA1([self bytes], [self length], digest);
   
   return [[self class] dataWithBytesNoCopy:digest length:20];
 }
 
 @end
 
 The static analyzer reports this:
 
   Potential leak of an object allocated on line 622
 
   Method returns an Objective-C object with a +1 retain count 
 (owning reference)
   Object returned to caller as an owning reference (single retain 
 count transferred to caller)
   Object allocated on line 622 is returned from a method whose 
 name ('sha1Hash') does not contain 'copy' or otherwise starts with 'new' or 
 'alloc'.  This violatesthe naming convention rules given in 
 the Memory Management Guide for Cocoa (object leaked)
 
 But I think this is wrong - [NSData dataWithBytesNoCopy] returns an object I 
 don't own, and it in turn takes ownership of digest. So where's the leak? 
 Is clang simply mistaking the fact that +dataWithBytesNoCopy CONTAINS 'copy' 
 and not STARTS WITH copy?

Yes, the static analyzer is wrong here. 

The Official Rule is '... contains copy ...'. This is a case where a 
mechanical interpretation of the Official Rule isn't quite right. 

The static analyzer does have a special case for +[NSData 
dataWithBytesNoCopy:length:]. 
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090511/017258.html

But your code sends the message to [self class] instead of NSData, so perhaps 
the special case is not recognized. Alternatively, perhaps your Xcode isn't the 
newest available.

Try this to suppress the complaint:
return [(NSData *)[self class] dataWithBytesNoCopy:digest length:20];


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

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


How to enable/disable a UITextField or UITextView programmatically?

2010-01-13 Thread William Squires
I have a UITableView that's part of a Navigation-based Application.  
There's one .xib, a DrinkDetailViewController class (.m  .h files)  
and an AddDrinkViewController class which inherits from  
DrinkDetailViewController. Both share the same view, which contains a  
UITextField, two UITextViews, and some UILabels. The  
DrinkDetailViewController.h declares three IBOutlets as follows:


#import UIKit/UIKit.h

@interface DrinkDetailViewController : UIViewController
{
IBOutlet UITextField *nameField;
IBOutlet UITextView *ingredientsView;
IBOutlet UITextView *directionsView;
...
}

@end

so that I can access the UITextField, and the two UITextViews. IB  
shows in the inspector window, that the UITextField, and UITextViews  
have a BOOL enabled property (controlled by a checkbox labeled  
Enabled). But the following doesn't work:


...
nameField.enabled = YES;
ingredientsView.enabled = YES;
directionsView.enabled = YES;
...

in the viewDidLoad: method of AddDrinkViewController. I unchecked the  
enabled box for these controls as the normal use of the view is just  
to display drink information, not for data entry. The  
AddDrinkViewController re-uses the view for data entry, and I want to  
re-enable the fields, but only when the view (xib) is used/loaded by  
the AddDrinkViewController. I looked in the docs for UITextField, but  
didn't even see a reference to an enabled property. Is this another  
of those view-within-a-view problems?


___

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

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

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

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


Re: How to enable/disable a UITextField or UITextView programmatically?

2010-01-13 Thread Henry McGilton (Boulevardier)

On Jan 13, 2010, at 6:22 PM, William Squires wrote:

 I have a UITableView that's part of a Navigation-based Application. There's 
 one .xib, a DrinkDetailViewController class (.m  .h files) and an 
 AddDrinkViewController class which inherits from DrinkDetailViewController. 
 Both share the same view, which contains a UITextField, two UITextViews, and 
 some UILabels. The DrinkDetailViewController.h declares three IBOutlets as 
 follows:
 
 #import UIKit/UIKit.h
 
 @interface DrinkDetailViewController : UIViewController
 {
 IBOutlet UITextField *nameField;
 IBOutlet UITextView *ingredientsView;
 IBOutlet UITextView *directionsView;
 ...
 }
 
 @end
 
 so that I can access the UITextField, and the two UITextViews. IB shows in 
 the inspector window, that the UITextField, and UITextViews have a BOOL 
 enabled property (controlled by a checkbox labeled Enabled). But the 
 following doesn't work:
 
 ...
 nameField.enabled = YES;
 ingredientsView.enabled = YES;
 directionsView.enabled = YES;
 ...
 
 in the viewDidLoad: method of AddDrinkViewController. I unchecked the enabled 
 box for these controls as the normal use of the view is just to display drink 
 information, not for data entry. The AddDrinkViewController re-uses the view 
 for data entry, and I want to re-enable the fields, but only when the view 
 (xib) is used/loaded by the AddDrinkViewController. I looked in the docs for 
 UITextField, but didn't even see a reference to an enabled property. Is this 
 another of those view-within-a-view problems?

Theenabledproperty is defined in UIControl --- the super-class of 
UITextField . . .

This is a good time for a plug for Xcode's incredibly useful but oft skipped 
over Class Browser,
the second item in Xcode's  Project  menu . . .

Cheers,
. . . . . . . .Henry



=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.com

___

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

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

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

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


Re: Snapshotting hidden UIViews

2010-01-13 Thread Michael Gardner
On Jan 13, 2010, at 5:07 PM, glenn andreas wrote:

 
 On Jan 13, 2010, at 4:48 PM, Michael Gardner wrote:
 
 
 I also tried calling -drawRect: on my hidden view (after setting the context 
 with UIGraphicsBeginImageContext()), but it doesn't seem to do anything.
 
 Many built in views do not draw anything at all (and have no useful 
 drawRect:) - all of their rendering is handled by the view's layer.

Ah, that explains that. But I'd still very much like to know why the layer's 
-renderInContext: doesn't work consistently when the view is hidden.

-Michael___

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

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

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

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


Re: Trying to create an alias file by using the new NSURL methods available with Mac OS X 10.6 !

2010-01-13 Thread rohan a
Hi,

Thanks for the response.

I used kCFStringEncodingASCII, since I am passing a char* strings for the
filename and alias name through my program.

Thanks

On Thu, Jan 14, 2010 at 4:49 AM, Sean McBride s...@rogue-research.comwrote:

 On 1/13/10 10:42 PM, rohan a said:

 int CreateAlias(const char *target, const char *aliasname)
 {
CFStringRef Ref1 = CFStringCreateWithCString(NULL, target,
 kCFStringEncodingASCII);

 Don't use kCFStringEncodingASCII, filenames can have non-ASCII characters.

 Save yourself the trouble of all these conversions, and just use the
 NDAlias classes/categories.  See here:
 http://github.com/nathanday/ndalias

 It doesn't currently support bookmarks, but a patch would be welcome
 (and pretty easy to add)!

 Would it be possible to create an alias for a non-existent file ?

 No.  But if its parent folder exists, you could create an alias to the
 parent folder and store the filename.

 Lastly, please don't post the same message to two lists.  Not everyone
 is subscribed to both.

 --
 
 Sean McBride, B. Eng s...@rogue-research.com
 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 arch...@mail-archive.com


Framework soft link (optional install)

2010-01-13 Thread Trygve Inda
I have an app that I'd like to use a Cocoa Framework in (and it'd normally
end up in my app package in the Frameworks folder).

For licensing reasons, I can't embed it directly, and my all will work
without it (though some features will be disabled).

I'd like to allow users to download this framework elsewhere, then drag it
to my app's dock icon... It will copy it to where it needs to be in the app
package, then quit and the user can relaunch.

How can I compile/link my code so that the framework effectively has a soft
link? I will need to check for the presence of the framework at runtime, and
if it is not there, avoid calling into it, but if the user has added it, the
functionality would be available.

Can I just build it, then toss out the framework in the release version and
make sure to check before calling code the uses it?

Examples?

Thanks,

Trygve




___

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

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

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

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


Re: Trying to create an alias file by using the new NSURL methods available with Mac OS X 10.6 !

2010-01-13 Thread Kyle Sluder
On Wed, Jan 13, 2010 at 8:16 PM, rohan a info1...@gmail.com wrote:
 I used kCFStringEncodingASCII, since I am passing a char* strings for the
 filename and alias name through my program.

char* does not mean array of ASCII characters.

--Kyle Sluder
___

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

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

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

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


Re: Framework soft link (optional install)

2010-01-13 Thread Trygve Inda
 I have an app that I'd like to use a Cocoa Framework in (and it'd normally
 end up in my app package in the Frameworks folder).
 
 For licensing reasons, I can't embed it directly, and my all will work
 without it (though some features will be disabled).
 
 I'd like to allow users to download this framework elsewhere, then drag it
 to my app's dock icon... It will copy it to where it needs to be in the app
 package, then quit and the user can relaunch.
 
 How can I compile/link my code so that the framework effectively has a soft
 link? I will need to check for the presence of the framework at runtime, and
 if it is not there, avoid calling into it, but if the user has added it, the
 functionality would be available.


Err make that weak link... Not thinking in English right now!


___

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

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

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

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


Re: Framework soft link (optional install)

2010-01-13 Thread Kyle Sluder
2010/1/13 Trygve Inda cocoa...@xericdesign.com:
 How can I compile/link my code so that the framework effectively has a soft
 link? I will need to check for the presence of the framework at runtime, and
 if it is not there, avoid calling into it, but if the user has added it, the
 functionality would be available.

Weak link the framework, according to the details here:
http://developer.apple.com/mac/library/DOCUMENTATION/MacOSX/Conceptual/BPFrameworks/Concepts/WeakLinking.html

Note that there is no direct ObjC analogue for the NULLing function
symbol behavior (at least not yet; see
http://sealiesoftware.com/blog/archive/2009/09/09/objc_explain_Weak-import_classes.html
for a glimpse into the future). At the moment, you can use
NSClassNamed to get at the classes you need, then shove them off into
a variable and check for non-Nilness.

--Kyle Sluder
___

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

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

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

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


Re: Trying to create an alias file by using the new NSURL methods available with Mac OS X 10.6 !

2010-01-13 Thread rohan a
Should I then use kCFStringEncodingUTF8 in this case ?

On Thu, Jan 14, 2010 at 9:52 AM, Kyle Sluder kyle.slu...@gmail.com wrote:

 On Wed, Jan 13, 2010 at 8:16 PM, rohan a info1...@gmail.com wrote:
  I used kCFStringEncodingASCII, since I am passing a char* strings for the
  filename and alias name through my program.

 char* does not mean array of ASCII characters.

 --Kyle Sluder

___

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

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

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

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


Re: Snapshotting hidden UIViews

2010-01-13 Thread glenn andreas
On Jan 13, 2010, at 9:46 PM, Michael Gardner gardne...@gmail.com  
wrote:



On Jan 13, 2010, at 5:07 PM, glenn andreas wrote:



On Jan 13, 2010, at 4:48 PM, Michael Gardner wrote:



I also tried calling -drawRect: on my hidden view (after setting  
the context with UIGraphicsBeginImageContext()), but it doesn't  
seem to do anything.


Many built in views do not draw anything at all (and have no useful  
drawRect:) - all of their rendering is handled by the view's layer.


Ah, that explains that. But I'd still very much like to know why the  
layer's -renderInContext: doesn't work consistently when the view is  
hidden.




Pure speculation, but a hidden view may not have a layer associated  
with it, and things like subview layout aren't done for hidden views  
(why waste cycle laying out the subviews if nobody will see it?).  
There are probably other undocumented optimizations as well on hidden  
views, such as animations not running, pending refreshes postponed,  
etc...  UIWebView is going to be especially problematic, since it does  
a whole lot of things in the background (such as loading needed images  
and other resources)


___

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

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

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

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