Array Controller "Select Inserted Objects" just stopped working

2009-12-05 Thread Jerry Krinock
I tested a new build of an app today and found that, all of a sudden, clicking 
the "+" button for a table view adds a new object but no longer selects it.  
It's a conventional design with the "+" button targetting the -add: method of 
an array controller instantiated in the nib, and the table bound to the array 
controller.  I inspected the array controller's Attributes, but "Select 
Inserted Objects" definitely has a big fat checkmark in the box.

Our buddy 'PCWiz' reported the same issue -- "now I have another problem (once 
again, out of the blue)" -- a few months ago, but the thread got slapped 
because Snow Leopard was under NDA at the time:

http://lists.apple.com/archives/Cocoa-dev/2009/Aug/msg00962.html

Well, I had an NSArrayController subclass handy, so I tried overriding 
-selectsInsertedObjects to return YES but that did not help.  I fixed it with 
this kludge:

- (void)add:(id)sender {
[super add:sender] ;
// Does not work without delay.
[self performSelector:@selector(selectLastObject)
   withObject:nil
   afterDelay:0.0] ;
}

- (void)selectLastObject {
if ([self selectsInsertedObjects]) {
NSArray* arrangedObjects = [self arrangedObjects] ;
NSInteger nObjects = [arrangedObjects count] ;
if (nObjects > 0) {
[self setSelectionIndex:nObjects-1] ;
}
}
}

Has anyone else had trouble recently with NSArrayController's "Select Inserted 
Objects"?

Sincerely,

Jerry Krinock


___

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

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

2009-12-05 Thread Scott Anguish
not sure if this is helpful, but on http://www.abandoninplace.com/ in 
SampleCode, there is an example of using a dial created with Core Animation.

On Dec 3, 2009, at 3:34 PM, Eric E. Dolecki wrote:

> Will do. One question - when I am rotating around z - it's using the top
> left of the shapeLayer as the anchor point. Trying to set it differently
> isn't changing the anchor point...
> 
> CABasicAnimation *rotationAnimation;
> 
> rotationAnimation =[CABasicAnimation animationWithKeyPath:@
> "transform.rotation.z"];
> 
> [rotationAnimation setFromValue:DegreesToNumber(0)];
> 
> [rotationAnimation setToValue:DegreesToNumber(360)];
> 
> [rotationAnimation setDuration:2.0f];
> 
> [rotationAnimation setRepeatCount:1];
> 
> [shapeLayer setAnchorPoint:CGPointMake(240, 160)];
> 
> [shapeLayer addAnimation:rotationAnimation forKey:@"rotate"];
> 
> It just rotates around the top left corner (meaning it comes into and out of
> view)... I am looking to simply spin the shape where it sits from it's
> center.
> 
> 
> 
> On Thu, Dec 3, 2009 at 3:17 PM, Kyle Sluder  wrote:
> 
>> On Thu, Dec 3, 2009 at 12:07 PM, Eric E. Dolecki 
>> wrote:
>>> If I use CAShapeLayer, can I use CGAffineTransform on it? I need to pour
>>> through the docs now I guess.
>> 
>> Yes, please brush up on Core Animation.  You can apply arbitrary
>> transformations to a layer, or you can use the rotation/position
>> properties of the layer itself and let CA take care of all the nested
>> coordinate systems for you.  Since the iPhone uses layers for pretty
>> much all drawing, you're going to need to get a handle on Core
>> Animation sooner rather than later.
>> 
>> --Kyle Sluder
>> 
> 
> 
> 
> -- 
> 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/scott%40cocoadoc.com
> 
> This email sent to sc...@cocoadoc.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: passing nothing to method with CGPoint argument

2009-12-05 Thread Frederik Slijkerman
The usual solution is to change the method signature to accept a 
CGPoint* argument instead, so you can also pass NULL / nil separately 
from any point.


Best regards,
Frederik Slijkerman


Chunk 1978 wrote:

i have an method that takes a CGPoint as an argument.  i would like to
call the method without supplying a CGPoint, but i can't pass nil or
null.  i can pass CGPointZero, but that is still a point: {0, 0}
___

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

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

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

This email sent to frede...@ultrafractal.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: passing nothing to method with CGPoint argument

2009-12-05 Thread Chunk 1978
the method that takes the CGPoint argument is called from touchesBegan
and touchesMoved.  the CGPoint method outputs touch coordinates and
the touches only register if the touch is within the frame of the
image.  for factoring purposes i want to be able to call the same
method from touchesEnded that will clear the output strings if there
is no point, but CGPointZero is a point.

On Sat, Dec 5, 2009 at 9:03 PM, Graham Cox  wrote:
>
> On 06/12/2009, at 12:59 PM, Chunk 1978 wrote:
>
>> i have an method that takes a CGPoint as an argument.  i would like to
>> call the method without supplying a CGPoint, but i can't pass nil or
>> null.  i can pass CGPointZero, but that is still a point: {0, 0}
>
>
> Why would you want to do this? It just doesn't make any sense, and indicates 
> a basic design problem. What are you really trying to do?
>
> --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: passing nothing to method with CGPoint argument

2009-12-05 Thread Dave DeLong
Anything you pass can be interpreted as a point.  You could pass an NSString, 
but those are still pointers, and you can interpret a pointer as a regular 
number.  You could pass a character, but characters are also numbers.  In fact, 
everything in C can be interpreted as a number (this is often viewed as one of 
the limitations of C-based and similar languages).  The only real way around 
this is to pass a special point that you test for.

An example of this is when you ask NSString for a range of a substring.  It 
returns an NSRange, and the location is always a valid number.  However, we 
look for a special value, NSNotFound (which is just a really really big number) 
to indicate that the string wasn't present.

So you could pass a point that's basically {INFINITY, INFINITY} (or something 
like that).

But the real question here is "what are you trying to do?".

Cheers,

Dave

On Dec 5, 2009, at 6:59 PM, Chunk 1978 wrote:

> i have an method that takes a CGPoint as an argument.  i would like to
> call the method without supplying a CGPoint, but i can't pass nil or
> null.  i can pass CGPointZero, but that is still a point: {0, 0}


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: passing nothing to method with CGPoint argument

2009-12-05 Thread Graham Cox

On 06/12/2009, at 12:59 PM, Chunk 1978 wrote:

> i have an method that takes a CGPoint as an argument.  i would like to
> call the method without supplying a CGPoint, but i can't pass nil or
> null.  i can pass CGPointZero, but that is still a point: {0, 0}


Why would you want to do this? It just doesn't make any sense, and indicates a 
basic design problem. What are you really trying to do?

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


passing nothing to method with CGPoint argument

2009-12-05 Thread Chunk 1978
i have an method that takes a CGPoint as an argument.  i would like to
call the method without supplying a CGPoint, but i can't pass nil or
null.  i can pass CGPointZero, but that is still a point: {0, 0}
___

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

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

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

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


NSPopUpButton questions

2009-12-05 Thread timm...@gmail.com
The Apple docs for NSPopUpButtons says to avoid accessing it's NSMenu directly 
because it may need to do housekeeping. I had to access it's NSMenu directly 
though so that I could make a separator menu item. Is this fine for this 
situation, or is there a better way to do this to conform to Apple's 
recommendation?

Also, is there a way to set a menu item to act like it's disabled, but without 
graying out its title and image? I'm trying to insert a "Bonjour section" and 
want the Bonjour menu item and image to be unselectable, but not grayed out.

Thanks!
Karl___

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

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

2009-12-05 Thread PCWiz
You were right on with number 1, the exception was in a line of code where I 
tried to use NSMutableArray +arrayWithArray on an NSData object rather than an 
NSArray. Fixed this blunder and everything works as it should.

I'm guessing what happened here is that some part of the +arrayWithArray method 
tried to call +count on the object given, which in this case was an NSData.

On 2009-12-05, at 5:38 PM, Mike Abdullah wrote:

> Reasons this could be happening:
> 
> 1) The exception is actually in a completely different place
> 2) _arrayController does not point to what you think it does. Could perhaps 
> be a freed object since replaced with something else that returns a data 
> object for -arrangedObjects
> 3) The array controller is a custom subclass that is somehow returning a data 
> object from its -arrangedObjects method.
> 
> I'm thinking 1) is most likely. By calling it an "error" suggests you don't 
> fully understand what is going on. This is an exception. Have you used the 
> debugger to step through the code and test? Sounds not to me.
> 
> On 6 Dec 2009, at 00:23, PCWiz wrote:
> 
>> I'm having an *extremely* strange problem here. I'm using this simple if 
>> statement to find out if an array controller is not empty:
>> 
>> if ([[_arrayController arrangedObjects] count] > 0)
>> 
>> And this is what it results in:
>> 
>> -[NSCFData count]: unrecognized selector sent to instance 0x134d010
>> 
>> If I take out that if statement and let the code run without a check to see 
>> if the array controller is empty, that error does not appear so I'm fairly 
>> certain that this is what's causing the issue. I've also gone through the 
>> rest of my code checking for any typos which might try to use the count 
>> method on an NSData object, but I found nothing.
>> 
>> Really confused here because I've used that same if statement many times 
>> before, so I don't see why its messing up 
>> 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/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.net
> 

___

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

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

2009-12-05 Thread Mike Abdullah
Reasons this could be happening:

1) The exception is actually in a completely different place
2) _arrayController does not point to what you think it does. Could perhaps be 
a freed object since replaced with something else that returns a data object 
for -arrangedObjects
3) The array controller is a custom subclass that is somehow returning a data 
object from its -arrangedObjects method.

I'm thinking 1) is most likely. By calling it an "error" suggests you don't 
fully understand what is going on. This is an exception. Have you used the 
debugger to step through the code and test? Sounds not to me.

On 6 Dec 2009, at 00:23, PCWiz wrote:

> I'm having an *extremely* strange problem here. I'm using this simple if 
> statement to find out if an array controller is not empty:
> 
> if ([[_arrayController arrangedObjects] count] > 0)
> 
> And this is what it results in:
> 
> -[NSCFData count]: unrecognized selector sent to instance 0x134d010
> 
> If I take out that if statement and let the code run without a check to see 
> if the array controller is empty, that error does not appear so I'm fairly 
> certain that this is what's causing the issue. I've also gone through the 
> rest of my code checking for any typos which might try to use the count 
> method on an NSData object, but I found nothing.
> 
> Really confused here because I've used that same if statement many times 
> before, so I don't see why its messing up 
> 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/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

2009-12-05 Thread Seth Willits
On Dec 5, 2009, at 4:23 PM, PCWiz wrote:

> I'm having an *extremely* strange problem here. I'm using this simple if 
> statement to find out if an array controller is not empty:
> 
> if ([[_arrayController arrangedObjects] count] > 0)
> 
> And this is what it results in:
> 
> -[NSCFData count]: unrecognized selector sent to instance 0x134d010


Is the array controller bound to an NSData object?


--
Seth Willits



___

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

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

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

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


Re: An array of

2009-12-05 Thread Seth Willits
On Dec 5, 2009, at 4:10 PM, R T wrote:

> I am trying to create an array of CGImageRefs that I will use to create 
> CGLayers.
> myCGImageRefImage is the CGImageRef of the key image. 
> Each loop, I'm trying to reload imgForLayer with this key image. 
> The line...imgForLayer = CGImageCreateCopy(myCGImageRefImage) ...doesn't work 
> at all.

That line is unrelated to all of the other code you pasted...

If that line is your question, then the only answer I see is that 
myCGImageRefImage is probably nil.


--
Seth Willits



___

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

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

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

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


-[NSCFData count]: unrecognized selector

2009-12-05 Thread PCWiz
I'm having an *extremely* strange problem here. I'm using this simple if 
statement to find out if an array controller is not empty:

if ([[_arrayController arrangedObjects] count] > 0)

And this is what it results in:

-[NSCFData count]: unrecognized selector sent to instance 0x134d010

If I take out that if statement and let the code run without a check to see if 
the array controller is empty, that error does not appear so I'm fairly certain 
that this is what's causing the issue. I've also gone through the rest of my 
code checking for any typos which might try to use the count method on an 
NSData object, but I found nothing.

Really confused here because I've used that same if statement many times 
before, so I don't see why its messing up 
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


An array of

2009-12-05 Thread R T
I am trying to create an array of CGImageRefs that I will use to create 
CGLayers.
 myCGImageRefImage is the CGImageRef of the key image. 
Each loop, I'm trying to reload imgForLayer with this key image. 
The line...imgForLayer = CGImageCreateCopy(myCGImageRefImage) ...doesn't work 
at all.

Given:
CGImageRef myCGImageRefImage;
NSMutableArray *thresholdsArray;// an array of NSNumbers
0,51,102,153,204,255
NSMutableArray * CGImageRefArray;

This is the faulty block of code...

- (void) processThresholds{
[CGImageRefArrayremoveAllObjects];
CGImageRefimgForLayer = NULL;// Start with no image
int cnt = [thresholdsArraycount], q = 0;float lo, hi;
do
  {
  lo = [[thresholdsArrayobjectAtIndex:q]floatValue];
  hi = [[thresholdsArrayobjectAtIndex:q+1]floatValue];
  imgForLayer = CGImageCreateCopy(myCGImageRefImage);
  imgForLayer = ApplySingleZoneComposition([@"SingleZone" UTF8String], 
imgForLayer, lo, hi);
  
  [CGImageRefArray addObject:[[NSValue alloc] initWithBytes:imgForLayer 
objCType:@encode(CGImageRef)]];
  imgForLayer = NULL;
  q++;
  }while(qhttp://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


/System/.../pbs -dump_pboard gives no output

2009-12-05 Thread John Velman
When I invoke /System/Library/CoreServices/pbs -dump_pboard from a
terminal, about 5 seconds elapses before I get the prompt back, but no list
of registered Services is returned.  But in any application (e.g, Finder),
there are thirty some services listed on the service menu.

This may not be the right place to ask, but I couldn't think of another
place.   I've tried every keyword combo I can think of in google, but can't
find anyone else with this problem.

I'm still on OS X 10.5.8, 2.4MHz intel Core 2 Duo.

(I'm trying to add a service to my application, and in fact can't even get
it listed in the services menu, but I'll try to debug this a bit more on my
own before asking the list.)

Thanks,

John Velman



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Is it possible to pass an object to a NIB

2009-12-05 Thread Chris Hanson
On Dec 5, 2009, at 3:46 PM, DeNigris Sean wrote:

>> Furthermore, from your further description it sounds like what you’re 
>> referring to as a “view” is actually a subclass of NSWindowController; it 
>> knows how to load a nib file already, so you should just leverage that 
>> rather than try to do it all yourself by hand.
> 
> Thanks again.  It's an "ultra-thin gui" a-la Dave Astels' TDD: A Practical 
> Guide (originally Mike Feathers' Humble dialog).  There is another controller 
> class that handles all the logic.  This class just delegates the actions and 
> outlets from Cocoa, so from my app's perspective, it's a view, but from 
> cocoa's perspective, it's a controller.

Many such techniques were created for frameworks that don’t have the separation 
of concerns that Cocoa does.  In Cocoa, you generally don’t need to follow 
patterns like Feathers’ “Humble Dialog Box” because you aren’t constrained to 
testing by pushing events through the run loop.

Rather than try to follow patterns not designed for Cocoa, I would strongly 
encourage you to follow Cocoa’s own patterns when writing Cocoa code, whether 
you’re doing so in Objective-C or some other language like Ruby.

> It think it should be just an NSObject (that's what I've seen in all the 
> books and there's only one window in my app).  I made it an 
> NSWindowController in the process of trying to get it to load the nib (which 
> is only for testing) and forgot to set it back.  Is there a reason to keep it 
> an NSWindowController?

NSWindowController already knows how to load nibs and act as File’s Owner.  It 
and NSViewController also have some subtle support for features like breaking 
the circular retain that results when you bind through File’s Owner.  In 
general, I would *not* use subclasses of anything *but* NSWindowController and 
NSViewController as the File’s Owner for a nib without a very good reason.

> I ended up with the following that loaded the nib successfully in the test:
> NSApplication.sharedApplication
> top_level = []
> context = NSDictionary::dictionaryWithObjects_forKeys [NSApp, top_level], 
> [NSNibOwner, NSNibTopLevelObjects]
> 
> @@NibPath = "/path/to/MainMenu.nib"
> OSX::NSBundle::loadNibFile_externalNameTable_withZone @@NibPath, context, 
> NSApp.zone
> 
> objects = context['NSTopLevelObjects']
> view = objects.find { |obj| obj.class == object_type }

I think you’re doing too much work here.  You should use an IBOutlet in File’s 
Owner to refer to your view, rather than look through the array of top-level 
objects trying to find it.  The latter is simply not how things are typically 
done in Cocoa.

  — Chris

___

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

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

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

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


Re: Is it possible to pass an object to a NIB

2009-12-05 Thread DeNigris Sean
> Really, the external name table is for referring to objects in nibs, rather 
> than pushing objects into nibs.
Thanks.  That's what I wanted to know - I thought the docs suggested maybe you 
could pass objects in (other than owner)

> Furthermore, from your further description it sounds like what you’re 
> referring to as a “view” is actually a subclass of NSWindowController; it 
> knows how to load a nib file already, so you should just leverage that rather 
> than try to do it all yourself by hand.
Thanks again.  It's an "ultra-thin gui" a-la Dave Astels' TDD: A Practical 
Guide (originally Mike Feathers' Humble dialog).  There is another controller 
class that handles all the logic.  This class just delegates the actions and 
outlets from Cocoa, so from my app's perspective, it's a view, but from cocoa's 
perspective, it's a controller.  It think it should be just an NSObject (that's 
what I've seen in all the books and there's only one window in my app).  I made 
it an NSWindowController in the process of trying to get it to load the nib 
(which is only for testing) and forgot to set it back.  Is there a reason to 
keep it an NSWindowController?

I ended up with the following that loaded the nib successfully in the test:
NSApplication.sharedApplication
top_level = []
context = NSDictionary::dictionaryWithObjects_forKeys [NSApp, top_level], 
[NSNibOwner, NSNibTopLevelObjects]

@@NibPath = "/path/to/MainMenu.nib"
OSX::NSBundle::loadNibFile_externalNameTable_withZone @@NibPath, context, 
NSApp.zone

objects = context['NSTopLevelObjects']
view = objects.find { |obj| obj.class == object_type }

Sean DeNigris
s...@clipperadams.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: NSOutlineView expand-by-default with NSTreeController

2009-12-05 Thread Jason Foreman

On Dec 5, 2009, at 12:43 PM, Benjamin Rister wrote:

> I have an NSOutlineView in which I would like to have newly-appearing items 
> be expanded by default. (It would be nice if NSOutlineView had support for 
> this built in; rdar://problem/7421928.)
> 
> The list archives and a web search reveal a couple hacks to try and make this 
> work, but they depend on feeding the data to the outline view via the 
> NSOutlineViewDataSource protocol so that they can ask for an expansion either 
> at the time of insertion or in response to the outline view asking about the 
> new pieces of data. I’m using NSTreeController, which makes the situation 
> difficult as the actual “items” the outline view knows about aren’t anything 
> I create myself, so I can’t really queue up an expansion of items as I insert 
> them in the model, nor will the outline view ask me about the new data as 
> it’s getting it from NSTreeController.


You can get a collection of NSTreeNode instances from your tree controller like 
this:

[[treeController arrangedObjects] childNodes];

Iterate over this collection and find nodes where [node representedObject] is 
equal to your newly inserted objects.  Then you can pass this NSTreeNode 
instance to -[NSOutlineView exandItem:].

This isn't terribly clean, and it might fall down if you have a large number of 
items in your tree controller, but it works for what I need and might work for 
you.


Regards,

Jason




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

[iPhone] Add a UIProgressView as subview to a navigationController

2009-12-05 Thread Philip Vallone

Hi list,

Is it possible to add a UIProgressView as subview to a navigationController? I 
am trying the below example, but it does not show up. I suspect my 
UIProgressView is out of view...

UIProgressView *progbar = [[UIProgressView alloc] initWithFrame:
   CGRectMake(50.0f, 
70.0f, 220.0f, 90.0f)];

[progbar setProgressViewStyle:UIBarButtonItemStylePlain  ];
[progbar setCenter:CGPointMake(160, 20 )];
[progbar setProgress:0.10];

[self.navigationController.navigationBar.topItem setTitleView:progbar];

Thanks for the help.

Phil___

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

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

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

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


Re: Programatically Setting Delegate

2009-12-05 Thread Chunk 1978
i figured it out.  alexander, this would have been more helpful:
http://tinyurl.com/yjpeljv

On Sat, Dec 5, 2009 at 2:42 PM, Chunk 1978  wrote:
> thanks for teaching me how to use google.  huge help.
>
> unfortunately, since i've imported both UIKit and my controller class
> into my custom UIImageView class, my question is wasn't what does that
> error mean, but why am i receiving it.
>
> On Sat, Dec 5, 2009 at 6:45 AM, Alexander Spohr  wrote:
>> http://lmgtfy.com/?q=error+request+for+member+is+something+not+a+structure+of+union
>>
>>        atze
>>
>>
>> Am 05.12.2009 um 09:12 schrieb Chunk 1978:
>>
>>> i have a UIViewController that i'm setting as the delegate for my
>>> custom UIImageView class.  from my custom UIImageView class i want the
>>> delegate to change it's background color (based on computations
>>> performed within the UIImageView class).
>>>
>>> in my UIViewController i write:
>>> –
>>> myUIImageViewClass.classDelegate = self;
>>> –
>>>
>>> then in my custome UIImageViewClass i synthisize the accessor method
>>> for the classDelegate, which is of type id. then from within the code
>>> i try to change the background color of it's delegate with this:
>>> –
>>> [[classDelegate view] setBackgroundColor:[UIColor greenColor]];
>>> –
>>>
>>> if i write it like classDelegate.view.backgroundColor = ... then i
>>> receive and error saying "error request for member is something not a
>>> structure of union"
>>
>>
>
___

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

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

2009-12-05 Thread Chunk 1978
thanks for teaching me how to use google.  huge help.

unfortunately, since i've imported both UIKit and my controller class
into my custom UIImageView class, my question is wasn't what does that
error mean, but why am i receiving it.

On Sat, Dec 5, 2009 at 6:45 AM, Alexander Spohr  wrote:
> http://lmgtfy.com/?q=error+request+for+member+is+something+not+a+structure+of+union
>
>        atze
>
>
> Am 05.12.2009 um 09:12 schrieb Chunk 1978:
>
>> i have a UIViewController that i'm setting as the delegate for my
>> custom UIImageView class.  from my custom UIImageView class i want the
>> delegate to change it's background color (based on computations
>> performed within the UIImageView class).
>>
>> in my UIViewController i write:
>> –
>> myUIImageViewClass.classDelegate = self;
>> –
>>
>> then in my custome UIImageViewClass i synthisize the accessor method
>> for the classDelegate, which is of type id. then from within the code
>> i try to change the background color of it's delegate with this:
>> –
>> [[classDelegate view] setBackgroundColor:[UIColor greenColor]];
>> –
>>
>> if i write it like classDelegate.view.backgroundColor = ... then i
>> receive and error saying "error request for member is something not a
>> structure of union"
>
>
___

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

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


NSOutlineView expand-by-default with NSTreeController

2009-12-05 Thread Benjamin Rister
I have an NSOutlineView in which I would like to have newly-appearing items be 
expanded by default. (It would be nice if NSOutlineView had support for this 
built in; rdar://problem/7421928.)

The list archives and a web search reveal a couple hacks to try and make this 
work, but they depend on feeding the data to the outline view via the 
NSOutlineViewDataSource protocol so that they can ask for an expansion either 
at the time of insertion or in response to the outline view asking about the 
new pieces of data. I’m using NSTreeController, which makes the situation 
difficult as the actual “items” the outline view knows about aren’t anything I 
create myself, so I can’t really queue up an expansion of items as I insert 
them in the model, nor will the outline view ask me about the new data as it’s 
getting it from NSTreeController.

It would be unfortunate to have to reimplement all of the NSTreeController 
functionality I’m using just to get a hook to do this, so does anybody know a 
way to get expand-by-default while still using NSTreeController and bindings? 
This code requires 10.6, so newfangled API is just fine.

Thanks,
Benjamin Rister___

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

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

2009-12-05 Thread Izidor Jerebic

Hi,

this has nothing to do with javascript. Your problem is how to get the  
string out of UITextField.


'sender' is UITextField, which does not have the method -stringValue  
like NSTextField. Look at the documentation of UITextField. You should  
use property 'text' instead.


izidor

P.S. You should ask the questions on mailing lists, so that others can  
benefit from answers.



On 5.12.2009, at 14:59, Philip Juel Borges wrote:


Hi.

You previously helped me out with calling a javascript function so  
that I could enter a number in an NSTextField and then go to the  
corresponding link in WebView. That workds great.


Now, how do I do that with an UIWebview and UITextField?  I've  
searched and tried, but I can't get it to work.

My method is this:

-(IBAction)goToPage:(id)sender {
/* call the javascript function named goToPage */
	[webView stringByEvaluatingJavaScriptFromString:[NSString  
stringWithFormat:@"goToPage('%@');", [sender stringValue]]];

}



This doesn't work in the iPhone SDK environment. I get an error on  
sender stringValue.
In Interface Builder I connect the UITextField outlet to the  
UITextField object and the goToPage action also to the UITextField.  
Like I would do for Mac app.


Do you know how to get this to work? I appreciate any help or  
direction in the right way.


--Philip


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Is it possible to pass an object to a NIB

2009-12-05 Thread Ken Thomases

On Dec 4, 2009, at 9:47 PM, DeNigris Sean wrote:

I'm trying to unit test a view class.  As it is very thin (just  
delegates all work to the controller), all I want to check is that  
my connections (e.g. outlets and actions) are hooked up correctly.


I've been trying to:
1. Create an instance of my class
2. use NSBundle::loadNibFile: externalNameTable: withZone: to load  
the nib


You'd normally write this +[NSBundle  
loadNibFile:externalNameTable:withZone:] (or starting with '-' if  
you're referring to the instance method).



3. check the connections

The docs for loadNibFile (http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBundle_AppKitAdditions/Reference/Reference.html 
) seem to suggest that you can pass objects in:
"A name table whose keys identify objects associated with your  
program or the nib file. The newly unarchived objects from the nib  
file use this table to connect to objects in your program."


You can really only pass in the NIB owner object.  In the NIB, there's  
a proxy "virtual" object called File's Owner.  Other objects in the  
NIB can target File's Owner for actions, bind to File's Owner, or  
connect their outlets to File's Owner.  (It's actually more typical to  
connect outlets of the File's Owner to the other objects.)


When the NIB is loaded, the object you specify as the actual owner is  
plugged into the empty slot in the object graph represented by File's  
Owner, thereby connecting the newly-loaded object graph to your  
existing object graph.


The NIB also may have a proxy for the application object (NSApp),  
which is another way for the newly-loaded object graph to be connected  
to the existing object graph.



There are many methods for loading a NIB.  The one you selected is  
perhaps the clumsiest.  That said, the external name table provides a  
way to supply the NIB owner and receive the loaded top-level objects  
of the NIB.  To supply the owner, the dictionary should have a key  
NSNibOwner mapping to the object to become the owner.



This code is in ruby, but it's just bridged to the corresponding  
Cocoa calls:

view = MyView.new # subclass of NSWindowController


Which is it, a view or a window controller?  Those are two radically  
different things, and you're confusing matters (and perhaps yourself)  
by naming a window controller a "view".


You normally wouldn't instantiate a view if you're going to be loading  
a chunk of GUI from a NIB.  The NIB would have a "freeze-dried" view  
hierarchy and loading the NIB would instantiate it for you.


As Chris Hanson said, if you're really instantiating a window  
controller here, then you should let it load the NIB and establish  
itself as the owner.




NSApplication.sharedApplication
top_level = [] # I've tried passing everything I could think of here:
- view # the object instance
- "My View" => view # NSDictionary with key object name in IB  
and value object instance

- MyView => view # NSDictionary with class name 
/ object entry


You don't pass in the top-level objects, you receive them.  Or, you  
can just not bother.  An NSWindowController would manage this all for  
you.  In any case, if you want to receive them with the  
loadNibFile:externalNameTable:withZone: method, you should pass an  
empty NSMutableArray in the external name table dictionary, under the  
NSNibTopLevelObjects key.  The method would fill that array with the  
top-level objects.


Also, if you're using an NSWindowController in the typical way, it  
does not reside in the NIB, at all.  Instead, the File's Owner (which,  
remember, is just a placeholder) is configured to be of the same class  
as your custom NSWindowController subclass.  Configuring it in that  
way is just a means to get Interface Builder to know which outlets,  
actions, and properties it supports to assist you at design time.  It  
has no real impact at runtime.


In this case, though, you want to pass your NSWindowController- 
subclass instance as the owner of the NIB when it's loaded.  You don't  
pass or receive it as a top-level object, because it's not.  It's not  
"in" the NIB, at all.


By the way, names of objects in Interface Builder are for human  
consumption only.  They, too, have no runtime impact.



	# I Also tried passing the object, and object-containing  
dictionaries below
	# e.g. dictionaryWithObjects_forKeys [NSApp, top_level, view],  
[NSNibOwner, NSNibTopLevelObjects, "My View"]
	context = NSDictionary::dictionaryWithObjects_forKeys [NSApp,  
top_level], [NSNibOwner, NSNibTopLevelObjects]


This is somewhat closer, except I believe you wanted your window  
controller to become the owner of the NIB.  You're telling it to use  
the application object as the owner of the NIB, which doesn't match  
what you say you're trying to achieve.  Also, it's not at all clear to  
me that top_level is the pro

Re: Lan/Airport Notification

2009-12-05 Thread Bill Garrison


On Dec 3, 2009, at 2:24 PM, Jens Alfke wrote:



On Dec 3, 2009, at 9:02 AM, Stefan Lehrner wrote:

is it possible to get notified when Airport or Lan is available? I  
wonder how I
can be notified by the system whenever my Airport goes online or  
when my

Lan Connection will be established?


SystemConfiguration.framework. Check the documentation in Xcode.


Also 

___

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

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

2009-12-05 Thread Eric Gorr
On Dec 4, 2009, at 12:30 PM, Ross Carter wrote:

> On Dec 4, 2009, at 9:29 AM, Eric Gorr wrote:
> 
>> I've got a sample application at 
>> http://ericgorr.net/cocoadev/TextViewNoWrap.zip which demonstrates the 
>> problem I am seeing.
>> 
>> Basically, there is just a text view on a window with a horizontal scrollbar 
>> which appears only when needed.
>> 
>> I have set this text view up based on the instructions found in the "Text 
>> System User Interface Layer Programming Guide for Cocoa" (page 18 - Setting 
>> Up a Horizontal Scroll Bar).
>> 
>> After ~77 characters or so, the horizontal scrollbar stops scrolling and I 
>> can't make any of the text beyond that visible in my view. 
>> 
>> This looks like a bug to me and one that is likely already known.
>> 
>> Are there any known or suggested workarounds?
> 
> In IB you have set the maximum width of the text view to 478, so that is the 
> limit you are running up against.

What is the suggested or common solution?

I noticed, for example, the the height of the text view is set to 1,000,000 
pixels and that if I set it to 478 a similar problem occurs.

So, this implies one solution would be to simply set the width of the view to 
the arbitrarily large value of 1,000,000 pixels as well.

So, the question becomes, why not just set it to FLT_MAX (or should it be 
CGFloat_Max?) - the same size as the text container?

At this size, the scrollbars continue to work as one would expect. What I don't 
know is if there would be unexpected side effects or problems using FLT_MAX.

By using FLT_MAX, and the same is likely true of 1,000,000 pixels, there would 
not seem to be a practical reason to worry about calculating how wide the text 
view needs to be to be able to scroll to all of the text. I can just set it 
once and forget about it. Would you agree?







 ___

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

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

2009-12-05 Thread Alexander Spohr
http://lmgtfy.com/?q=error+request+for+member+is+something+not+a+structure+of+union

atze


Am 05.12.2009 um 09:12 schrieb Chunk 1978:

> i have a UIViewController that i'm setting as the delegate for my
> custom UIImageView class.  from my custom UIImageView class i want the
> delegate to change it's background color (based on computations
> performed within the UIImageView class).
> 
> in my UIViewController i write:
> –
> myUIImageViewClass.classDelegate = self;
> –
> 
> then in my custome UIImageViewClass i synthisize the accessor method
> for the classDelegate, which is of type id. then from within the code
> i try to change the background color of it's delegate with this:
> –
> [[classDelegate view] setBackgroundColor:[UIColor greenColor]];
> –
> 
> if i write it like classDelegate.view.backgroundColor = ... then i
> receive and error saying "error request for member is something not a
> structure of union"

___

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

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


Programatically Setting Delegate

2009-12-05 Thread Chunk 1978
i have a UIViewController that i'm setting as the delegate for my
custom UIImageView class.  from my custom UIImageView class i want the
delegate to change it's background color (based on computations
performed within the UIImageView class).

in my UIViewController i write:
–
myUIImageViewClass.classDelegate = self;
–

then in my custome UIImageViewClass i synthisize the accessor method
for the classDelegate, which is of type id. then from within the code
i try to change the background color of it's delegate with this:
–
[[classDelegate view] setBackgroundColor:[UIColor greenColor]];
–

if i write it like classDelegate.view.backgroundColor = ... then i
receive and error saying "error request for member is something not a
structure of union"
___

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

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

2009-12-05 Thread Zephyroth Akash

Hi,

First I apologize if it's not the right list to ask this question.

How do I get the class-code definition of a motherboard controller ?

All I can do right now is to retrieve the value of this key using  
IOKit but where this code is defined ?


For example, it's seems that audio controller class-code is 00 03 04  
00 but there should be an easier way to determine the type of a  
motherboard controller like KIO(something)Class.



___

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

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