ArrayController vs Pop-up button vs Transformer -- three way tag team death match!

2011-04-19 Thread Ben Golding

I am a bit stumped.  I have an array controller which I have hooked up to a 
pop-up button and that works quite well.  The members of the array are 
NSStrings but I would like to reformat them when they're displayed by the 
pop-up button.  Seems fairly straightforward, I thought I'd just write a little 
transformer to do that.

I plugged everything together and was surprised that that the transformer was 
raising an exception because it was being passed an NSObjectControllerProxy as 
its argument, not an NSString as I'd been expecting.

After some hunting around on the interwebs, I've tried all sorts of 
permutations, doing the binding via the pop-up buttons content values but I 
seem to come up against the same problem.

Is it possible to do this?  I feel like I'm missing something obvious.

Ben.

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: ArrayController vs Pop-up button vs Transformer -- three way tag team death match!

2011-04-19 Thread Citizen

On 19 Apr 2011, at 08:41, Ben Golding wrote:

> I am a bit stumped.  I have an array controller which I have hooked up to a 
> pop-up button and that works quite well.  The members of the array are 
> NSStrings but I would like to reformat them when they're displayed by the 
> pop-up button.  Seems fairly straightforward, I thought I'd just write a 
> little transformer to do that.
> 
> I plugged everything together and was surprised that that the transformer was 
> raising an exception because it was being passed an NSObjectControllerProxy 
> as its argument, not an NSString as I'd been expecting.

[snip]

> Is it possible to do this?  I feel like I'm missing something obvious.


How about, instead of trying to change what you pass to the transformer; 
transform what you get. i.e transform the NSObjectControllerProxy into the 
desired output?

Hope that helps / works.

Dave
--
David Kennedy (http://www.zenopolis.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: ArrayController vs Pop-up button vs Transformer -- three way tag team death match!

2011-04-19 Thread Quincey Morris
On Apr 19, 2011, at 00:41, Ben Golding wrote:

> I am a bit stumped.  I have an array controller which I have hooked up to a 
> pop-up button and that works quite well.  The members of the array are 
> NSStrings but I would like to reformat them when they're displayed by the 
> pop-up button.  Seems fairly straightforward, I thought I'd just write a 
> little transformer to do that.
> 
> I plugged everything together and was surprised that that the transformer was 
> raising an exception because it was being passed an NSObjectControllerProxy 
> as its argument, not an NSString as I'd been expecting.

Can you list explicitly all the NSPopUpButton bindings you're using?

The bindings for popup buttons are very nasty. You have to figure out 
what/whether to bind 'content', 'contentObjects' and 'contentValues'. Only 
after you've got that right can you decide which of the 'selected...' bindings 
you want to use.

'content', 'contentObjects' and 'contentValues' correspond to controller 
proxies, strings and represented objects, but I couldn't tell you off-hand 
which corresponds to what. It's anybody's guess whether the documentation 
(http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSPopUpButton.html)
 is actually correct -- several of the pages in that document are wrong and/or 
incomplete -- and it's a puzzle sometimes to understand what the documentation 
even means.

TBH, I've generally found it easier *not* to use bindings for NSPopUpButton 
content, but provide it the traditional way ('-[NSPopUpButton insertItem...]'), 
and just use a binding for 'selectedIndex'. But maybe I'm just a coward.


___

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

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

2011-04-19 Thread eveningnick eveningnick
Thanks a lot for detailed response!
___

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

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


Does not allow to Uninstall the application when it is running.

2011-04-19 Thread kirankumar

Hi All,

I have one application for this i developed uninstall application when i run 
uninstall utility it completely uninstalling successfull upto here it is fine.

But when i open the application also the uninstall utility is running 
completely successfull its a wrong process .

if application is in running stage ,the uninstall utility does not  allow to 
uninstall for this what i need to do?



Regards,
Kiran.K


The information contained in this email and any attachments is confidential and 
may be subject to copyright or other intellectual property protection. If you 
are not the intended recipient, you are not authorized to use or disclose this 
information, and we request that you notify us by reply mail or telephone and 
delete the original message from your mail system.
___

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

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

2011-04-19 Thread Bhatnagar, Arvin
I fixed my own issue.

It has to do with the timer. In short when using a timer to animate a
layer I was using scheduledTimerWithTimeInterval versus
timerWithTimeInterval. When I use timerWithTimeInterval I then set the
Fire Date and add the timer to three modes: (NSRunLoopCommonModes,
NSDefaultRunLoopMode, NSEventTrackingRunLoopMode). Now when I resize my
view the timer doesn't stall and the animation continues.

This worked for me, and I can only assume that adding the timer to these
other two modes was the solution: NSRunLoopCommonModes /
NSEventTrackingRunLoopMode.

If anybody can explain this further, I am all ears!

Thanks,
Arvin


On 4/18/11 10:49 PM, "Bhatnagar, Arvin" 
wrote:

>Hi All,
>
>This is probably a simple question for someone other than I.
>
>I have a very simple CALayer which is a simple plain layer with a white
>background. I then create a CABasicAnimation and add it to the actions
>property to animate the @"opacity". From here I setup a timer to fire and
>toggle the opacity between 0 and 1 which animates.
>
>My issue is, when I go to resize the window the animation halts. Anybody
>know why this occurs and if I can allow the animation to continue even if
>I resize the view that the layer resides in? It's probably something
>small and simple, but just don't know what it is and can't find it in the
>documentation.
>
>Oh yeah, my later tree is setup as such:
>
>[CALayer rootLayer]
>[view setWantsLayers:YES]
>[[view layer] addSublayer:mBasicLayer]
>
>Thanks,
>Arvin
>___
>
>Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
>Please do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>Help/Unsubscribe/Update your Subscription:
>http://lists.apple.com/mailman/options/cocoa-dev/arvin.bhatnagar%40verizon
>.com
>
>This email sent to arvin.bhatna...@verizon.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: updating a table without interrupting user editing

2011-04-19 Thread Jerry Krinock

On 2011 Apr 18, at 20:32, Scott Ribe wrote:

> Suppose a user is editing a cell in a table, and I would like to call 
> reloadData in order to reflect updates that have arrived asynchronously. What 
> would I need to do in order to preserve the user's editing state, including 
> current selected cell and its text selection? (This would need to work 10.4 
> through 10.6.)

Study -[NSWindow endEditingFor:].___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Does not allow to Uninstall the application when it is running.

2011-04-19 Thread Michael Babin
On Apr 19, 2011, at 7:09 AM, kirankumar wrote:

> I have one application for this i developed uninstall application when i run 
> uninstall utility it completely uninstalling successfull upto here it is fine.
> 
> But when i open the application also the uninstall utility is running 
> completely successfull its a wrong process .
> 
> if application is in running stage ,the uninstall utility does not  allow to 
> uninstall for this what i need to do?

If the application is visible to the user (one that they launch and quit, not a 
background-only application) and the uninstaller is something they initiate, 
then the uninstaller can check if the application is running before proceeding 
with the uninstall. If the application is running, the uninstaller can present 
an alert to the user letting them know that they must quit the application 
before the uninstall can proceed. Dismissing the alert would repeat the check.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ArrayController vs Pop-up button vs Transformer -- three way tag team death match!

2011-04-19 Thread Ben Golding

On 19/04/2011, at 18:19, Quincey Morris wrote:

> On Apr 19, 2011, at 00:41, Ben Golding wrote:
> 
>> I am a bit stumped.  I have an array controller which I have hooked up to a 
>> pop-up button and that works quite well.  The members of the array are 
>> NSStrings but I would like to reformat them when they're displayed by the 
>> pop-up button.  Seems fairly straightforward, I thought I'd just write a 
>> little transformer to do that.
>> 
>> I plugged everything together and was surprised that that the transformer 
>> was raising an exception because it was being passed an 
>> NSObjectControllerProxy as its argument, not an NSString as I'd been 
>> expecting.
> 
> Can you list explicitly all the NSPopUpButton bindings you're using?

Sure, I'm using content to bind to an array controller bound to an array of 
pop-up button titles and selected index (though I'm picking up the selected 
object using [[arrayControlled selectedObjects] objectAtIndex:0]).

I've also tried binding to contentValues which was unsuccessful too.

> The bindings for popup buttons are very nasty. You have to figure out 
> what/whether to bind 'content', 'contentObjects' and 'contentValues'. Only 
> after you've got that right can you decide which of the 'selected...' 
> bindings you want to use.
> 
> 'content', 'contentObjects' and 'contentValues' correspond to controller 
> proxies, strings and represented objects, but I couldn't tell you off-hand 
> which corresponds to what. It's anybody's guess whether the documentation 
> (http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSPopUpButton.html)
>  is actually correct -- several of the pages in that document are wrong 
> and/or incomplete -- and it's a puzzle sometimes to understand what the 
> documentation even means.

What I'd found was that the documentation doesn't indicate what the 
ValueTransformer indicated is passed.  It seems to be a controller object, not 
the pop-up button item's title which is the only thing that seems to make sense 
in the context.

> TBH, I've generally found it easier *not* to use bindings for NSPopUpButton 
> content, but provide it the traditional way ('-[NSPopUpButton 
> insertItem...]'), and just use a binding for 'selectedIndex'. But maybe I'm 
> just a coward.

I share your fear but the win with bindings is too good to avoid.  I try to 
think of these sort of frustrations as part of the learning process.  I can 
really sympathise with wanting to fall back to the "old way".

Ben.

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: Find network mounted DVD's

2011-04-19 Thread Michael Dautermann

On Apr 18, 2011, at 10:35 PM, P Teeson wrote:

> In an app I am working on I have the below code to detect physical DVDs 
> attached to the computer. 

> But I have not had success in figuring out how to find LAN mounted DVD's
> Can someone please point me to the correct documentation or suggest a 
> direction for me to go in?

Hi Peter,

LAN (or network) mounted DVD's are accessible through the file system, just 
like physically attached DVD's are.  

My suggestion would be to enumerate through all the attached volumes to look 
for the telltale signs that a particular volume is a DVD (e.g. a "VIDEO_TS" or 
"AUDIO_TS" directory, a VIDEO_TS.VOB file, etc.).  

And if you want to catch new DVD's as they are being attached, register for an 
appropriate notification (e.g. volume attached?).

I hope this suggestion helps!

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


NSTableView willDisplayCell: called on hover

2011-04-19 Thread Joshua Garnham
I've been doing some custom drawing in the 
tableView:willDisplayCell:forTableColumn:row: and from this realized that if 
you 
hover over a row in the table view for about 3 seconds then it will call 
willDisplayCell: again. 


What's even more odd is that if I close the window and reopen it and hover over 
a row again for 3 seconds then willDisplayCell: doesn't get called again unlike 
before. So this only seems to happen the first time.

So my question really is, why does willDisplayCell: get called after a 3 sec 
hover, is this a bug? and is there anyway around it?

Regards,
Josh.

___

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

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

2011-04-19 Thread P Teeson
Thanks for your suggestion. 
I did look at all the sample projects and know about that approach.
But it does seem somewhat inelegant.
Am I missing something available using IOKit?

On 2011-04-19, at 9:36 AM, Michael Dautermann wrote:
> On Apr 18, 2011, at 10:35 PM, P Teeson wrote:
> 
>> In an app I am working on I have the below code to detect physical DVDs 
>> attached to the computer. 
> 
>> But I have not had success in figuring out how to find LAN mounted DVD's
>> Can someone please point me to the correct documentation or suggest a 
>> direction for me to go in?
> 
> Hi Peter,
> 
> LAN (or network) mounted DVD's are accessible through the file system, just 
> like physically attached DVD's are.  
> 
> My suggestion would be to enumerate through all the attached volumes to look 
> for the telltale signs that a particular volume is a DVD (e.g. a "VIDEO_TS" 
> or "AUDIO_TS" directory, a VIDEO_TS.VOB file, etc.).  
> 
> And if you want to catch new DVD's as they are being attached, register for 
> an appropriate notification (e.g. volume attached?).
> 
> I hope this suggestion helps!
> 
> 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: NSTableView willDisplayCell: called on hover

2011-04-19 Thread Kyle Sluder
On Apr 19, 2011, at 7:35 AM, Joshua Garnham  wrote:

> So my question really is, why does willDisplayCell: get called after a 3 sec 
> hover, is this a bug? and is there anyway around it?

It probably gets called to draw the tooltip expansion cell. If there is a bug 
here, it's that willDisplayCell: doesn't get called after the window is 
reopened.

You need to fix your code so that it doesn't care when or how often 
willDisplayCell: is called. You should not be doing much if any meaningful work 
in this method.

--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: Find network mounted DVD's

2011-04-19 Thread Michael Dautermann

On Apr 19, 2011, at 10:52 AM, P Teeson wrote:

> Thanks for your suggestion. 
> I did look at all the sample projects and know about that approach.
> But it does seem somewhat inelegant.
> Am I missing something available using IOKit?

The code you had in your original post looked just as straightforward (or 
inelegant?) as enumerating through all attached volumes to look for telltale 
signs of DVD's.  

What's the big picture of what you are trying to do?

AFAIK, IOKit is meant for things attached physically to your hardware. When you 
connect to a remote DVD, does anything obvious change in the IORegistry (which 
you can look at via the IORegistryExplorer utility app)?





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ArrayController vs Pop-up button vs Transformer -- three way tag team death match!

2011-04-19 Thread Kyle Sluder
On Apr 19, 2011, at 6:20 AM, Ben Golding  wrote:

> 
> Sure, I'm using content to bind to an array controller bound to an array of 
> pop-up button titles and selected index (though I'm picking up the selected 
> object using [[arrayControlled selectedObjects] objectAtIndex:0]).
> 
> I've also tried binding to contentValues which was unsuccessful too.

It might help to be a bit more precise. Enumerate all the configured bindings 
on your popup button. I like to use a syntax like this:

popupButton.content --(CapitalizeTransformer)--> 
[arrayController].arrangedObjects

--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: NSTableView willDisplayCell: called on hover

2011-04-19 Thread Joshua Garnham
Normally my code doesn't care when or how often willDisplayCell: is called and 
is in fact called more often than in a normal table view as my code highlights 
the cell that the mouse is over.

The odd thing is on this occasion the background which I draw for the 
highlighted cell actually draws over everything else rather than going behind 
it.

Obviously as this happens normally due to the tooltip, I will have to 
investigate as to why the problem occurs and possibly consider where I do the 
drawing.

Thanks for your help,
Josh



From: Kyle Sluder 
To: Joshua Garnham 
Cc: "cocoa-dev@lists.apple.com" 
Sent: Tue, 19 April, 2011 16:02:17
Subject: Re: NSTableView willDisplayCell: called on hover

On Apr 19, 2011, at 7:35 AM, Joshua Garnham  wrote:

> So my question really is, why does willDisplayCell: get called after a 3 sec 
> hover, is this a bug? and is there anyway around it?

It probably gets called to draw the tooltip expansion cell. If there is a bug 
here, it's that willDisplayCell: doesn't get called after the window is 
reopened.

You need to fix your code so that it doesn't care when or how often 
willDisplayCell: is called. You should not be doing much if any meaningful work 
in this method.

--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: CALayer: Animation using actions property

2011-04-19 Thread David Duncan
On Apr 18, 2011, at 7:49 PM, Bhatnagar, Arvin wrote:

> This is probably a simple question for someone other than I.
> 
> I have a very simple CALayer which is a simple plain layer with a white 
> background. I then create a CABasicAnimation and add it to the actions 
> property to animate the @"opacity". From here I setup a timer to fire and 
> toggle the opacity between 0 and 1 which animates.


Your analysis of the timer was correct, but I wanted to talk to this point 
instead – rather than using a timer to toggle the opacity, you could just add 
an animation to the layer that auto-reverses and repeats indefinitely, which 
would likely give you the same effect without having to run a timer at all.
--
David Duncan

___

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

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

2011-04-19 Thread Bhatnagar, Arvin
Thanks David, I am going to try that suggestion right now.

On 4/19/11 11:59 AM, "David Duncan"  wrote:

>On Apr 18, 2011, at 7:49 PM, Bhatnagar, Arvin wrote:
>
>> This is probably a simple question for someone other than I.
>> 
>> I have a very simple CALayer which is a simple plain layer with a white
>>background. I then create a CABasicAnimation and add it to the actions
>>property to animate the @"opacity". From here I setup a timer to fire
>>and toggle the opacity between 0 and 1 which animates.
>
>
>Your analysis of the timer was correct, but I wanted to talk to this
>point instead ­ rather than using a timer to toggle the opacity, you
>could just add an animation to the layer that auto-reverses and repeats
>indefinitely, which would likely give you the same effect without having
>to run a timer at all.
>--
>David Duncan
>

___

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

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

2011-04-19 Thread Bhatnagar, Arvin
Ok that worked if I were animating just one layer on its own. However, I am 
animating three separate layers in sequence to one another. I know we can group 
multiple animations for one layer (CAGroupAnimation). Other than using a timer, 
is there an alternative to coordinating the animation of different layers?

Some Code:

- (void) moveDots {



// Animate Dot Opacity

CALayer* dot = (CALayer *)[mDotLayers objectAtIndex:mDotPosition];

dot.opacity = mDotDirection ? 0.0f : 1.0f;

[self setNeedsDisplay];



// NO --> Forward, YES <-- Backward

if ( !mDotDirection ) mDotPosition++;

if (  mDotDirection ) mDotPosition--;



if ( mDotPosition < 0 ) {

mDotPosition = 0;

mDotDirection = NO;

}



if ( mDotPosition > (_noOfDots-1) ) {

mDotPosition = (_noOfDots-1);

mDotDirection = YES;

}

}


- (void) _startAnimationTimer {


// Just in case

[self _stopAnimationTimer];



// Dot Layer Timer

mDotTimer = [NSTimer timerWithTimeInterval:(NSTimeInterval)1.0f

target:self

  selector:@selector(moveDots)

  userInfo:nil

   repeats:YES];

[mDotTimer setFireDate:[NSDate date]];

[[NSRunLoop currentRunLoop] addTimer:mDotTimer 
forMode:NSRunLoopCommonModes];

[[NSRunLoop currentRunLoop] addTimer:mDotTimer 
forMode:NSDefaultRunLoopMode];

[[NSRunLoop currentRunLoop] addTimer:mDotTimer 
forMode:NSEventTrackingRunLoopMode];

}


Thanks,

Arvin

On 4/19/11 12:07 PM, "Bhatnagar, Arvin" 
mailto:arvin.bhatna...@verizon.com>> wrote:

Thanks David, I am going to try that suggestion right now.

On 4/19/11 11:59 AM, "David Duncan" 
mailto:david.dun...@apple.com>> wrote:

On Apr 18, 2011, at 7:49 PM, Bhatnagar, Arvin wrote:

This is probably a simple question for someone other than I.
I have a very simple CALayer which is a simple plain layer with a white
background. I then create a CABasicAnimation and add it to the actions
property to animate the @"opacity". From here I setup a timer to fire
and toggle the opacity between 0 and 1 which animates.


Your analysis of the timer was correct, but I wanted to talk to this
point instead ­ rather than using a timer to toggle the opacity, you
could just add an animation to the layer that auto-reverses and repeats
indefinitely, which would likely give you the same effect without having
to run a timer at all.
--
David Duncan


___

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

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

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

This email sent to 
arvin.bhatna...@verizon.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: CALayer: Animation using actions property

2011-04-19 Thread David Duncan

On Apr 19, 2011, at 9:26 AM, Bhatnagar, Arvin wrote:

> Ok that worked if I were animating just one layer on its own. However, I am 
> animating three separate layers in sequence to one another. I know we can 
> group multiple animations for one layer (CAGroupAnimation). Other than using 
> a timer, is there an alternative to coordinating the animation of different 
> layers?


All you should need to do is add the appropriate animations to each layer. If 
you need some kind of delay between them, you may find that putting them in a 
group animation gives you a nested context to do so. For example if you want an 
animation that progresses forward, pauses then reverses it may make more sense 
to have a group animation with 2 animations on a timeline with the included 
delays that repeats (but doesn't autoreverse, since your doing the reversal 
yourself).

Depending on how you feel about it, it can either be a complex or fun game to 
see what you can do with animations to get an effect by itself )
--
David Duncan

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ArrayController vs Pop-up button vs Transformer -- three way tag team death match!

2011-04-19 Thread Quincey Morris
On Apr 19, 2011, at 06:20, Ben Golding wrote:

> What I'd found was that the documentation doesn't indicate what the 
> ValueTransformer indicated is passed.  It seems to be a controller object, 
> not the pop-up button item's title which is the only thing that seems to make 
> sense in the context.

It may be a bug ("less than useful design choice"), or you might need to bind 
to something else, or you might find it necessary to bind or not bind one or 
more of the alternate bindings, or you might need to go ahead and used the 
passed proxy as a string anyway, as was already suggested.

> I share your fear but the win with bindings is too good to avoid.  I try to 
> think of these sort of frustrations as part of the learning process.  I can 
> really sympathise with wanting to fall back to the "old way".

I think my point was that there's no real win with bindings in this case. If 
you need to make multiple bindings to get the popup to work, and you have to 
write code to supply the supplementary arrays these bindings use, then you've 
saved nothing.

However, I don't want to discourage you from figuring it out, if you have a few 
hours to waste. :) 

As Kyle said, we can't really help unless you tell us *exactly* what the 
bindings are.


___

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

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

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

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


Re: NSTableView willDisplayCell: called on hover

2011-04-19 Thread Corbin Dunn
Hi Josh,

Be sure to not draw outside the cell bounds passed to you in the drawXXRect: 
method on the cell.

corbin

On Apr 19, 2011, at 8:56 AM, Joshua Garnham wrote:

> Normally my code doesn't care when or how often willDisplayCell: is called 
> and 
> is in fact called more often than in a normal table view as my code 
> highlights 
> the cell that the mouse is over.
> 
> The odd thing is on this occasion the background which I draw for the 
> highlighted cell actually draws over everything else rather than going behind 
> it.
> 
> Obviously as this happens normally due to the tooltip, I will have to 
> investigate as to why the problem occurs and possibly consider where I do the 
> drawing.
> 
> Thanks for your help,
> Josh
> 
> 
> 
> From: Kyle Sluder 
> To: Joshua Garnham 
> Cc: "cocoa-dev@lists.apple.com" 
> Sent: Tue, 19 April, 2011 16:02:17
> Subject: Re: NSTableView willDisplayCell: called on hover
> 
> On Apr 19, 2011, at 7:35 AM, Joshua Garnham  
> wrote:
> 
>> So my question really is, why does willDisplayCell: get called after a 3 sec 
>> hover, is this a bug? and is there anyway around it?
> 
> It probably gets called to draw the tooltip expansion cell. If there is a bug 
> here, it's that willDisplayCell: doesn't get called after the window is 
> reopened.
> 
> You need to fix your code so that it doesn't care when or how often 
> willDisplayCell: is called. You should not be doing much if any meaningful 
> work 
> in this method.
> 
> --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/corbind%40apple.com
> 
> This email sent to corb...@apple.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


UIView/NSView doesn't display changing data in real time

2011-04-19 Thread Frederick C. Lee
Greetings:

Simple scenario:  background thread is computing data to be displayed in real 
time within the main thread.
Data:  dynamic/variable data  that is converted into a NSString type within a 
background thread, displayed within a UILabel (or NSLabel) on the main thread.

My own environment: iOS 4+ (relevant to OS X as well) using Xcode 4+.

Design: background thread (via NSOperation/NSOperationQueue) sends 
data/iteration to the main (host) thread via DELEGATION.
  
Note: the main thread *** sees  this data in read time (via NSLog() stmt 
)

However, the front end UIView (or NSView) does NOT update/iteration in real 
time.

Paradigm Request:  a real-time digital clock tick, tick... you see the 
seconds being updated.   I need to ditto that with velocity, position, etc.
I tried the 'setNeedsDisplay' method call; has no effect.

Question: What is the preferred way to display within the MAIN thread in real 
time, data that is computed on a back-end thread?

Regards,
Ric.___

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

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


warning: cast from pointer to integer of different size

2011-04-19 Thread Jon Sigman
Basic question: Just for debugging purposes, I'm trying to print out the 
address 
of a pointer to a struct, but I can't figure out the proper way to do it (ie, 
satisfy the compiler warnings). OSX 10.6.7, Xcode 3.2.6

dispatch_source_t our_gcd_source;
. . .
printf("gcd_source: %08X\n",gcd_source);
warning: format '%08X' expects type 'unsigned int', but argument 2 has type 
'dispatch_source_t'
. . .
printf("gcd_source: %08X\n",(unsigned int)gcd_source);
warning: cast from pointer to integer of different size

Thx
___

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

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

2011-04-19 Thread P Teeson
Thank you for your thoughts.

On 2011-04-19, at 11:08 AM, Michael Dautermann wrote:
> On Apr 19, 2011, at 10:52 AM, P Teeson wrote:
> 
>> Thanks for your suggestion. 
>> I did look at all the sample projects and know about that approach.
>> But it does seem somewhat inelegant.
>> Am I missing something available using IOKit?
> 
> The code you had in your original post looked just as straightforward (or 
> inelegant?) as enumerating through all attached volumes to look for telltale 
> signs of DVD's.  
> 
> What's the big picture of what you are trying to do?
> 
> AFAIK, IOKit is meant for things attached physically to your hardware. When 
> you connect to a remote DVD, does anything obvious change in the IORegistry 
> (which you can look at via the IORegistryExplorer utility app)?
> 
> 
> 
> 
> 
> 

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: warning: cast from pointer to integer of different size

2011-04-19 Thread David Duncan
%p

On Apr 19, 2011, at 10:50 AM, Jon Sigman wrote:

> Basic question: Just for debugging purposes, I'm trying to print out the 
> address 
> of a pointer to a struct, but I can't figure out the proper way to do it (ie, 
> satisfy the compiler warnings). OSX 10.6.7, Xcode 3.2.6
> 
>dispatch_source_t our_gcd_source;
>. . .
>printf("gcd_source: %08X\n",gcd_source);
> warning: format '%08X' expects type 'unsigned int', but argument 2 has type 
> 'dispatch_source_t'
>. . .
>printf("gcd_source: %08X\n",(unsigned int)gcd_source);
> warning: cast from pointer to integer of different size
> 
> Thx
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

--
David Duncan

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: warning: cast from pointer to integer of different size

2011-04-19 Thread Jon Sigman
Thanks, David. I do recall that now. Need more coffee...


From: David Duncan 
To: Jon Sigman 
Cc: cocoa-dev@lists.apple.com
Sent: Tue, April 19, 2011 11:01:40 AM
Subject: Re: warning: cast from pointer to integer of different size

%p

On Apr 19, 2011, at 10:50 AM, Jon Sigman wrote:

> Basic question: Just for debugging purposes, I'm trying to print out the 
>address 
>
> of a pointer to a struct, but I can't figure out the proper way to do it (ie, 
> satisfy the compiler warnings). OSX 10.6.7, Xcode 3.2.6
> 
>dispatch_source_t our_gcd_source;
>. . .
>printf("gcd_source: %08X\n",gcd_source);
> warning: format '%08X' expects type 'unsigned int', but argument 2 has type 
> 'dispatch_source_t'
>. . .
>printf("gcd_source: %08X\n",(unsigned int)gcd_source);
> warning: cast from pointer to integer of different size
> 
> Thx
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
> 
> This email sent to david.dun...@apple.com

--
David Duncan
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: UIView/NSView doesn't display changing data in real time

2011-04-19 Thread Hank Heijink (Mailinglists)
On Apr 19, 2011, at 1:51 PM, Frederick C. Lee wrote:

> Greetings:
> 
> Simple scenario:  background thread is computing data to be displayed in real 
> time within the main thread.
> Data:  dynamic/variable data  that is converted into a NSString type within a 
> background thread, displayed within a UILabel (or NSLabel) on the main thread.
> 
> My own environment: iOS 4+ (relevant to OS X as well) using Xcode 4+.
> 
> Design: background thread (via NSOperation/NSOperationQueue) sends 
> data/iteration to the main (host) thread via DELEGATION.

I wonder why you need to send data to the main thread. Can't the main thread 
just inspect a shared data structure (appropriately locked of course) whenever 
it needs to update the UI? However, without knowing what you're trying to do 
it's hard to comment on the design - you may well have picked the best choice 
here. What is your data frequency?

> Note: the main thread *** sees  this data in read time (via NSLog() stmt 
> )
> 
> However, the front end UIView (or NSView) does NOT update/iteration in real 
> time.

How are you updating the view? How real time is real time? What are you 
observing that leads you to believe you're looking at the wong data, i.e. is it 
delayed, or complete garbage?

> Paradigm Request:  a real-time digital clock tick, tick... you see the 
> seconds being updated.   I need to ditto that with velocity, position, etc.
> I tried the 'setNeedsDisplay' method call; has no effect.

If you just need to display text, I'd use a UILabel where you keep updating the 
text property. If you use a custom UIView you'll need to call setNeedsDisplay 
and have your drawRect: method update the view appropriately.

> Question: What is the preferred way to display within the MAIN thread in real 
> time, data that is computed on a back-end thread?

That very much depends on how much data you have and how frequently the UI 
needs to be updated. Hard to say without more info - there are lots of 
possibilities.

Hank___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: UIView/NSView doesn't display changing data in real time

2011-04-19 Thread Steve Christensen
Is your call to -setNeedsDisplay being done on the main thread or from your 
background thread. I seem to recall that you get ignored if the call is not 
made on the main thread, so you'd need to use one of the 
-performSelectorOnMainThread:... methods.


On Apr 19, 2011, at 10:51 AM, Frederick C. Lee wrote:

> Simple scenario:  background thread is computing data to be displayed in real 
> time within the main thread.
> Data:  dynamic/variable data  that is converted into a NSString type within a 
> background thread, displayed within a UILabel (or NSLabel) on the main thread.
> 
> My own environment: iOS 4+ (relevant to OS X as well) using Xcode 4+.
> 
> Design: background thread (via NSOperation/NSOperationQueue) sends 
> data/iteration to the main (host) thread via DELEGATION.
> 
> Note: the main thread *** sees  this data in read time (via NSLog() stmt 
> )
> 
> However, the front end UIView (or NSView) does NOT update/iteration in real 
> time.
> 
> Paradigm Request:  a real-time digital clock tick, tick... you see the 
> seconds being updated.   I need to ditto that with velocity, position, etc.
> I tried the 'setNeedsDisplay' method call; has no effect.
> 
> Question: What is the preferred way to display within the MAIN thread in real 
> time, data that is computed on a back-end thread?

___

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

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

2011-04-19 Thread Rodrigo Zanatta Silva
I think this is simple, but i am have no idea. I create a upper class:

#import "downClass.h"
@interface MyUpperClass : NSObject

and in than I create

downClass *test = [[downClass alloc] init].


Than in my downClass is just a think like
@interface downClass: NSObject

They are not Inheritance, so [super function] don't work. My problem is I
want to call a function in MyUpperClass and I am in downClass. It's a
instance function (like "- (void) function", not with +) so [MyUpperClass
function] will not work.

The solution was use
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(function:)
name:@"observer" object:nil];
to listen and
[[NSNotificationCenter defaultCenter] postNotificationName:@"observer"
object:nil];
to call.

Do this a correct way to do? There are another way better than this? For me,
this way cause problem because it's a little GOTO style and in debug make
things difficult.
___

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

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

2011-04-19 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 4/19/11 1:07 PM, Rodrigo Zanatta Silva wrote:
> I think this is simple, but i am have no idea. I create a upper class:
> 
> #import "downClass.h"
> @interface MyUpperClass : NSObject
> 
> and in than I create
> 
> downClass *test = [[downClass alloc] init].
> 
> 
> Than in my downClass is just a think like
> @interface downClass: NSObject
> 
> They are not Inheritance, so [super function] don't work. My problem is I
> want to call a function in MyUpperClass and I am in downClass. It's a
> instance function (like "- (void) function", not with +) so [MyUpperClass
> function] will not work.
> 
> The solution was use
> [[NSNotificationCenter defaultCenter] addObserver:self
> selector:@selector(function:)
> name:@"observer" object:nil];
> to listen and
> [[NSNotificationCenter defaultCenter] postNotificationName:@"observer"
> object:nil];
> to call.
> 
> Do this a correct way to do? There are another way better than this? For me,
> this way cause problem because it's a little GOTO style and in debug make
> things difficult.

I'm having a very hard time following what you are trying to do, in part
because generic names in code (e.g. "upperClass" and "function") are
hard to keep straight.

You say you are trying to call an instance method.  Do you mean you just
want to do something like:

MyUpperClass *upperClass = [[MyUpperClass alloc] init];
[upperClass function:someVariable];

??

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFNre4WaOlrz5+0JdURApttAKCKIifHWsYZNAPkjb6kxhwoHY5JBACggSPh
OmZ/cESJXSqxfpgLi5j+gtY=
=ZLvW
-END PGP 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: Find network mounted DVD's

2011-04-19 Thread Lee Ann Rucker
You can spot an Apple Remote Disc by looking for 

kIOPropertyPhysicalInterconnectLocationKey = "Network"
kIOPropertyProductNameKey = "Disc Image"


On Apr 19, 2011, at 8:08 AM, Michael Dautermann wrote:

> 
> On Apr 19, 2011, at 10:52 AM, P Teeson wrote:
> 
>> Thanks for your suggestion. 
>> I did look at all the sample projects and know about that approach.
>> But it does seem somewhat inelegant.
>> Am I missing something available using IOKit?
> 
> The code you had in your original post looked just as straightforward (or 
> inelegant?) as enumerating through all attached volumes to look for telltale 
> signs of DVD's.  
> 
> What's the big picture of what you are trying to do?
> 
> AFAIK, IOKit is meant for things attached physically to your hardware. When 
> you connect to a remote DVD, does anything obvious change in the IORegistry 
> (which you can look at via the IORegistryExplorer utility app)?
> 
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
> 
> This email sent to lruc...@vmware.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: How call upper layer function

2011-04-19 Thread Rodrigo Zanatta Silva
Lol, sorry for making your life hard :P

let's write better. (Will be a problem in your computer with this font in
e-mail? )

//This is LevelUp.h
#import "LeveDown.h"
@interface LevelUp : NSObject  {
}
-(void) init;
-(void)wantCallThisFunction
@end

//This is LevelUp.m
@implement LevelUp
-(void) init {
LevelDown *test = [[LevelDown alloc] init];
}

-(void)wantCallThisFunction {
///Do something
}
@end

//
//  levelDown.h
@interface LevelDown : UIView { //Some class
-(void) init;
-(void)keyboardWillShow;
}
@end

//LevelDown.m
@implement
-(void) init {};
-(void)keyboardWillShow {
//iOS automatic call this function
//I need to call wantCallThisFunction
}

Like I say, if I use this line in keyboardWillShow function :
[[NSNotificationCenter defaultCenter] postNotificationName:@"thisWork"
object:nil];

And to catch this call, in function init of LevelUp class , I have to use
this line
 [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(wantCallThisFunction)
name:@"thisWork" object:nil];

So the question is: there are another way to do that?

Now I am thinking that I have to remake the program and use a third object
that create instances of LevelUp and LevelDown in the same object. Am I
correct, or there are another way? I'm not remembering if java have problem
like that.


2011/4/19 Conrad Shultz 

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 4/19/11 1:07 PM, Rodrigo Zanatta Silva wrote:
> > I think this is simple, but i am have no idea. I create a upper class:
> >
> > #import "downClass.h"
> > @interface MyUpperClass : NSObject
> >
> > and in than I create
> >
> > downClass *test = [[downClass alloc] init].
> >
> >
> > Than in my downClass is just a think like
> > @interface downClass: NSObject
> >
> > They are not Inheritance, so [super function] don't work. My problem is I
> > want to call a function in MyUpperClass and I am in downClass. It's a
> > instance function (like "- (void) function", not with +) so [MyUpperClass
> > function] will not work.
> >
> > The solution was use
> > [[NSNotificationCenter defaultCenter] addObserver:self
> > selector:@selector(function:)
> > name:@"observer" object:nil];
> > to listen and
> > [[NSNotificationCenter defaultCenter] postNotificationName:@"observer"
> > object:nil];
> > to call.
> >
> > Do this a correct way to do? There are another way better than this? For
> me,
> > this way cause problem because it's a little GOTO style and in debug make
> > things difficult.
>
> I'm having a very hard time following what you are trying to do, in part
> because generic names in code (e.g. "upperClass" and "function") are
> hard to keep straight.
>
> You say you are trying to call an instance method.  Do you mean you just
> want to do something like:
>
> MyUpperClass *upperClass = [[MyUpperClass alloc] init];
> [upperClass function:someVariable];
>
> ??
>
> - --
> Conrad Shultz
>
> Synthetiq Solutions
> www.synthetiqsolutions.com
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iD8DBQFNre4WaOlrz5+0JdURApttAKCKIifHWsYZNAPkjb6kxhwoHY5JBACggSPh
> OmZ/cESJXSqxfpgLi5j+gtY=
> =ZLvW
> -END PGP 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


NSArrayController & image in column

2011-04-19 Thread Todd Heberlein
I want to have an NSTableView controlled by an NSArrayController using an 
NSArray data source. In one of the columns I want to display one of several 
images. The choice of image will be based on an integer value in one of the 
fields of the array.

What is the best or most recommended way to do this?


Should I add to my NSArray object a field for an NSImage field (with 
getter/setter) and automatically load the image into the NSArray object, and 
then use that the getter for the NSImage as the key in the NSArrayController?

Should I subclass NSTableColumn and override
-dataCellForRow:?

Should I use a delegate for the NSTableView and override
-tableView:dataCellForTableColumn:row:?

Can I even use a custom NSTableColumn or NSTableView delegate with a table 
controlled by an NSArrayController?

Thanks,

Todd

___

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

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

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

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


Re: NSArrayController & image in column

2011-04-19 Thread Dave DeLong
You could use a custom NSValueTransformer.

Subclass NSValueTransformer and have the -transformValue accept one of the 
objects from your NSArray, and then uses that object to return the appropriate 
NSImage.  Then when you're setting up your bindings, simply type in the name of 
your NSValueTransformer in the "Value Transformer" field.

Dave

On Apr 19, 2011, at 2:26 PM, Todd Heberlein wrote:

> I want to have an NSTableView controlled by an NSArrayController using an 
> NSArray data source. In one of the columns I want to display one of several 
> images. The choice of image will be based on an integer value in one of the 
> fields of the array.
> 
> What is the best or most recommended way to do this?
> 
> 
> Should I add to my NSArray object a field for an NSImage field (with 
> getter/setter) and automatically load the image into the NSArray object, and 
> then use that the getter for the NSImage as the key in the NSArrayController?
> 
> Should I subclass NSTableColumn and override
>   -dataCellForRow:?
> 
> Should I use a delegate for the NSTableView and override
>   -tableView:dataCellForTableColumn:row:?
> 
> Can I even use a custom NSTableColumn or NSTableView delegate with a table 
> controlled by an NSArrayController?
> 
> Thanks,
> 
> Todd
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
> 
> This email sent to davedel...@me.com

___

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

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

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

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


Re: How call upper layer function

2011-04-19 Thread Michael Dautermann

On Apr 19, 2011, at 4:50 PM, Rodrigo Zanatta Silva wrote:

> Lol, sorry for making your life hard :P
> 
> let's write better. (Will be a problem in your computer with this font in
> e-mail? )

I don't believe fonts/styles make it through onto the mailing list.  At least I 
didn't see any special font in your message.

> //This is LevelUp.h
> #import "LeveDown.h"
> @interface LevelUp : NSObject  {
> }
> -(void) init;
> -(void)wantCallThisFunction
> @end

How is LevelUp instantiated?  Is it part of the XIB that also contains 
LevelDown?  

If so, you could declare "IBOutlet id levelUpObject" in your LevelDown view and 
connect it to LevelUp.

If LevelUp and LevelDown are not part of the same XIB or LevelUp isn't 
instantiated by something else accessible to LevelDown (e.g. the application 
delegate or some controller), then notifications may be the best way to go.


___

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

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

2011-04-19 Thread Quincey Morris
On Apr 19, 2011, at 14:26, Todd Heberlein wrote:

> I want to have an NSTableView controlled by an NSArrayController using an 
> NSArray data source. In one of the columns I want to display one of several 
> images. The choice of image will be based on an integer value in one of the 
> fields of the array.

"one of the fields of the array"?? Do you mean a property of the objects in the 
array?

> Should I add to my NSArray object a field for an NSImage field (with 
> getter/setter) and automatically load the image into the NSArray object, and 
> then use that the getter for the NSImage as the key in the NSArrayController?

Well, yes, you could, but your terminology sucks. :)

You can add a property to the class of the objects in your array which returns 
the appropriate NSImage. In IB, drag a NSImageCell into the column that is 
going to be displaying images, and bind the table column via the array 
controller's arrangedObject  to the array property that produces the NSImage.

Note that you're adding a read-only property, not a "field (with 
getter/setter)" (and you're *not* adding an instance variable, if that's what 
you meant).

Note that you're not going to "load the image into the NSArray object" -- 
you're going to make the image a property value of the NSArray object. I think 
that's what you meant. There's no real sense in which the images will be "in" 
the objects in the array.

Note that "the getter" isn't "the key in the NSArrayController". The array 
controller doesn't care about that part of the table column's key path. It's 
only responsible for providing the object that represents the row. The "key" is 
a property name in that object.

Dave already suggested an alternative, if you don't want to pollute the objects 
in the array with a UI-specific property.

Another alternative (and a slightly better one, I'd suggest, since it's more 
direct) is to provide the NSImage* directly via a data source. It works fine to 
use a data source for some columns but bindings for others.

> Should I subclass NSTableColumn and override
>   -dataCellForRow:?

No need.

> Should I use a delegate for the NSTableView and override
>   -tableView:dataCellForTableColumn:row:?

No need.

> Can I even use a custom NSTableColumn or NSTableView delegate with a table 
> controlled by an NSArrayController?

No need.

These things would only be needed if you needed a different cell based on the 
row.


___

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

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

2011-04-19 Thread Dave DeLong

On Apr 19, 2011, at 3:06 PM, Quincey Morris wrote:

> On Apr 19, 2011, at 14:26, Todd Heberlein wrote:
> 
> ...
> Another alternative (and a slightly better one, I'd suggest, since it's more 
> direct) is to provide the NSImage* directly via a data source. It works fine 
> to use a data source for some columns but bindings for others.
> ...

Or just add a method on your data object that vends the appropriate image based 
on its own properties, and then just bind to that method name as the Model Key 
Path.  (this is much simpler than the value transformer)

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: How call upper layer function

2011-04-19 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

(Sorry, putting back on list after accidental private reply.)

On 4/19/11 1:50 PM, Rodrigo Zanatta Silva wrote:
>> Lol, sorry for making your life hard :P
>> 
>> let's write better. (Will be a problem in your computer with this
>> font in e-mail? )

Works just fine, though my responses will be in plain text.

As evidenced by comments below I assume that this is NOT the actual code
you are trying.  In general, you want to copy and paste your code
directly; failing to do so can inadvertently introduce bugs (or even fix
them) in what you send to the list.

>> //This is LevelUp.h #import "LeveDown.h"

Typo here.

>> @interface LevelUp : NSObject  { } -(void) init;

You are declaring a method implemented by a superclass (NSObject), which
is unnecessary and confusing.  Worse, you have changed the return type
from id to void.  I don't know how the compiler is going to handle this,
but it's not going to behave as you expect.

>> -(void)wantCallThisFunction @end
>> 
>> //This is LevelUp.m @implement LevelUp

I think you meant @implementation.

>> -(void) init { LevelDown *test = [[LevelDown alloc] init]; }

You are throwing away this object and introducing a memory leak in the
process.  If you want to save a reference to the LevelDown instance, you
needed to declare an appropriate instance variable in your interface and
set its value in init.  Don't forget to release it in dealloc, too.

>> 
>> -(void)wantCallThisFunction { ///Do something } @end
>> 
>> // //  levelDown.h @interface LevelDown
>> : UIView { //Some class -(void) init; -(void)keyboardWillShow;

See comments above regarding re-declaring super's methods.

>> } @end
>> 
>> //LevelDown.m @implement

Again, @implementation.

>> -(void) init {};

What is this supposed to do?  I'm uncertain whether this is going to
cause things to crash and burn since you are overriding the hugely
important init method but changing the return type, but I'm quite
certain this is wrong regardless.

>> -(void)keyboardWillShow { //iOS automatic call this function //I
>> need to call wantCallThisFunction }

What does this _mean_?  You need to have an instance of a class in order
to call its instance methods.  Are you saying that you have elsewhere
instantiated a LevelUp instance that is disconnected from the LevelDown
instance?

If you really mean that there is a LevelUp instance logically coupled to
the LevelDown instance, you need to retain a reference to the LevelUp
instance in the LevelDown instance, e.g.

@interface LevelDown : NSObject {
LevelUp *relatedUpLevel;
}

- - (void)setRelatedUpLevel:(LevelUp *)upLevel;

@end

After having externally called setRelatedUpLevel (and having managed
memory appropriately in setRelatedUpLevel, an exercise left to the
reader or to @property/@synthesize), you could then call from within
keyboardWillShow:

[relatedUpLevel wantCallThisFunction];


>> Like I say, if I use this line in keyboardWillShow function : 
>> [[NSNotificationCenter defaultCenter]
>> postNotificationName:@"thisWork" object:nil];
>> 
>> And to catch this call, in function init of LevelUp class , I have
>> to use this line [[NSNotificationCenter defaultCenter]
>> addObserver:self selector:@selector(wantCallThisFunction)
>> name:@"thisWork" object:nil];
>> 
>> So the question is: there are another way to do that?
>> 
>> Now I am thinking that I have to remake the program and use a
>> third object that create instances of LevelUp and LevelDown in the
>> same object. Am I correct, or there are another way? I'm not
>> remembering if java have problem like that.

If you are not "broadcasting" to multiple possible instances (which is
really what you would use NSNotificationCenter for), the pattern that
you probably want to look at is delegation.

Read more about common Objective-C design patterns at
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html


Quite honestly, though, I would STRONGLY recommend starting with an
introductory book (I like Hillegass for OS X, LaMarche for iOS) and
working through it from the beginning.  You are not going to have a fun
or productive time just jumping into the documentation.

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFNrgrNaOlrz5+0JdURAolEAJ0eXxsSlMelLOAKN11uWcJpI91mIwCeJx8a
p+TMA+cw+08t2H7wwmD/20M=
=k7lE
-END PGP 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: How call upper layer function

2011-04-19 Thread Quincey Morris
On Apr 19, 2011, at 15:03, Michael Dautermann wrote:

> How is LevelUp instantiated?  Is it part of the XIB that also contains 
> LevelDown?  
> 
> If so, you could declare "IBOutlet id levelUpObject" in your LevelDown view 
> and connect it to LevelUp.
> 
> If LevelUp and LevelDown are not part of the same XIB or LevelUp isn't 
> instantiated by something else accessible to LevelDown (e.g. the application 
> delegate or some controller), then notifications may be the best way to go.

Er, let's not go off the rails here. The OP simply wants a LevelDown object to 
send a message to a LevelUp object. That requires levelDown to have a reference 
to levelUp, one simple way to do that is to give it the reference:

LevelDown *test = [[LevelDown alloc] initWithLevelUp: self];

However, the real problem is one of these:

-- The OP isn't sufficiently knowledgeable of Objective-C to customize 
initializers like this yet.

-- The OP hasn't considered the communication between LevelDown and LevelUp as 
the design problem it really is.

-- The OP isn't familiar enough with Cocoa design patterns to consider the 
various alternative designs. 

It's possible that the correct answer is that the LevelUp pointer should be a 
global variable, or that it should be held by the application delegate, or that 
the LevelDown really should keep a reference to the LevelUp as an instance 
variable whose value is passed in the initializer. But we don't know, because 
the question is too vague.___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: ArrayController vs Pop-up button vs Transformer -- three way tag team death match!

2011-04-19 Thread Ben Golding

On 20/04/2011, at 01:09, Kyle Sluder wrote:

> On Apr 19, 2011, at 6:20 AM, Ben Golding  wrote:
> 
>> 
>> Sure, I'm using content to bind to an array controller bound to an array of 
>> pop-up button titles and selected index (though I'm picking up the selected 
>> object using [[arrayControlled selectedObjects] objectAtIndex:0]).
>> 
>> I've also tried binding to contentValues which was unsuccessful too.
> 
> It might help to be a bit more precise. Enumerate all the configured bindings 
> on your popup button. I like to use a syntax like this:
> 
> popupButton.content --(CapitalizeTransformer)--> 
> [arrayController].arrangedObjects

I should have been more specific.  What I have looks like:

popupButton.content -(Transformer)-> [arrayController].arrangedObjects
popupButton.selectedIndex --> [arrayController].selectionIndex

I have also tried:

popupButton.contentValues -(Transformer)-> [arrayController].arrangedObjects
popupButton.selectedIndex --> [arrayController].selectionIndex

In both cases, the transformer is passed an _NSControllerArrayProxy object 
which wasn't what I was hoping for; I had hoped for an NSString.  I could 
probably dredge around in that object and find some methods to use but all the 
docs say "don't use undocumented methods/classes" so my gut reaction is to try 
another way.

Ben.

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: renaming directories and moving files into them (NSFileManager)

2011-04-19 Thread Scott Anguish
I’ve since abandoned this approach.
> 
> 
> * Did you see my previous question? It looked like your logic would result in 
> directories xxx-APPL, xxx-APPL-APPL, xxx-APPL-APPL-APPL, etc. -- or was I 
> mistaken? If there is code elsewhere that is resetting shootPath to not have 
> the APPL suffix, could you be inadvertently recreating the old directory? 
> What if you put an NSLog after every line of code that does a mkdir, to make 
> sure directories only get created once? Are you sure it's the mp4 files you 
> copy *after* renaming the directory that get put in the new directory?
> 

I was checking for the directory existing, if it did, it didn’t make a new 
version.

> * What if you put a breakpoint on the call to moveItemAtPath:toPath:error: 
> and step over it? Do you see in the Finder that there is one directory before 
> the call and two directories afterward? If so, there's your smoking gun that 
> there's a bug in the method. If you see only one directory (with the new 
> name), that would suggest that moveItemAtPath:toPath:error: is doing its job 
> as expected and something else is recreating the old directory.
> 
as I said, code is gone.

> * What if you don't use NSFileManager to rename the directory, but 
> rename([shootPath UTF8String], [newShootPath UTF8String])?
> 
> * To use the simplest dataset possible: what if you hardcode it to copy two 
> specific mp4 files, where the second triggers the directory rename? Does this 
> reproduce the bug?
> 
> * What if you comment out the code that copies the mp4 files -- do you still 
> get two directories (which are now empty instead of containing copies of the 
> files)?
> 
> * Are you using copyItemAtPath:toPath:error: like I did, or something else to 
> copy the files?
> 

no. I wasn’t attempting to copy files, simply move them.

But while I appreciate the help... at this point I simply moved on looked at 
another solution that I wasn’t fond of, but did the job and worked around it.

thanks!

Scott


> --Andy
> 
> On Apr 17, 2011, at 10:41 PM, Scott Anguish wrote:
> 
>> not sure what to say, my code wasn’t doing that.
>> 
>> I ended up churning through all the files once, finding the .mp4s, getting 
>> the whereas information and then making the directory I needed first.
>> 
>> I just didn’t have more time to spend trying to figure it out.
>> 
>> Now I feel like I need to though... :-/
>> 
>> that it was ‘making’ a new directory with -APPL at the end was the oddest 
>> part. rather than moving it.
>> 
>> On Apr 17, 2011, at 1:59 AM, Andy Lee wrote:
>> 
>>> I tried to reproduce your problem by creating directories ~/wtf/FromHere 
>>> and ~/wtf/ToHere, with three files in FromHere named 1, 2, and 3. I switch 
>>> over to using "ToHere-NEW" when it detects a file whose name is >= "2".
>>> 
>>> My test code renamed the directory and switched over to it just fine:
>>> 
>>> - (void)test
>>> {
>>>  NSFileManager *fileManager = [NSFileManager defaultManager];
>>>  NSString *fromDir = [@"~/wtf/FromHere" stringByStandardizingPath];
>>>  NSString *originalToDir = [@"~/wtf/ToHere" stringByStandardizingPath];
>>>  NSString *toDir = originalToDir;
>>>  NSError *error = nil;
>>>  NSArray *filesToCopy = [[fileManager contentsOfDirectoryAtPath:fromDir 
>>> error:&error]
>>>  
>>> sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
>>> 
>>>  for (NSString *fileName in filesToCopy)
>>>  {
>>>  // Rename the destination directory if necessary.
>>>  if ([fileName intValue] >= 2)
>>>  {
>>>  NSLog(@"File name is %@; will rename directory if necessary.", 
>>> fileName);
>>> 
>>>  NSString *newToDir = [originalToDir 
>>> stringByAppendingString:@"-NEW"];
>>> 
>>>  if (![fileManager fileExistsAtPath:newToDir])
>>>  {
>>>  if ([fileManager moveItemAtPath:toDir toPath:newToDir 
>>> error:&error])
>>>  {
>>>  NSLog(@"...SUCCESS: Renamed %@ to %@.", toDir, newToDir);
>>>  }
>>>  else
>>>  {
>>>  NSLog(@"...ERROR: Failed to rename %@ to %@ -- %@.", 
>>> toDir, newToDir, error);
>>>  abort();
>>>  }
>>> 
>>>  toDir = newToDir;
>>>  }
>>>  else
>>>  {
>>>  NSLog(@"...%@ already exists; no need to rename.", newToDir);
>>>  }
>>>  }
>>> 
>>>  // Move the file to the directory at shootPath.
>>>  NSString *oldFilePath = [fromDir 
>>> stringByAppendingPathComponent:fileName];
>>>  NSString *newFilePath = [toDir 
>>> stringByAppendingPathComponent:fileName];
>>> 
>>>  if ([fileManager copyItemAtPath:oldFilePath toPath:newFilePath 
>>> error:&error])
>>>  {
>>>  NSLog(@"Copied file %@ to %@.", oldFilePath, newFilePath);
>>>  }
>>>  else
>>>  {
>>>  NSLog(@"...ERROR: Failed to copy %@ to %@ -- %@.", oldFilePath, 
>>> newFi

Re: NSArrayController & image in column

2011-04-19 Thread Todd Heberlein

On Apr 19, 2011, at 3:09 PM, Dave DeLong wrote:

> Or just add a method on your data object that vends the appropriate image 
> based on its own properties, and then just bind to that method name as the 
> Model Key Path.  (this is much simpler than the value transformer)

For an experiment I have implemented two columns, one doing it each way. Right 
now I'm just showing a green circle for even numbers and a red circle for odd 
numbers.

Both work, but for some reason the circle images using the transformer don't 
quite look right, like they are duller or something. Maybe a reduced opacity. 
But I am returning a pointer to the same image. Weird.

Any idea why a column with a transformer has duller images?


On a different (but maybe related) note, in MyController +initialize is getting 
called twice even though I have one instance of MyController. This is where I 
register my transformer.

Any idea why +initialize is being called twice?


Thanks,

Todd

___

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

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

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

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


Re: NSArrayController & image in column

2011-04-19 Thread Quincey Morris
On Apr 19, 2011, at 20:57, Todd Heberlein wrote:

> Both work, but for some reason the circle images using the transformer don't 
> quite look right, like they are duller or something. Maybe a reduced opacity. 
> But I am returning a pointer to the same image. Weird.
> 
> Any idea why a column with a transformer has duller images?

If it's significantly duller, that probably means it's being shown as disabled.

> On a different (but maybe related) note, in MyController +initialize is 
> getting called twice even though I have one instance of MyController. This is 
> where I register my transformer.
> 
> Any idea why +initialize is being called twice?

It's called once per class. If MyController is a subclass, it's called once for 
the subclass and once for the superclass, but if one of the classes doesn't 
implement it, the other gets called twice. The +initialize method must be coded 
to expect this. See:


http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html

IAC, registering transformers isn't normally necessary any more, provided the 
transformer name is the same as its class name:


http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSValueTransformer_Class/Reference/Reference.html


___

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

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

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

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


Re: ArrayController vs Pop-up button vs Transformer -- three way tag team death match!

2011-04-19 Thread Ken Thomases
On Apr 19, 2011, at 8:46 PM, Ben Golding wrote:

> I should have been more specific.  What I have looks like:
> 
> popupButton.content -(Transformer)-> [arrayController].arrangedObjects
> popupButton.selectedIndex --> [arrayController].selectionIndex
> 
> I have also tried:
> 
> popupButton.contentValues -(Transformer)-> [arrayController].arrangedObjects
> popupButton.selectedIndex --> [arrayController].selectionIndex

You can't bind contentValues without also binding content, and contentValues 
should be bound to something "within" the content binding.  (That is, the 
binding should be the same as for content except perhaps with additional 
elements to its model key path.)

> In both cases, the transformer is passed an _NSControllerArrayProxy object 
> which wasn't what I was hoping for; I had hoped for an NSString.  I could 
> probably dredge around in that object and find some methods to use but all 
> the docs say "don't use undocumented methods/classes" so my gut reaction is 
> to try another way.

Have you tried setting a model key path?  How about "description"?

People often try binding, via array controllers, to arrays of values, and then 
want those values represented in the view.  It is my experience that bindings 
work better with arrays of objects, with a property of each object to be 
represented in the view.

In other words, an array of strings is often problematic, whereas an array of, 
for example, People objects, which have a "name" property which is a string, 
works better.

You can pretend the former case is more like the latter by using a model key 
path like "description" or even "self", although the latter case still tends to 
be more amenable to bindings.

Regards,
Ken

___

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

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

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

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