Re: NSOpenPanel Exception/Bug

2009-07-29 Thread Seth Willits


On Jul 28, 2009, at 9:56 PM, Andy Lee wrote:


On Jul 28, 2009, at 7:54 PM, Seth Willits wrote:
It works its way down to the last if statement which launches /usr/ 
bin/file to figure out the type of the file. It's all straight  
forward simple code, which simply returns YES or NO, but it's  
causing an exception apparently, and I don't see how I could do  
anything different.


Offhand it all looks pretty innocuous to me, but regarding that last  
part -- is fileTypeForFileAtPath: a category method you added?  If  
so, can you show the code?



Yes. It just fires off a task.


- (NSString *)fileTypeForFileAtPath:(NSString *)filePath;
{
NSPipe * pipe = [[NSPipe alloc] init];
NSTask * task = [[NSTask alloc] init];
NSString * result;
NSData * data;


[task setLaunchPath:@/usr/bin/file];
[task setArguments:[NSArray arrayWithObjects:@-b, filePath, nil]];
[task setStandardOutput:pipe];
[task launch];
[task waitUntilExit];

if ([task terminationStatus] != 0) {
result = nil;
goto bail;
}

data = [[pipe fileHandleForReading] availableData];
if (data == nil) {
result = nil;
goto bail;
}

	result = [[[NSString alloc] initWithData:data  
encoding:NSUTF8StringEncoding] autorelease];


bail:
[pipe release];
[task release];
return result;
}



I'd file a bug report on the exception being thrown, but heck if I can  
reproduce it.



--
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: NSOpenPanel Exception/Bug

2009-07-29 Thread Andy Lee

On Jul 29, 2009, at 2:12 AM, Seth Willits wrote:

Yes. It just fires off a task.

[...]
I'd file a bug report on the exception being thrown, but heck if I  
can reproduce it.


From your stack trace, it looks like the save panel is trying to  
display more rows than a particular column actually has -- i.e.,  
somebody is wrong about how many files are in some directory.  Are you  
doing anything that adds and removes a lot of files in the directory  
you navigate to?  If there is an NSOpenPanel bug, could it be  
surfacing because your call to /usr/bin/file is slowing the panel's  
display down enough for the file-count discrepancy to trip it up?


Just a wild guess in the hopes of helping reproduce the problem.

--Andy

___

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

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

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

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


NSOutlineView column sizing problems

2009-07-29 Thread Rob Keniger

Hi all,

I have an NSOutlineView with three columns. I want the first column to  
resize but I want to keep the last two columns at a fixed size.


For the last two columns, I have set the min/max constraints to the  
same width and I have unchecked Resizes with table and User  
resizable.


The left hand column has Resizes with table and User resizable  
checked and the Outline View itself has Autoresizes Outline Column  
checked, Column Sizing set to First Column Only.


The enclosing scroll view has Show Horizontal Scroller, Show  
Vertical Scroller and Automatically hides scrollers checked.


What I expect to happen is that if I enter some text in the leftmost  
column that is wider than the view, the column should be resized to  
hold the text and the horizontal scrollbar should appear.


However, no matter what I do this does not happen. The horizontal  
scroller never appears and the leftmost column stays the same size.


What do I have to do to achieve this behavior?

--
Rob Keniger



___

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

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

2009-07-29 Thread Kyle Sluder

On Jul 29, 2009, at 12:38 AM, Rob Keniger r...@menumachine.com wrote:

What I expect to happen is that if I enter some text in the leftmost  
column that is wider than the view, the column should be resized to  
hold the text and the horizontal scrollbar should appear.


That's not what automatic column resizing means. Automatic column  
resizing happens when the scroll view's frame changes.



What do I have to do to achieve this behavior?


You will need to somehow autosize your field editor and column in  
response to the changing text.


--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: Cahnging bgColor of a UIView not working.

2009-07-29 Thread Gustavo Pizano
Hello, well I found the reason of the exception. But still they color  
its not being changed if I put  [UIColor blueColor] then it works,  
but it doesn't work with RGB doing [[UIColor alloc] initWithRed .. ]
I tried also [UIColor colorWithCGColor:CGColorCreateGenericRBG()];  
but the compiler just decided to send error that  the method  
CGColorCreateGenericRGB its unreachable, even I have the CoreGraphics  
library in the project and im importing in in the file... dunno what  
to do.. I need to be very accurate with the color that im setting, I  
know the values in rgb but  why is not working?



Thnaks
Gustavo Pizano



On Jul 29, 2009, at 11:29 AM, Gustavo Pizano wrote:


Hello.

Im trying to change the color of a UIView programatically but  
something is wrong.



Im pressing a button which triggers an IBAction, which does the  
following:


[[self view] setBackgroundColor:[UIColor colorWithRed:20.0 green: 
10.0 blue: 30.0 alpha:1.0]];


but when I press the button the program blows with an  
NSInvalidArgumentException..


what am I doing wrong?


thanks

Gustavo Pizano





___

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

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

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

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


Re: Cahnging bgColor of a UIView not working.

2009-07-29 Thread Brandon Walkin
The arguments to that UIColor method should be in the range of 0 to 1.  
Divide each RGB value by 255 to get them into that range.



On 2009-07-29, at 6:34 AM, Gustavo Pizano wrote:

Hello, well I found the reason of the exception. But still they  
color its not being changed if I put  [UIColor blueColor] then  
it works, but it doesn't work with RGB doing [[UIColor alloc]  
initWithRed .. ]
I tried also [UIColor colorWithCGColor:CGColorCreateGenericRBG 
()]; but the compiler just decided to send error that  the  
method CGColorCreateGenericRGB its unreachable, even I have the  
CoreGraphics library in the project and im importing in in the  
file... dunno what to do.. I need to be very accurate with the color  
that im setting, I know the values in rgb but  why is not working?



Thnaks
Gustavo Pizano



On Jul 29, 2009, at 11:29 AM, Gustavo Pizano wrote:


Hello.

Im trying to change the color of a UIView programatically but  
something is wrong.



Im pressing a button which triggers an IBAction, which does the  
following:


[[self view] setBackgroundColor:[UIColor colorWithRed:20.0 green: 
10.0 blue: 30.0 alpha:1.0]];


but when I press the button the program blows with an  
NSInvalidArgumentException..


what am I doing wrong?


thanks

Gustavo Pizano





___

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

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

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

This email sent to bwal...@gmail.com


___

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

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

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

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


Re: Cahnging bgColor of a UIView not working.

2009-07-29 Thread Gustavo Pizano

OOO how could I forget that... grrr..


thanks !

:D
On Jul 29, 2009, at 1:52 PM, Brandon Walkin wrote:

The arguments to that UIColor method should be in the range of 0 to  
1. Divide each RGB value by 255 to get them into that range.



On 2009-07-29, at 6:34 AM, Gustavo Pizano wrote:

Hello, well I found the reason of the exception. But still they  
color its not being changed if I put  [UIColor blueColor] then  
it works, but it doesn't work with RGB doing [[UIColor alloc]  
initWithRed .. ]
I tried also [UIColor  
colorWithCGColor:CGColorCreateGenericRBG()]; but the compiler  
just decided to send error that  the method CGColorCreateGenericRGB  
its unreachable, even I have the CoreGraphics library in the  
project and im importing in in the file... dunno what to do.. I  
need to be very accurate with the color that im setting, I know the  
values in rgb but  why is not working?



Thnaks
Gustavo Pizano



On Jul 29, 2009, at 11:29 AM, Gustavo Pizano wrote:


Hello.

Im trying to change the color of a UIView programatically but  
something is wrong.



Im pressing a button which triggers an IBAction, which does the  
following:


[[self view] setBackgroundColor:[UIColor colorWithRed:20.0 green: 
10.0 blue: 30.0 alpha:1.0]];


but when I press the button the program blows with an  
NSInvalidArgumentException..


what am I doing wrong?


thanks

Gustavo Pizano





___

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

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

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

This email sent to bwal...@gmail.com




___

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

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

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

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


NSArrayController and avoidsEmptySelection

2009-07-29 Thread Carmen Cerino Jr.
I have an NSArrayController hooked up to an NSCollectionView. When a
user clicks into the empty space of the NSCollectionView, I would like
it so they do not lose their currently selected items. I would have
thought it should have been as simple as telling the NSArrayController
to avoid empty selections. However, I do not get the desired result
when this property is set.  Is there something else that needs to be
setup in order for this to work as expected or is my assumption about
what that property is suppose to do completely wrong?

In order to temporarily achieve the desired effect, I ended up
subclasing NSArrayController and overriding the setSelectionIndexes:
method to ignore index sets with a count of 0. However, this seems
more like a work around than a solution.

Cheers,
Carmen
___

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

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

2009-07-29 Thread Adam R. Maxwell


On Jul 28, 2009, at 11:24 PM, Kyle Sluder wrote:

On Jul 28, 2009, at 11:12 PM, Seth Willits sli...@araelium.com  
wrote:



Yes. It just fires off a task.


Is there a particular reason you're doing this instead of using UTIs?


LaunchServices only look at certain tags to determine a UTI, and the  
extension trumps everything else.  There are numerous problems with  
that, so I'd guess he's using /usr/bin/file to sniff content.



  [task waitUntilExit];


Doing this while displaying an open panel might not be a good idea,  
especially if it's waiting on the current runloop to fetch some  
information. Like perhaps network volumes shown in the sidebar.


I think you're right on here (although I think it would still be an  
NSOpenPanel bug).  I'd try doing the equivalent of waitUntilExit using  
a different runloop mode:


while ([task isRunning]) {
NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceNow:0.1];
[[NSRunLoop currentRunLoop] runMode:@SomePrivateMode beforeDate:date
[date release];
}




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: NSArrayController and avoidsEmptySelection

2009-07-29 Thread I. Savant

On Jul 29, 2009, at 8:19 AM, Carmen Cerino Jr. wrote:


I have an NSArrayController hooked up to an NSCollectionView. When a
user clicks into the empty space of the NSCollectionView, I would like
it so they do not lose their currently selected items. I would have
thought it should have been as simple as telling the NSArrayController
to avoid empty selections. However, I do not get the desired result
when this property is set.  Is there something else that needs to be
setup in order for this to work as expected or is my assumption about
what that property is suppose to do completely wrong?


  I would file this as a bug. NSCollectionView and NSArrayController  
should work the same as NSTableView and NSArrayController in this  
regard.




In order to temporarily achieve the desired effect, I ended up
subclasing NSArrayController and overriding the setSelectionIndexes:
method to ignore index sets with a count of 0. However, this seems
more like a work around than a solution.



  Since it's broken, the only way to ensure this works properly in  
Leopard is to implement a work-around. I don't see any problem with  
yours. It's what I would probably end up doing.


  One caveat in case it hadn't occurred to you (you didn't say): I  
would only implement this logic if there is at least one object in the  
array controller's contents.


--
I.S.


___

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

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

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

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


Re: something I can't understand

2009-07-29 Thread Dragos Ionel
verticalLoc and x are readonly values, you cannot assign them.

use the frame property, first to retrieve it, change the x value and then to
reassign to the button.

something like

CGFrame frame = pPngButton.frame;
frame.x = ...;
pPngButton.frame = frame;

Dragos


On Wed, Jul 29, 2009 at 3:24 AM, Agha Khan agha.k...@me.com wrote:

 Hi:
 Thank you for your reply.
 Oh yes. It an Objective-C class.

 regardless I place (bVerticalDisplay == YES) or not. The function silently
 fails, with no warnings.
 The I decided to
  pPngButton.verticalLoc.x = (bVerticalDisplay == YES) ? 250 : 410;
 This time I got warning.

 error: lvalue required as left operand of assignment

 Many thanks

 -Agha




 On Jul 28, 2009, at 7:59 PM, Kiel Gillard wrote:

  On 29/07/2009, at 12:52 PM, Agha Khan wrote:

  Hi:
 I have a struct
 @interface PngButton : UIButton
 {
 @public
bool OffPos;
CGPoint horizontalLoc;
CGPoint verticalLoc;
 }
 @property (assign) bool OffPos;
 @property (assign) CGPoint horizontalLoc;
 @property (assign) CGPoint verticalLoc;
 @end


 No, you have an Objective-C class.

  PngButton* pPngButton   = [PngButton
 buttonWithType:UIButtonTypeInfoDark];
 [pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0, 36,
 36)]; // No problem

 pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ? 250 :
 410, 50.0);

 I get an error
 error: lvalue required as left operand of assignment

 Why it is not working? I shouldn't get this error.
 Any help will be very much appreciated.


 Do you get any warnings?

 Try this and see what happens:
 pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES ? 250.0 :
 410.0), 50.0);

 Kiel


 ___

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

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

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

 This email sent to dragosio...@gmail.com

___

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

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

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

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


rvalue vs lvalue (was Re: something I can't understand)

2009-07-29 Thread glenn andreas


On Jul 29, 2009, at 8:35 AM, Dragos Ionel wrote:


On Wed, Jul 29, 2009 at 3:24 AM, Agha Khan agha.k...@me.com wrote:

On Jul 28, 2009, at 7:59 PM, Kiel Gillard wrote:

On 29/07/2009, at 12:52 PM, Agha Khan wrote:


Hi:

I have a struct
@interface PngButton : UIButton
{
@public
  bool OffPos;
  CGPoint horizontalLoc;
  CGPoint verticalLoc;
}
@property (assign) bool OffPos;
@property (assign) CGPoint horizontalLoc;
@property (assign) CGPoint verticalLoc;
@end



No, you have an Objective-C class.

PngButton* pPngButton   = [PngButton

buttonWithType:UIButtonTypeInfoDark];
[pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0,  
50.0, 36,

36)]; // No problem

pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay ==  
YES) ? 250 :

410, 50.0);

I get an error
error: lvalue required as left operand of assignment

Why it is not working? I shouldn't get this error.
Any help will be very much appreciated.



Do you get any warnings?

Try this and see what happens:
pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES ?  
250.0 :

410.0), 50.0);

Kiel




Hi:
Thank you for your reply.
Oh yes. It an Objective-C class.

regardless I place (bVerticalDisplay == YES) or not. The function  
silently

fails, with no warnings.
The I decided to
pPngButton.verticalLoc.x = (bVerticalDisplay == YES) ? 250 : 410;
This time I got warning.

error: lvalue required as left operand of assignment

Many thanks

-Agha




verticalLoc and x are readonly values, you cannot assign them.

use the frame property, first to retrieve it, change the x value and  
then to

reassign to the button.

something like

CGFrame frame = pPngButton.frame;
frame.x = ...;
pPngButton.frame = frame;

Dragos




No, that isn't correct at all - he's declared verticalLoc as a  
property that is perfectly valid to set (though, since this is the  
iPhone, should be declared as nonatomic as well)


The problem is that the (simplified) code:

pPngButton.verticalLoc.x = 410;

is equivalent to writing:

[pPngButton verticalLoc].x = 410;

since pPngButton.verticalLoc is used as a getter in this case (since  
your code then accesses the x field of the result).


This would be similar to:

CGPointMake(100,200).x = 410;

i.e., you call a function (which returns a CGPoint  value) and then  
you try to set one of the fields of the CGPoint value (which is then  
thrown away).


Things like structures returned from a function, or scalar values,  
pointers, etc... are referred to as r-values, meaning they are  
values that appear on the right hand side of an assignment - they  
aren't stored in meaningful locations in memory, they just have a  
value but not storage.  Variables (or memory locations) that can  
appear on the left hand side of an assignment are called l-values -  
they are values, but they also are stored somewhere and can have their  
values changed.


So what you'd need to do is:

CGPoint pt = pPngButton.verticalLoc;
pt.x = (bVerticalDisplay == YES) ? 250 : 410;
pPngButton.verticalLoc = pt.x;



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

___

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

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

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

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


Re: rvalue vs lvalue (was Re: something I can't understand)

2009-07-29 Thread WT

On Jul 29, 2009, at 4:12 PM, glenn andreas wrote:


On Jul 29, 2009, at 8:35 AM, Dragos Ionel wrote:


verticalLoc and x are readonly values, you cannot assign them.

use the frame property, first to retrieve it, change the x value  
and then to

reassign to the button.

something like

CGFrame frame = pPngButton.frame;
frame.x = ...;
pPngButton.frame = frame;

Dragos




No, that isn't correct at all - he's declared verticalLoc as a  
property that is perfectly valid to set (though, since this is the  
iPhone, should be declared as nonatomic as well)

...


Not only that, but also there is no such thing as a CGFrame (it must  
be CGRect) and no such thing as frame.x (it must be frame.origin.x),  
if frame is a CGRect.


Wagner

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSWindow reference remains null after window did load (SOLVED)

2009-07-29 Thread Daniel Child
No, the syntax was right. The problem mysteriously disappeared when I  
altered the timing of the method to redraw the table, including the  
time data is loaded. Thanks for your suggestions.


On Jul 28, 2009, at 8:38 PM, Andy Lee wrote:

Just to be sure -- your method is numberOfRowsInTableView:, not  
numberOfRowsInTableView, right?  You mentioned you'd tried copying  
working method declarations, so I suspect that's not the problem,  
but I figured I'd double-check just in case *you* were calling it  
somewhere you'd forgotten about and it wasn't the table view that  
was calling it.


There was a similar mystery within the past few months, with very  
similar impossible symptoms.  I believe the solution was a missing  
call to reloadData.  But this doesn't sound like your problem,  
because if numberOfRowsInTableView: returns 17, then the value- 
getter method should have gotten called 17 times for each column.


___

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

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

2009-07-29 Thread David Duncan

On Jul 29, 2009, at 4:52 AM, Brandon Walkin wrote:

The arguments to that UIColor method should be in the range of 0 to  
1. Divide each RGB value by 255 to get them into that range.



This is more of a PSA than anything (because I've seen more than a  
fair share of devs slap themselves on the head here too): Always  
ensure your using floating point division if your going to do this.  
That means always dividing by 255.0. I've seen too many people asking  
why do I always get black and pointed out because you forgot the . 
0 :).

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: Cahnging bgColor of a UIView not working.

2009-07-29 Thread Brian Slick

On Jul 29, 2009, at 12:56 PM, David Duncan wrote:


On Jul 29, 2009, at 4:52 AM, Brandon Walkin wrote:

The arguments to that UIColor method should be in the range of 0 to  
1. Divide each RGB value by 255 to get them into that range.



This is more of a PSA than anything (because I've seen more than a  
fair share of devs slap themselves on the head here too): Always  
ensure your using floating point division if your going to do this.  
That means always dividing by 255.0. I've seen too many people  
asking why do I always get black and pointed out because you  
forgot the .0 :).

--
David Duncan
Apple DTS Animation and Printing


*jaw dropping*

Well, I guess that explains that.  I finally just gave up and did the  
math myself.


Good tip, thanks!

Brian
___

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

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

2009-07-29 Thread Mike Abdullah


On 29 Jul 2009, at 06:09, Alexander Heinz wrote:


Hello all,

I've got an NSArrayController subclass with a computed property:

@property (readonly) BOOL canRemoveSelection;

(This basically adds some application-specific checks to the  
canRemove: property, so that I can bind a remove button in  
Interface Builder.)


I want the property to be recomputed every time the selectionIndex  
or selectionIndexes of the array controller change, so, in my .m  
file, I have:


+ (NSSet*)keyPathsForValuesAffectingCanRemoveSelection
{
	return [NSSet setWithObjects:@selectionIndex,  
@selectionIndexes, nil];

}

(I realize this is probably redundant, but bear with me.)

However, the accessor for the property (i.e., - (BOOL) 
canRemoveSelection) is never called, beyond the initial call when  
the object is created. As a result, the button bound to the property  
never changes state.


I've checked to make sure that -setSelectionIndexes: is being  
called, and it is, but the property is not re-computed.


Does anyone see anything immediately wrong here?


Further to the other suggestions, have you checked in the debugger  
that your -keyPathsForValuesAffectingCanRemoveSelection is being  
called? It might be that NSArrayController overrides - 
keyPathsForValuesAffectingKey: to not call custom methods like yours.


Mike.
___

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

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

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

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


Re: NSArrayController subclass computed property not being updated

2009-07-29 Thread Jim Correia

On Jul 29, 2009, at 1:09 AM, Alexander Heinz wrote:


I've got an NSArrayController subclass with a computed property:

@property (readonly) BOOL canRemoveSelection;

(This basically adds some application-specific checks to the  
canRemove: property, so that I can bind a remove button in  
Interface Builder.)


I want the property to be recomputed every time the selectionIndex  
or selectionIndexes of the array controller change, so, in my .m  
file, I have:


+ (NSSet*)keyPathsForValuesAffectingCanRemoveSelection
{
	return [NSSet setWithObjects:@selectionIndex,  
@selectionIndexes, nil];

}


[...]


Does anyone see anything immediately wrong here?


My previous post explains why this doesn't work:

http://lists.apple.com/archives/Cocoa-dev/2009/Apr/msg01683.html

Jim

___

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

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

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

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


Re: Cahnging bgColor of a UIView not working.

2009-07-29 Thread Eric E. Dolecki
This is good to use:
#define UIColorFromRGB(rgbValue) [UIColor \ colorWithRed:((float)((rgbValue
 0xFF)  16))/255.0 \ green:((float)((rgbValue  0xFF00)  8))/255.0
\ blue:((float)(rgbValue  0xFF))/255.0 alpha:1.0]

...

cell.textColor = UIColorFromRGB(0x33);


On Wed, Jul 29, 2009 at 1:04 PM, Brian Slick briansl...@mac.com wrote:

 On Jul 29, 2009, at 12:56 PM, David Duncan wrote:

  On Jul 29, 2009, at 4:52 AM, Brandon Walkin wrote:

  The arguments to that UIColor method should be in the range of 0 to 1.
 Divide each RGB value by 255 to get them into that range.



 This is more of a PSA than anything (because I've seen more than a fair
 share of devs slap themselves on the head here too): Always ensure your
 using floating point division if your going to do this. That means always
 dividing by 255.0. I've seen too many people asking why do I always get
 black and pointed out because you forgot the .0 :).
 --
 David Duncan
 Apple DTS Animation and Printing


 *jaw dropping*

 Well, I guess that explains that.  I finally just gave up and did the math
 myself.

 Good tip, thanks!

 Brian

 ___

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

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

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

 This email sent to edole...@gmail.com




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

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

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

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

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


Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-29 Thread Daniel DeCovnick


On Jul 28, 2009, at 5:23 PM, Quincey Morris wrote:


On Jul 28, 2009, at 16:44, Daniel DeCovnick wrote:


-(NSSet *)allDescendentsJobs
{
...
}

But I can't bind JobsArrayController's content set to this because  
entity Folder does not support Key Value Coding for property  
'allDescendentsJobs' because, as I understand it, it's read-only*.  
At this point I'm stuck. What do I do to get past this?


'allDescendentsJobs' (not how 'descendants' is spelled, btw)


Whoops!

is not a property of entity Folder, so of course you can't point a  
NSArrayController in *entity* mode at it.


However, 'allDescendentsJobs' *is* a property of your custom  
NSManagedObject subclass that corresponds to the entity, so you can  
point a NSArrayController at it in *class* mode. That means you'll  
have to compute an array instead of a set.




Returning an array is easy enough, and I presume you mean I should  
create an array controller of class Job, not Folder, since Folders are  
represented by a tree controller. Trying it out, everything works as  
it's supposed to... except deletion and refreshing*, both of which I  
suspect relate to the next point.


*adding works (albeit clumsily) by having a second Job array  
controller in entity mode, bound to  
FolderTreeController.selection.jobs. The tableview doesn't refresh  
when a job is added, but at least it shows up when refreshed manually,  
which is enough to tell me that my allDescendantsJobs code works fine.  
Deleting is worse. In leaf node Folders it works fine (with the same  
refresh problem as adding), but I can't delete Jobs from a Folder's  
children, and worse, if a Folder has both Jobs and children, the Job  
selection onscreen does not match the selection in the array  
controller; the latter is one of only those jobs in the Folder. But  
given what's below, you probably already knew that would happen. ;)


You have another problem, though. Your NSManagedObject subclass  is  
not (by the code you've sketched) KVO compliant for the  
'allDescendentsJobs' property, so if you're expecting the table view  
to update when the jobs change at some level, it won't.


I read over the Ensuring KVO compliance docs, and I have to say, I  
don't think I understand it. At first glance it looks fine to me, but  
obviously it's not. Do I have to implement mutableSet/ 
ArrayValueForKey: myself, or am I completely on the wrong track?


-Daniel 
___


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

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

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

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


Re: something I can't understand

2009-07-29 Thread Agha Khan

Hi Dragos lonal:
I didn't mention they have readonly attributes. How can we remove  
readonly  attribute?


Thanks for reply.

Agha
On Jul 29, 2009, at 6:35 AM, Dragos Ionel wrote:


verticalLoc and x are readonly values, you cannot assign them.

use the frame property, first to retrieve it, change the x value and  
then to reassign to the button.


something like

CGFrame frame = pPngButton.frame;
frame.x = ...;
pPngButton.frame = frame;

Dragos


On Wed, Jul 29, 2009 at 3:24 AM, Agha Khan agha.k...@me.com wrote:
Hi:
Thank you for your reply.
Oh yes. It an Objective-C class.

regardless I place (bVerticalDisplay == YES) or not. The function  
silently fails, with no warnings.

The I decided to
 pPngButton.verticalLoc.x = (bVerticalDisplay == YES) ? 250 : 410;
This time I got warning.


error: lvalue required as left operand of assignment

Many thanks

-Agha




On Jul 28, 2009, at 7:59 PM, Kiel Gillard wrote:

On 29/07/2009, at 12:52 PM, Agha Khan wrote:

Hi:
I have a struct
@interface PngButton : UIButton
{
@public
   bool OffPos;
   CGPoint horizontalLoc;
   CGPoint verticalLoc;
}
@property (assign) bool OffPos;
@property (assign) CGPoint horizontalLoc;
@property (assign) CGPoint verticalLoc;
@end

No, you have an Objective-C class.

PngButton* pPngButton   = [PngButton  
buttonWithType:UIButtonTypeInfoDark];
[pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0,  
36, 36)]; // No problem


pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ?  
250 : 410, 50.0);


I get an error
error: lvalue required as left operand of assignment

Why it is not working? I shouldn't get this error.
Any help will be very much appreciated.

Do you get any warnings?

Try this and see what happens:
pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES ?  
250.0 : 410.0), 50.0);


Kiel


___

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

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

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

This email sent to dragosio...@gmail.com



___

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

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

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

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


Re: something I can't understand

2009-07-29 Thread Dragos Ionel
Actually it was my mistake as pointed by Glenn and Wagner.

My apologies to have misled.

Dragos
iphodea.com


On Wed, Jul 29, 2009 at 2:40 PM, Agha Khan agha.k...@me.com wrote:

 Hi Dragos lonal:I didn't mention they have readonly attributes. How can we
 remove readonly  attribute?

 Thanks for reply.

 Agha
 On Jul 29, 2009, at 6:35 AM, Dragos Ionel wrote:

 verticalLoc and x are readonly values, you cannot assign them.

 use the frame property, first to retrieve it, change the x value and then
 to reassign to the button.

 something like

 CGFrame frame = pPngButton.frame;
 frame.x = ...;
 pPngButton.frame = frame;

 Dragos


 On Wed, Jul 29, 2009 at 3:24 AM, Agha Khan agha.k...@me.com wrote:

 Hi:
 Thank you for your reply.
 Oh yes. It an Objective-C class.

 regardless I place (bVerticalDisplay == YES) or not. The function silently
 fails, with no warnings.
 The I decided to
  pPngButton.verticalLoc.x = (bVerticalDisplay == YES) ? 250 : 410;
 This time I got warning.

 error: lvalue required as left operand of assignment

 Many thanks

 -Agha




 On Jul 28, 2009, at 7:59 PM, Kiel Gillard wrote:

  On 29/07/2009, at 12:52 PM, Agha Khan wrote:

  Hi:
 I have a struct
 @interface PngButton : UIButton
 {
 @public
bool OffPos;
CGPoint horizontalLoc;
CGPoint verticalLoc;
 }
 @property (assign) bool OffPos;
 @property (assign) CGPoint horizontalLoc;
 @property (assign) CGPoint verticalLoc;
 @end


 No, you have an Objective-C class.

  PngButton* pPngButton   = [PngButton
 buttonWithType:UIButtonTypeInfoDark];
 [pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0, 36,
 36)]; // No problem

 pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ? 250 :
 410, 50.0);

 I get an error
 error: lvalue required as left operand of assignment

 Why it is not working? I shouldn't get this error.
 Any help will be very much appreciated.


 Do you get any warnings?

 Try this and see what happens:
 pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES ? 250.0 :
 410.0), 50.0);

 Kiel


 ___

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

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

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

 This email sent to dragosio...@gmail.com




___

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

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

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

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


Re: something I can't understand

2009-07-29 Thread Agha Khan


Thank you for reply.

I am working with Windows for 15 years but new to Objective-C.
Well after spending whole 2 days on a such a small problem I  
understand this is a bug and Apple has to fix it. The bug is If you  
inherit for UIButton then it is not going to work.


It worked fine on
CGPoint pt = CGPointMake((bVerticalDisplay == YES) ? 250 :  
410,50); // No problem.


but it did not work
CGPoint pt = pPngButton.verticalLoc; // GOt  
__TERMINATING__DUE_TO_UNCAUGHT_EXCEPTION__

so I removed that line.

and tried
CGPoint pt = CGPointMake((bVerticalDisplay == YES) ? 250 :  
410,50); // No problem.
pPngButton.verticalLoc= pt;   // Again GOt  
__TERMINATING__DUE_TO_UNCAUGHT_EXCEPTION__


I have no choice but to abandoned that approach and save that data  
somewhere else.


Thank you helping me. I am not sure how can we report that bug to Apple.

Best regards
Agha

On Jul 29, 2009, at 11:56 AM, Dragos Ionel wrote:


Actually it was my mistake as pointed by Glenn and Wagner.

My apologies to have misled.

Dragos
iphodea.com


On Wed, Jul 29, 2009 at 2:40 PM, Agha Khan agha.k...@me.com wrote:
Hi Dragos lonal:
I didn't mention they have readonly attributes. How can we remove  
readonly  attribute?


Thanks for reply.

Agha
On Jul 29, 2009, at 6:35 AM, Dragos Ionel wrote:


verticalLoc and x are readonly values, you cannot assign them.

use the frame property, first to retrieve it, change the x value  
and then to reassign to the button.


something like

CGFrame frame = pPngButton.frame;
frame.x = ...;
pPngButton.frame = frame;

Dragos


On Wed, Jul 29, 2009 at 3:24 AM, Agha Khan agha.k...@me.com wrote:
Hi:
Thank you for your reply.
Oh yes. It an Objective-C class.

regardless I place (bVerticalDisplay == YES) or not. The function  
silently fails, with no warnings.

The I decided to
 pPngButton.verticalLoc.x = (bVerticalDisplay == YES) ? 250 : 410;
This time I got warning.


error: lvalue required as left operand of assignment

Many thanks

-Agha




On Jul 28, 2009, at 7:59 PM, Kiel Gillard wrote:

On 29/07/2009, at 12:52 PM, Agha Khan wrote:

Hi:
I have a struct
@interface PngButton : UIButton
{
@public
   bool OffPos;
   CGPoint horizontalLoc;
   CGPoint verticalLoc;
}
@property (assign) bool OffPos;
@property (assign) CGPoint horizontalLoc;
@property (assign) CGPoint verticalLoc;
@end

No, you have an Objective-C class.

PngButton* pPngButton   = [PngButton  
buttonWithType:UIButtonTypeInfoDark];
[pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0,  
36, 36)]; // No problem


pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ?  
250 : 410, 50.0);


I get an error
error: lvalue required as left operand of assignment

Why it is not working? I shouldn't get this error.
Any help will be very much appreciated.

Do you get any warnings?

Try this and see what happens:
pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES ?  
250.0 : 410.0), 50.0);


Kiel


___

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

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

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

This email sent to dragosio...@gmail.com






___

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

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

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

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


Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-29 Thread Quincey Morris

On Jul 29, 2009, at 11:27, Daniel DeCovnick wrote:

I read over the Ensuring KVO compliance docs, and I have to say, I  
don't think I understand it. At first glance it looks fine to me,  
but obviously it's not. Do I have to implement mutableSet/ 
ArrayValueForKey: myself, or am I completely on the wrong track?


Your NSManagedObject subclass Job, if I've got the naming right, has a  
array property allDescendentsJobs. The NSArrayController has as its  
content array the *root* Job object. Therefore, the NSArrayController  
is only going to get a KVO notification if the allDescendentsJobs  
property of the *root* Job changes KVO-compliantly.


So ask: what is going to cause the allDescendentsJobs property of  
the *root* Job to be updated KVO-compliantly? Answer: nothing, because  
the property value is only created on demand (i.e. the first time the  
NSArrayController refers to it), and thereafter the property is read- 
only.


Getting KVO-compliant updates is hard in this situation. The root  
level property is affected by every add/replace/remove change at every  
lower level, which is potentially a lot of stuff to keep track of.  
You're going to have to invent a strategy for changes at the lower  
levels to inform the root level that something has changed, and for  
the root level to manually trigger the KVO notification at the end of  
a cycle of changes. (If you have implemented Undo, this is analogous  
to the way individual property changes are batched into an undo group.)


It is feasible to trigger KVO notifications at lower levels and let  
them percolate up naturally, but that of course will cause the  
NSArrayController to be notified multiple times for what is  
essentially a single change.


Probably it's going to be easier to solve if you promote  
allDescendentsJobs into a read/write property (i.e. back it with a  
NSMutableArray instance variable, or make it a Core Data transient  
property -- in which case you'd be back to a set instead of an array,  
and back to entity mode in the NSArrayController). Then, whenever you  
add/remove/remove a Job node at any level, you'd also manually update  
the root allDescendentsJobs property directly.


Note that this would still generate far too many KVO notifications for  
the root object's allDescendentsJobs property, so you'd have to deal  
with that. Also, you have to make sure the property is updated  
properly on undo (which is why making it a transient Core Data  
property is ultimately easier than using an instance variable, if  
you're supporting undo, since you'd get that for free).


If you think this sounds complicated, you're right. (If anyone else  
wants to jump in with an easier solution, I'd be happy to cede the  
territory.)


Finally, one thing that helps with this problem is to give up on  
trying to use KVO *on this property* to keep your user interface up-to- 
date and write a data source delegate instead. If you have to keep  
track of when the update is necessary, it's far easier to call  
'reloadData' (and it doesn't hurt so bad to call that multiple times)  
than to trick KVO into doing the right thing. Also (whew!),  
NSOutlineView + NSTreeController + NSArrayController + KVO + undo is  
reputed to have bugs, so you may do everything right and then have  
your application crash after the user does an undo. (I've run into  
this problem personally, but by the time you get there the  
circumstances are so murky it's hard to know who to blame. But the  
archives do claim this is a bug, and no one from Apple has denied it  
AFAIK.)


Is that more information than you wanted? :)

P.S. If anyone else wants to jump in with an easier solution, I'd be  
happy to cede the territory.



___

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

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

2009-07-29 Thread Bill Bumgarner

On Jul 29, 2009, at 12:20 PM, Agha Khan wrote:
Well after spending whole 2 days on a such a small problem I  
understand this is a bug and Apple has to fix it. The bug is If you  
inherit for UIButton then it is not going to work.


Given that this code is really really basic stuff, do you really think  
that there would be a bug along this code path?


Pretty darned unlikely.  Assuming you are using @synthesize to  
synthesize the setter/getter for that property, there are many  
hundreds of other code paths that do exactly that and those paths are  
executed billions of times per day across all the iPhones in the  
world.   That is an awful lot of evidence that @synthesize   
properties is working just fine.


So, no, this isn't a bug that Apple has to fix.  It is a bug that you  
have to fix.  Or a bug that you have to demonstrate isn't your bug,  
which you haven't done yet.




It worked fine on
CGPoint pt = CGPointMake((bVerticalDisplay == YES) ? 250 :  
410,50); // No problem.


but it did not work
CGPoint pt = pPngButton.verticalLoc; // GOt  
__TERMINATING__DUE_TO_UNCAUGHT_EXCEPTION__

so I removed that line.

and tried
CGPoint pt = CGPointMake((bVerticalDisplay == YES) ? 250 :  
410,50); // No problem.
pPngButton.verticalLoc= pt;   // Again GOt  
__TERMINATING__DUE_TO_UNCAUGHT_EXCEPTION__


What is the one common case for both of the lines of code that crash?


pPngButton.verticalLoc


Are you absolutely positively sure that pPngButton is actually a valid  
object at the point above where the crash happens?


I'd bet you a pitcher of beer it isn't or that you have implemented - 
verticalLoc and -setVerticalLoc: incorrectly (if not using  
@synthesize).   I'd wager that you have not properly retained or may  
have over-released the object sometime prior.


Try inserting [pPngButton self] above either of the crashing lines.   
More likely than not, *that* will crash.


Some time ago, you wrote:

PngButton* pPngButton   = [PngButton  
buttonWithType:UIButtonTypeInfoDark];
[pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0,  
36, 36)]; // No problem


pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ?  
250 : 410, 50.0);


Is this the entirety of your code that refers to pPngButton?  Is it  
really all contiguous like that?  Or does that latter line of code  
appear in a different method?Where are you retaining  
pPngButton?  ...do you stick it in view hierarchy somewhere?


b.bum

___

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

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


DragDrop to desktop - file icons layout problem

2009-07-29 Thread Alexander Bokovikov

Hi, All,

Maybe it's a stupid question, but I can't find a solution... I'm  
dragging files from my app to desktop. All goes OK, but file icons are  
located one exactly above another if I'm dragging many items. As a  
result, few extra clicks on desktop are required to be able to split  
these icons.


The question is, how could I assign icons location for dropped items?  
I believe, though didn't yet tested it, that similar problem will be  
with Finder window, when it is in icons mode. The only point where I  
could get such information (as I believe) could be   
tableView::namesOfPromisedFilesDroppedAtDestination: method, but it  
doesn't contain any information about icons location.


Any ideas?

Thanks.

___

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

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

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

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


Re: where can I download xcode 3.2

2009-07-29 Thread Henry McGilton (Boulevardier)


On Jul 28, 2009, at 12:22 AM, Kyle Sluder wrote:


On Jul 27, 2009, at 10:38 AM, YongLi liyon...@gmail.com wrote:

I have installed the snow leopardbut i can't find the download link  
of xcode

3.2


1. This is cocoa-dev. This list exists for the discussion of Cocoa,  
not for downloading seeds or other non-Cocoa topics.


2. Snow Leopard and the developer tools are distributed under NDA  
and you therefore can't talk about them publicly. NDA forums can be  
found at http://devforums.apple.com.


3. All the downloads are in the same place: the Mac dev center at http://developer.apple.com 
.


True, all the downloads are in the same place as you said.However,  
the answer to the OP's
question can be found by carefully paying attention to the (publicly  
available PDF document) on

that very download site

iPhone SDK 3.0 (Snow Leopard) Read Me

Cheers,
. . . . . . . .Henry


___

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

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

2009-07-29 Thread Gustavo Pizano
In fact I did slap in my head when I realized about the argumetns,  
after reading the first reply..



big DUH for me .


Thanks for all the suggestions.

G.
On Jul 29, 2009, at 6:56 PM, David Duncan wrote:


On Jul 29, 2009, at 4:52 AM, Brandon Walkin wrote:

The arguments to that UIColor method should be in the range of 0 to  
1. Divide each RGB value by 255 to get them into that range.



This is more of a PSA than anything (because I've seen more than a  
fair share of devs slap themselves on the head here too): Always  
ensure your using floating point division if your going to do this.  
That means always dividing by 255.0. I've seen too many people  
asking why do I always get black and pointed out because you  
forgot the .0 :).

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

This email sent to gustavxcodepic...@gmail.com


___

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

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

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

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


Little mind explanation for changing views in iPhone

2009-07-29 Thread Gustavo Pizano

Hello all.

Well after reading the docs, and some examples form books, I came up  
and tried to build a prototype of what I want. So I needed to load a  
initial view with 2 buttons, one will lead me to InfoViewController  
and the other one to an AuthenticationViewController, each one has its  
related .xib, from the AppViewcontroller, I can have 2 instances of  
each viewController, and then if I put a button in the appController  
view I can swap the views, but the button will have to remain (in a  
toolbar, or something similar). What I want is to load  
InfoViewController's view when app loads, with will be at the  
viewDidload form the AppViewController,  and InfroViewController's  
view should have its design, but also a button to go back to the Main  
view, which is the one in AppviewController's view.  Also from the  
AuthenticationViewController's view


So I had that in mind, but when I came up to implemented I had a  
problem, the IBAction for those buttons I will place them in their  
respective view controllers (InfoViewController and  
AuthenticationviewController), but they know nothing about the  
AppViewController who is (was)the one in charge of swapping the views...


Should I ask for the AppViewController instance (view singleton  
patern) and send the aodl and new view to be placed? ( I did something  
like this , not to change views, but displaying things in a cocoa  
app), but I dunno if these same idea can be applied in a iPhone app,  
or is there a better workaround.



Thanks

Gustavo Pizano

___

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

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

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

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


Re: something I can't understand

2009-07-29 Thread Agha Khan

Dear bbum:
Well After your email I started to write a small app to send you the  
project for passing my point across.


AND FOUND THE PROBLEM.
@interface PngButton : UIButton
{
@public
CGPoint horizontalLoc;
CGPoint verticalLoc;
}
@property (assign) CGPoint horizontalLoc;
@property (assign) CGPoint verticalLoc;
@end

rotateRightBtn  = [PngButton buttonWithType:UIButtonTypeInfoDark];

In 99.99% cases it is correct statement. But it is not correct for my  
application, because it will create UIButton button but not embedded  
other objects as I am holding other CGPoint objects.


NO wonder it was failing. :-)

Now my question how to create such object and set flags as  
buttonWithType:UIButtonTypeInfoDark?


Any Idea?

Your email is very much appreciated.
Thanks for putting me in right direction.

Best regards
Agha




On Jul 29, 2009, at 12:50 PM, Bill Bumgarner wrote:


On Jul 29, 2009, at 12:20 PM, Agha Khan wrote:
Well after spending whole 2 days on a such a small problem I  
understand this is a bug and Apple has to fix it. The bug is If you  
inherit for UIButton then it is not going to work.


Given that this code is really really basic stuff, do you really  
think that there would be a bug along this code path?


Pretty darned unlikely.  Assuming you are using @synthesize to  
synthesize the setter/getter for that property, there are many  
hundreds of other code paths that do exactly that and those paths  
are executed billions of times per day across all the iPhones in the  
world.   That is an awful lot of evidence that @synthesize   
properties is working just fine.


So, no, this isn't a bug that Apple has to fix.  It is a bug that  
you have to fix.  Or a bug that you have to demonstrate isn't your  
bug, which you haven't done yet.




It worked fine on
CGPoint pt = CGPointMake((bVerticalDisplay == YES) ? 250 :  
410,50); // No problem.


but it did not work
CGPoint pt = pPngButton.verticalLoc; // GOt  
__TERMINATING__DUE_TO_UNCAUGHT_EXCEPTION__

so I removed that line.

and tried
CGPoint pt = CGPointMake((bVerticalDisplay == YES) ? 250 :  
410,50); // No problem.
pPngButton.verticalLoc= pt;   // Again GOt  
__TERMINATING__DUE_TO_UNCAUGHT_EXCEPTION__


What is the one common case for both of the lines of code that crash?


pPngButton.verticalLoc


Are you absolutely positively sure that pPngButton is actually a  
valid object at the point above where the crash happens?


I'd bet you a pitcher of beer it isn't or that you have implemented - 
verticalLoc and -setVerticalLoc: incorrectly (if not using  
@synthesize).   I'd wager that you have not properly retained or may  
have over-released the object sometime prior.


Try inserting [pPngButton self] above either of the crashing lines.   
More likely than not, *that* will crash.


Some time ago, you wrote:

PngButton* pPngButton   = [PngButton  
buttonWithType:UIButtonTypeInfoDark];
[pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0,  
36, 36)]; // No problem


pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ?  
250 : 410, 50.0);


Is this the entirety of your code that refers to pPngButton?  Is it  
really all contiguous like that?  Or does that latter line of code  
appear in a different method?Where are you retaining  
pPngButton?  ...do you stick it in view hierarchy somewhere?


b.bum



___

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

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


[SOLVED] NSArrayController subclass computed property not being updated

2009-07-29 Thread Alexander Heinz


On Jul 29, 2009, at 11:24 AM, Jim Correia wrote:


On Jul 29, 2009, at 1:09 AM, Alexander Heinz wrote:


I've got an NSArrayController subclass with a computed property:

@property (readonly) BOOL canRemoveSelection;

(This basically adds some application-specific checks to the  
canRemove: property, so that I can bind a remove button in  
Interface Builder.)


I want the property to be recomputed every time the  
selectionIndex or selectionIndexes of the array controller  
change, so, in my .m file, I have:


+ (NSSet*)keyPathsForValuesAffectingCanRemoveSelection
{
	return [NSSet setWithObjects:@selectionIndex,  
@selectionIndexes, nil];

}


[...]


Does anyone see anything immediately wrong here?


My previous post explains why this doesn't work:

http://lists.apple.com/archives/Cocoa-dev/2009/Apr/msg01683.html

Jim


Ah! That explains it perfectly. I already had some ideas for  
workarounds, I'll go ahead with those.


Thank you,
Alex
___

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

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

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

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


Re: something I can't understand

2009-07-29 Thread Bill Bumgarner

On Jul 29, 2009, at 2:18 PM, Agha Khan wrote:


Dear bbum:
Well After your email I started to write a small app to send you the  
project for passing my point across.


AND FOUND THE PROBLEM.


Awesome -- happy to have helped (and happy you didn't take my email as  
insulting... I sometimes find a bit of polite causticism is an  
awesome motivator :).



@interface PngButton : UIButton
{
@public
CGPoint horizontalLoc;
CGPoint verticalLoc;
}
@property (assign) CGPoint horizontalLoc;
@property (assign) CGPoint verticalLoc;
@end

rotateRightBtn  = [PngButton buttonWithType:UIButtonTypeInfoDark];

In 99.99% cases it is correct statement. But it is not correct for  
my application, because it will create UIButton button but not  
embedded other objects as I am holding other CGPoint objects.


NO wonder it was failing. :-)

Now my question how to create such object and set flags as  
buttonWithType:UIButtonTypeInfoDark?


You might not be able to.  I would file a bug via http://bugreport.apple.com/ 
  asking for +buttonWithType: to use [self alloc] instead of  
[UIButton alloc] as it is probably doing now.  That'd fix your problem  
sometime in the future.


For now, you'll probably need to create an instance of your button  
class directly


rotateRightBtn = [[PngButton alloc] init...];  (I don't remember what  
the initializer is for UIButton)


... and then configure it manually with whatever configuration  
UIButtonTypeInfoDark implies.


b.bum
___

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

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

2009-07-29 Thread Scott Anguish


On 2009-07-27, at 3:16 PM, I. Savant wrote:


On Jul 27, 2009, at 3:09 PM, slasktrattena...@gmail.com wrote:

Short answer: YES. A distributed notification is posted every time  
the

the database is updated. Add an observer for notifications named
com.apple.iTunes.sourceSaved posted by object
com.apple.iTunes.sources.


 Is this documented / public? If not, fair warning: this string  
could change at any time without notice and your product will stop  
working.


--
I.S.



I'd say that's likely a no.

I'd look for the scripting bridge in iTunes for something useful (not  
sure that there is in this case).



___

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

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

2009-07-29 Thread Daniel DeCovnick


On Jul 29, 2009, at 12:40 PM, Quincey Morris wrote:


On Jul 29, 2009, at 11:27, Daniel DeCovnick wrote:

I read over the Ensuring KVO compliance docs, and I have to say, I  
don't think I understand it. At first glance it looks fine to me,  
but obviously it's not. Do I have to implement mutableSet/ 
ArrayValueForKey: myself, or am I completely on the wrong track?


Your NSManagedObject subclass Job, if I've got the naming right, has  
a array property allDescendentsJobs. The NSArrayController has as  
its content array the *root* Job object. Therefore, the  
NSArrayController is only going to get a KVO notification if the  
allDescendentsJobs property of the *root* Job changes KVO- 
compliantly.


I'm sorry, you misunderstand. My NSManagedObject subclass Folder, not  
Job, has the allDescendantsJobs, and the NSTreeController/ 
NSOutlineView has all Folders where parent==nil as its root objects.  
There is a one Folder to many Jobs relationship. Folders and their  
children (and their children, etc.) show up in the outline view, and  
there's a table view of Jobs for the selected Folder (and, ideally,  
it's children).


So ask: what is going to cause the allDescendentsJobs property of  
the *root* Job to be updated KVO-compliantly? Answer: nothing,  
because the property value is only created on demand (i.e. the first  
time the NSArrayController refers to it), and thereafter the  
property is read-only.


I'm perfectly happy and able to put a -newJobAndRefetch: method in my  
window controller (the xib's File's Owner), but that's insufficient  
except for the display problem.



snipped...


I don't think very much of that still applies given the  
misunderstanding above.


Finally, one thing that helps with this problem is to give up on  
trying to use KVO *on this property* to keep your user interface up- 
to-date and write a data source delegate instead.


Hmm... That may be the easier thing to do.

Also (whew!), NSOutlineView + NSTreeController + NSArrayController +  
KVO + undo is reputed to have bugs, so you may do everything right  
and then have your application crash after the user does an undo.  
(I've run into this problem personally, but by the time you get  
there the circumstances are so murky it's hard to know who to blame.  
But the archives do claim this is a bug, and no one from Apple has  
denied it AFAIK.)




Oi vey...

-Daniel
___

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

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

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

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


Re: something I can't understand

2009-07-29 Thread Luke the Hiesterman


On Jul 29, 2009, at 2:26 PM, Bill Bumgarner wrote:

rotateRightBtn = [[PngButton alloc] init...];  (I don't remember  
what the initializer is for UIButton)


... and then configure it manually with whatever configuration  
UIButtonTypeInfoDark implies.


The only publicly supported way to set a button to  
UIButtonTypeInfoDark is via +[UIButton  
buttonWithType:UIButtonTypeInfoDark]. As Bill said, file a bug if this  
is 'causing you a problem.


Luke

___

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

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


[moderator] Re: About Posting [ end of this thread ]

2009-07-29 Thread Scott Anguish

This thread is done.

No followups to the list, on this topic, or on what I'm about to say.  
You can hit the list moderation address or me personally for feedback.


For everyone's benefit.

1. Everyone's first source should be Apple documentation.

It's written by experts with the backing and review of of engineering  
and with full access to the source. It's reviewed by an editorial  
staff that knows more about punctuation than a compiler.


But every single one is human. Mistakes can be made. File feedback,  
file bugs. We do our best to address what we can.



2. Search sample code (searched as part of the docs typically)

Written by DTS, Engineering, and DevPubs Engineers. Peer reviewed in a  
process that requires significant care. But again, humans. Sample code  
is improving as tools such as clang do.


3. Google/cocoabuilder.com, Stack Overflow etc.

There are hundreds of bloggers out there writing excellent cocoa  
articles, tips, open source frameworks, etc. Not everything is up to  
date (u-hmm.. Stepwise.com as a prime example of something out of date  
but still useful to some, I'm sorry) but you can still get ideas and  
sometimes all it takes is a small push to get you going.


4. Only as the last resort should the mailing lists be hit for  
questions. 90% have been asked, and the cocoabuilder.com archives of  
the list are excellent (it hurts to say, but better than our's at  
Apple's)



5. And remember, no NDA material here. There are devforums.apple.com  
for that, and as another entirely viable, and supported and monitored,  
self-support.




With particular respect to Idiot Savant. Email can easily convolute  
nuance. While he posts with a screen-name rather than his real name,  
he knows his stuff. I understand why he doesn't use his real name, and  
as a moderator I accept it. Further, he's as kind and considerate an  
individual as I've met (*like virtually every list member I've had the  
opportunity to meet over the years*).


Ultimately, we're a community. A family. We're working together to  
make our products and the platform better.


And yes, I believe that.

Scott Anguish
Apple Employee
Cococa-dev moderator



___

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

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

2009-07-29 Thread Cerino, Carmen
I have an NSArrayController hooked up to an NSCollectionView. When a  
user clicks into the empty space of the NSCollectionView, I would like  
it so they do not lose their currently selected items. I would have  
thought it should have been as simple as telling the NSArrayController  
to avoid empty selections. However, I do not get the desired result  
when this property is set.  Is there something else that needs to be  
setup in order for this to work as expected or is my assumption about  
what that property is suppose to do completely wrong?

In order to temporarily achieve the desired effect, I ended up  
subclasing NSArrayController and overriding the setSelectionIndexes:  
method to ignore index sets with a count of 0. However, this seems  
more like a work around than a solution.

Cheers,
Carmen

___

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

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

2009-07-29 Thread Waqas Qureshi
Hi Mahamoob!

There is no way!
You should need to upgrade your iPhone OS.

If this is not an error then may be possible that you used some 3.0
frameworks who not exist in 2.2.

On Tue, Jul 28, 2009 at 3:24 PM, Mahaboob mahab...@newtok.com wrote:

 I developed an iPhone application using iPhone OS 3.0 and build it against
 iPhone OS 2.2. The application uses MessageUI.Framework It is tested in
 simulator 3.0. Then from simulator,I changed the Hardware version to 2.2
 and
 is working fine. My iPhone is having the OS version 2.2. Now I need to test
 the application in iPhone without upgrading the OS.
 How can I do it ?
 When I'm debugging the application by selecting the Active SDK to  iPhone
 Device 2.2, it yields a lots of errors.

 Thanks in advance
 Mahaboob


 ___

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

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

 Help/Unsubscribe/Update your Subscription:

 http://lists.apple.com/mailman/options/cocoa-dev/waqas.qureshi%40geniteam.com

 This email sent to waqas.qure...@geniteam.com




-- 
Thanks
Waqas Qureshi
iPhone Application Specialist @ GenITeam Sol
___

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

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

2009-07-29 Thread Matt Rajca

Hi!

I'm using IKImageBrowserView to display a collection files that reside  
on Bluetooth devices. From the documentation, it looks like the only  
method you have to override to support dragging is:


- (NSUInteger)imageBrowser:(IKImageBrowserView *)aBrowser  
writeItemsAtIndexes:(NSIndexSet *)itemIndexes toPasteboard: 
(NSPasteboard *)pasteboard


I can't seem to be able to get the Finder to accept file promises  
placed on the dragging pasteboard from IKImageBrowserView. Here is my  
code:


- (NSUInteger)imageBrowser:(IKImageBrowserView *)aBrowser  
writeItemsAtIndexes:(NSIndexSet *)itemIndexes toPasteboard: 
(NSPasteboard *)pasteboard {


NSArray *fileExtensions ... ; // Get extensions of the dragged files

	[pasteboard declareTypes:[NSArray  
arrayWithObject:NSFilesPromisePboardType] owner:self];
	[pasteboard setPropertyList:fileExtensions  
forType:NSFilesPromisePboardType];


return [fileExtensions count];
}

Is there any way to support the dragging of file promises from  
IKImageBrowserView so I could later save the actual data to disk  
asynchronously?


Thanks,

Matt
___

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

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

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

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


Re: DragDrop to desktop - file icons layout problem

2009-07-29 Thread Alastair Houghton

On 29 Jul 2009, at 21:24, I. Savant wrote:


On Jul 29, 2009, at 4:16 PM, Alexander Bokovikov wrote:

The question is, how could I assign icons location for dropped  
items? I believe, though didn't yet tested it, that similar problem  
will be with Finder window, when it is in icons mode. The only  
point where I could get such information (as I believe) could be   
tableView::namesOfPromisedFilesDroppedAtDestination: method, but it  
doesn't contain any information about icons location.


 I don't believe there is a (public API) way to set (or get) the  
location of an icon.


The supported way is to use AppleScript (or to send equivalent Apple  
Events using some other method, e.g. the scripting bridge or AESend()  
et al.); Finder items have a position property that you can get/set.


You used to be able to control this via the Finder information (using  
FSSetCatalogInfo()), but the Finder on OS X prefers its .DS_Store  
files.  It is *claimed* that the OS X Finder will look at the Finder  
information if it doesn't know where something should go yet, but I  
never managed to get that to work in practice.


Kind regards,

Alastair.

--
http://alastairs-place.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: UITextView not updating

2009-07-29 Thread Development

I ended up having to do something similarly as bad for performance
-(void)viewDidScroll
{
NSString* placeHolder= myTextView.text;
myTextView.text =@;
myTextView.text =placeHolder;
}


can we say bumpy scroll.

Once I get a few other bugs worked out I'll redo this to trigger when  
the scroll view's visible region and the textview frame are  
intersecting.


On Jul 27, 2009, at 3:47 PM, Info wrote:


Hi,

I run into the same problem with an app for that I decided to set up  
my view controllers / views as singletons (and therefore to reuse  
them).


Views within a scroll view display their previous values if they  
become a new value assigned when they are scrolled off (screen or  
scroll view bounds - I can't tell).


A fix (very bad for performance) is to set up the view controller as  
a delegate for the scroll view and to do somethings like this:


-(void) viewDidScroll {
  myTextView.frame=myTextView.frame;
}

It's a bug in UIKit a I always wanted to file but didn't do...

Markus

On 27.07.2009, at 20:10, Development wrote:


I asked about this earlier and no one seemed the know the answer.
I have a UITextView inside of a scroll view. The textview is  
offscreen when the main view loads. So it does not update when data  
is loaded in to it. Thus when ever the scroll it is inside moves I  
use a standard scrollview delegate method to detect the scroll.  
Then execute the code below.


if(scrollView == miniScroll){
for (UIView *childView in onlinePeopleView.subviews)
{   
[childView setNeedsDisplay];
}
}

This does not work. setNeedDisplay does not cause it to update and  
display the text inside of the textview. What can I do to cause the  
text to be displayed? Everything else is set up correctly in IB and  
the text size is unaltered. So I know its none of that. If I  
NSLog() the contents of the text view it shows that the textview is  
infact imbued with the correct text it simply will not display. How  
can I force a textview to update it's display?



Thanks
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/info%40edv-medien.de

This email sent to i...@edv-medien.de



___

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

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

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

This email sent to developm...@fornextsoft.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 to drag file promises from IKImageBrowserView?

2009-07-29 Thread Nick Zitzmann


On Jul 29, 2009, at 2:33 PM, Matt Rajca wrote:

	[pasteboard declareTypes:[NSArray  
arrayWithObject:NSFilesPromisePboardType] owner:self];
	[pasteboard setPropertyList:fileExtensions  
forType:NSFilesPromisePboardType];


NSFilesPromisePboardType is a special pasteboard type that cannot be  
set up in this way. The only supported method of setting one up is to  
use the -dragPromisedFilesOfType:... method. See http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/Tasks/DraggingFiles.html#//apple_ref/doc/uid/20001288-102943 
 for details.


Is there any way to support the dragging of file promises from  
IKImageBrowserView so I could later save the actual data to disk  
asynchronously?


There might, if you subclassed IKImageBrowserView and completely  
rewrote the way it handled starting a drag. But other than that, no.


Nick Zitzmann
http://www.chronosnet.com/

___

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

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

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

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


Re: Fun (or not) with NSArrayControllers and CoreData.

2009-07-29 Thread Quincey Morris

On Jul 29, 2009, at 14:30, Daniel DeCovnick wrote:

I'm sorry, you misunderstand. My NSManagedObject subclass Folder,  
not Job, has the allDescendantsJobs, and the NSTreeController/ 
NSOutlineView has all Folders where parent==nil as its root objects.  
There is a one Folder to many Jobs relationship. Folders and their  
children (and their children, etc.) show up in the outline view, and  
there's a table view of Jobs for the selected Folder (and, ideally,  
it's children).



snipped...


I don't think very much of that still applies given the  
misunderstanding above.


Yeah, well, I think it all still applies. You have a tree-structured  
data model and you want to add to each non-leaf root node a property  
that's a to-many relationship to all its (directly or indirectly  
descended) leaf nodes. Yes? I may have had the class names wrong, but  
that's what I was talking about.


Try this:

-- Add an allDescendantJobs Core Data to-many relationship to the  
Folder entity in your Core Data model. Set its delete rule to Nullify.


-- Add a rootFolder Core Data to-one relationship to the Job entity,  
and make it the inverse of allDescendantJobs. Set its delete rule to  
Nullify.


-- Whenever you add a Job object to a Folder, also set the rootFolder  
property:


	addedJob.rootFolder = [parentFolder ... find its root folder  
recursively or whatever ...]; // this is KVO compliant for both ends  
of the relationship


-- Bind a NSArrayController in entity mode to the allDescendantJobs  
property of  whatever represents the selection in the Folders outline  
view.


-- Bind the Jobs table view to this array controller.

Now it should work. The only problem is going to be that the user  
interface may update for *each* Job object that's added/removed, which  
is less than optimal if you're updating a lot of them. And you're  
keeping an extra pair of relationships in the persistent store. If you  
need to avoid either of those things, you're going to have to work  
harder.



___

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

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

2009-07-29 Thread Seth Willits

On Jul 28, 2009, at 11:24 PM, Kyle Sluder wrote:

On Jul 28, 2009, at 11:12 PM, Seth Willits sli...@araelium.com  
wrote:



Yes. It just fires off a task.


Is there a particular reason you're doing this instead of using UTIs?


UTIs are useless for determining what the actual content is if the  
extension (etc) isn't common. For example, a .cnfg text file is just  
public.data since no one claims it as text. /usr/bin/file will open  
the actual file and determine if it's text. That's why this code has  
various stages. After all else fails to identify the file as being  
text, the very last stage is to just open the file and look at it.  
I've yet to find a better method.





  [task waitUntilExit];


Doing this while displaying an open panel might not be a good idea,  
especially if it's waiting on the current runloop to fetch some  
information. Like perhaps network volumes shown in the sidebar.


I think you're right on here (although I think it would still be an  
NSOpenPanel bug).  I'd try doing the equivalent of waitUntilExit  
using a different runloop mode:


I can see that this is likely the only spot for any potential trouble,  
but it'd be pretty stupid if it does. :\


At any rate, I've changed the code. I guess I'll just have to wait and  
see if I get any crash reports.




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


Looking for a method to Lock and Unlock the computer

2009-07-29 Thread Christopher J Kemsley

Hi all,


I'm looking to write a program to run in the background and do the  
following:


• Listen for Event A
• If Event A occurs, either Sleep Display or Display Login Screen

• Listen for Event B
• If Event B occurs, log-in to a specific account


Listening for the event is not a problem. However, what is a problem  
is logging in and displaying the login screen progmatically.


My preference is to display the login screen, though simply sleeping  
the display would suffice if I cannot have the former.



I'd appreciate any suggestions anyone might have.

Thanks,

Christopher___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [moderator] Re: About Posting [ end of this thread ]

2009-07-29 Thread I. Savant

On Jul 29, 2009, at 5:43 PM, Scott Anguish wrote:

With particular respect to Idiot Savant. Email can easily convolute  
nuance. While he posts with a screen-name rather than his real  
name, he knows his stuff.


  Sorry, Scott, to follow up on this thread, but I felt the need to  
correct this and relieve you of the need to decide whether to throw me  
under the bus as repayment for your kind words. ;-)


  Bluntly: I admit I brought this thread to Scott's attention for  
moderation. Because my policy-bluntness incites angry responses on a  
slightly-more-than-average basis, Scott naturally assumed I was  
involved. Normally, he'd have been right. (sigh) Such is my  
reputation ... :-D


  If you have a response (ie, You're right, you're an a**h***!),  
please do so off-list.


--
I.S.




___

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

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

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

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


[moderator] Re: [moderator] Re: About Posting [ end of this thread ]

2009-07-29 Thread Scott Anguish

Yes, an assumption on my part.

but let's call this the end... we have code to write



On 2009-07-29, at 6:56 PM, I. Savant wrote:


On Jul 29, 2009, at 5:43 PM, Scott Anguish wrote:

With particular respect to Idiot Savant. Email can easily convolute  
nuance. While he posts with a screen-name rather than his real  
name, he knows his stuff.


 Sorry, Scott, to follow up on this thread, but I felt the need to  
correct this and relieve you of the need to decide whether to throw  
me under the bus as repayment for your kind words. ;-)


 Bluntly: I admit I brought this thread to Scott's attention for  
moderation. Because my policy-bluntness incites angry responses on a  
slightly-more-than-average basis, Scott naturally assumed I was  
involved. Normally, he'd have been right. (sigh) Such is my  
reputation ... :-D


 If you have a response (ie, You're right, you're an a**h***!),  
please do so off-list.




___

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

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


adding PDF annotations to the output of a regular NSView

2009-07-29 Thread Martin Wierschin

Hello Everyone,

I have a regular NSView hierarchy that saves out to PDF just fine.  
It's wonderful that the drawing/printing system on OSX is unified the  
way it is.


Here's the addition: I'd like to link parts of my NSViews together,  
eg: if the user opens the saved PDF in Preview.app, clicking in some  
special region will take them to another part of the same PDF. It  
looks like PDFKit has exactly something for this, PDFAnnotationLink.  
Unfortunately one can only apply such an object in the context of a  
PDFPage/PDFView.


So the problem is that there doesn't seem to be any way of marrying  
these two systems together. Ideally there would be some Cocoa method I  
could call in my NSView's drawRect method to add PDF annotations. But  
the only solution I see is something like this:


1. Produce raw PDF data from my normal NSView hierarchy.
2. Load that NSView data into a PDFView.
3. Add PDFAnnotations to special regions as desired.
4. Resave the modified PDF data from the PDFView.

This seems very inefficient and error prone (eg: mapping coordinates  
between NSView and PDF page space). Is this really the best option  
available? Thanks for any sanity checks on this.


Cheers,
~Martin

___

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

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


[NSEvent data1]

2009-07-29 Thread kvic...@pobox.com

i'm building a 64bit app.

in response to USB input, i create and post an application defined 
event. for the data1 field, i pass the address of an 
NSMutableDictionary as follows:


... data1: (NSInteger)dataDict ...

in my application object's sendEvent override, i'm only getting (via 
[anEvent data1]) the bottom 32 bits of the address i passed in.


the data1 method of NSEvent is defined to return an NSInteger, as is 
the data1 parameter of the NSEvent method otherEventWithType, and if 
i examining the value of data1 after i've created my custom event and 
posted it (but prior to receiving/processing it in sendEvent), it 
contains the proper 64 bit value.


so it appears that somewhere between posting the event and its 
getting processed by [NSApp sendevent:] the parameter is getting 
truncated to 32 bits. is this a bug in the 64 bit runtime? or a bug 
in my understanding? and if not a misunderstanding on my part, anyone 
know of a workaround (other my simply decomposing the 64bit address 
manually into 2 32bit pieces and using data1 and data2)?


thanx,
ken

ps. running on leopard 10.5.7, with Xcode 3.1.3.

___

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

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

2009-07-29 Thread Jesper Storm Bache
This is not a problem with your understanding, but a known problem on  
10.5:
6361482 AppKit 64 bit truncation of data1 and data2 when posting a  
custom event

For 10.5 splitting up the data is probably the best way to go

Jesper Storm Bache

On Jul 29, 2009, at 4:52 PM, kvic...@pobox.com wrote:


i'm building a 64bit app.

in response to USB input, i create and post an application defined
event. for the data1 field, i pass the address of an
NSMutableDictionary as follows:

... data1: (NSInteger)dataDict ...

in my application object's sendEvent override, i'm only getting (via
[anEvent data1]) the bottom 32 bits of the address i passed in.

the data1 method of NSEvent is defined to return an NSInteger, as is
the data1 parameter of the NSEvent method otherEventWithType, and if
i examining the value of data1 after i've created my custom event and
posted it (but prior to receiving/processing it in sendEvent), it
contains the proper 64 bit value.

so it appears that somewhere between posting the event and its
getting processed by [NSApp sendevent:] the parameter is getting
truncated to 32 bits. is this a bug in the 64 bit runtime? or a bug
in my understanding? and if not a misunderstanding on my part, anyone
know of a workaround (other my simply decomposing the 64bit address
manually into 2 32bit pieces and using data1 and data2)?

thanx,
ken

ps. running on leopard 10.5.7, with Xcode 3.1.3.

___

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

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

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

This email sent to jsba...@adobe.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: adding PDF annotations to the output of a regular NSView

2009-07-29 Thread John Calhoun

On Jul 29, 2009, at 4:44 PM, Martin Wierschin wrote:
So the problem is that there doesn't seem to be any way of marrying  
these two systems together. Ideally there would be some Cocoa method  
I could call in my NSView's drawRect method to add PDF annotations.  
But the only solution I see is something like this:


1. Produce raw PDF data from my normal NSView hierarchy.
2. Load that NSView data into a PDFView.
3. Add PDFAnnotations to special regions as desired.
4. Resave the modified PDF data from the PDFView.


I'll start by pointing out that Step 2 is not necessary.   Adding  
annotations in PDF Kit is done at the PDFDocument level.  The  
PDFDocument you will have created from your raw PDF data (from Step  
1).  The PDFView is strictly for display purposes.


As well then Step 4 more accurately would be re-save the modified  
PDFDocument as PDF data.


This seems very inefficient and error prone (eg: mapping coordinates  
between NSView and PDF page space). Is this really the best option  
available?


Mapping points from NSView to page space is not an issue.  Since the  
PDF data came from your NSView to begin with you can use the same  
coordinates you used in the NSView. So for example if the special  
region was of some bounds (NSRect) in the NSView you can use this same  
rect to create your PDFAnnotation and add it in PDF Kit.


But if you wanted a more straightforward model (and I understand that  
NSView-PDF data-PDFDocument is a bit of a kludge) you could replace  
your NSView with a subclass of PDFPage and display with a PDFView.  It  
depends on your application though ... how much of a kludge this  
approach would be (you could simply be trading one kludge for  
another :-)).


But in essence to do this a PDFView replaces the NSView and rather  
than overriding -[drawRect] as you might for NSView, you create a  
PDFPage subclass of your own and override the page's -[drawWithBox:]  
method as the place to draw your own content. You add your page to an  
empty PDFDocument and display this document in the PDFView.


To be clear above, the PDFPage is not a view classes but does have a  
draw method that is called by PDFView to display the page content. For  
a PDF you find laying around, the default implementation of PDFPage is  
to call upon the PDF data to render the specified page. Your subclass  
allows you to draw whatever you like.


The advantage to the above approach is that you can in fact add the  
PDFAnnotation prior to saving and have it actually function within  
your application (since PDFView will handle the mouseDown in the  
annotation).  And then as well you get zoom controls and all that with  
the PDFView class


But as I say, it sort of depends on your app.  If your app is an  
appoinment calendar then writing it to live within a PDFView is a bit  
of a stretch. :-)


John Calhoun—

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: adding PDF annotations to the output of a regular NSView

2009-07-29 Thread Martin Wierschin

Hi John,

So the problem is that there doesn't seem to be any way of marrying  
these two systems together. Ideally there would be some Cocoa  
method I could call in my NSView's drawRect method to add PDF  
annotations. But the only solution I see is something like this:


1. Produce raw PDF data from my normal NSView hierarchy.
2. Load that NSView data into a PDFView.
3. Add PDFAnnotations to special regions as desired.
4. Resave the modified PDF data from the PDFView.


I'll start by pointing out that Step 2 is not necessary.   Adding  
annotations in PDF Kit is done at the PDFDocument level.  The  
PDFDocument you will have created from your raw PDF data (from Step  
1).  The PDFView is strictly for display purposes.


As well then Step 4 more accurately would be re-save the modified  
PDFDocument as PDF data.


This seems very inefficient and error prone (eg: mapping  
coordinates between NSView and PDF page space). Is this really the  
best option available?


Mapping points from NSView to page space is not an issue.  Since the  
PDF data came from your NSView to begin with you can use the same  
coordinates you used in the NSView. So for example if the special  
region was of some bounds (NSRect) in the NSView you can use this  
same rect to create your PDFAnnotation and add it in PDF Kit.


Thanks very much for your reply. I'm glad to known the process seemed  
more convoluted than it actually is. I am happily reassured by your  
advice.


you could replace your NSView with a subclass of PDFPage and display  
with a PDFView.  It depends on your application though ... how much  
of a kludge this approach would be (you could simply be trading one  
kludge for another :-)).


Yeah, no thanks :P  My view hierarchy is a large network of multi- 
container NSTextViews and other custom views nested/chained together.  
Slicing it up for PDFView consumption would be a real nightmare.


Thanks again,

~Martin

___

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

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


Binding collection view label through two entities

2009-07-29 Thread Rick Mann
I've got a couple of entities, Foo and Bar. A Foo has a relation to a  
Bar.


I've created a CollectionView that works well enough displaying a  
property of the Foos it lists, but can't seem to show the property of  
the associated Bars. It shows the same Bar property for each Foo it  
lists.


The view has two text fields. The first is bound to the collectionview  
item's representedObject.text property (this is a Foo property). The  
other field is bound to the collectionview item's  
representedObject.bar.name property. This is the one that is the same  
for each of the different Foos.


If I iterate the list of Foos in the code, and dump foo.bar.name, it  
does the right thing.


Is this a problem in NSCollectionView (which is set up in IB)? Or am I  
doing something wrong elsewhere.


Thanks!
--
Rick

___

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

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

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

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


NSUserDefault and Negative numerical arguments (Was: Posting mouse clicks with multiple displays)

2009-07-29 Thread DeNigris Sean
When using NSUserDefaults to get command line arguments, it doesn't  
seem to handle negative numbers correctly.

In main.m:
  NSUserDefaults *args = [NSUserDefaults standardUserDefaults];

  int x = [args integerForKey:@x];
  int y = [args integerForKey:@y];
If the command line is MyApp -x -100 -y 100, NSUserDefaults does not  
recognize the -100 as the value of the x argument - it sets x to 0.   
If the '-' is removed, everything is fine.  Is this a bug?  Is there a  
way around?

Thanks again!
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: where can I download xcode 3.2

2009-07-29 Thread YongLi
Thanks everybody.
I have found it.

On Thu, Jul 30, 2009 at 4:17 AM, Henry McGilton (Boulevardier) 
appledevelo...@trilithon.com wrote:


 On Jul 28, 2009, at 12:22 AM, Kyle Sluder wrote:

  On Jul 27, 2009, at 10:38 AM, YongLi liyon...@gmail.com wrote:

  I have installed the snow leopardbut i can't find the download link of
 xcode
 3.2


 1. This is cocoa-dev. This list exists for the discussion of Cocoa, not
 for downloading seeds or other non-Cocoa topics.


  2. Snow Leopard and the developer tools are distributed under NDA and you
 therefore can't talk about them publicly. NDA forums can be found at
 http://devforums.apple.com.


  3. All the downloads are in the same place: the Mac dev center at
 http://developer.apple.com.


 True, all the downloads are in the same place as you said.However, the
 answer to the OP's
 question can be found by carefully paying attention to the (publicly
 available PDF document) on
 that very download site

iPhone SDK 3.0 (Snow Leopard) Read Me

Cheers,
. . . . . . . .Henry


 ___

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

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

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

 This email sent to liyon...@gmail.com




-- 
Name: Yong Li
E-mail: liyon...@gmail.com
Address: Room 3-523, FIT Building, Tsinghua University, Beijing, China.
100084.
___

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

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


Binding to an array of NSStrings stored in an application's preferences

2009-07-29 Thread A B
OK, I'm feeling really REALLY stupid for asking this question, but I've managed 
to stump myself so hard that I doubt I have the proper detachment to figure out 
the answer for myself any more.  My apologies in advance...

I have been playing around with bindings for a while now and LOVE them.  That 
and the KVO/KVC conventions built into Objective-C 2.0 have allowed me to 
dramatically slim down my applications while increasing their reliability, 
flexibility, etc.  I say this for no other reason than to illustrate that I am 
at least moderately comfortable with bindings in general.  That being said, my 
problem is this:

I have an application where I'd like to store an editable set of keywords by 
way of the preferences controller.  Easy, right?  Unfortunately, for the life 
of me I can't figure out how to do it.  I set up an array controller and point 
it to the shared preferences object and give it a keypath for the array.  The 
problem is that the objects being stored in the array are NSStrings and I don't 
see how NSStrings can be KVC-compliant for this kind of operation due to the 
lack of any stringValue/setStringValue methods.  Without those, what keypath 
do I use in the NSTableView I have set up to facilitate manipulation of that 
list?

Also, since the shared preferences object is not one that I own, I'm not sure 
how to go about setting up a new array to represent an unedited/newly installed 
state.  (Registering them as defaults doesn't seem to be working for me.)

So to reiterate my questions more succinctly: How can you bind a table view to 
an array of NSStrings and how can you store said array in an application's 
preferences?

Any pointers or advice that you can offer would be VERY much appreciated.  The 
headaches I'm getting from this are starting to get the better of me. :)
___

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

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


Listening to Eject command

2009-07-29 Thread Farooq zaman

Hi Everyone,

For some reasons, I need to customize (or listen to) Eject command. I  
want this to happen before system actually do something with the  
device i.e eject disc or shows up some error. I want to perform some  
operation on disc before system ejects it.


I tried to do it using DRNotificationCenter but that sends  
notification when the disc has already been ejected.


Any help would be highly appreciated.

Farooq Zaman-


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Binding to an array of NSStrings stored in an application's preferences

2009-07-29 Thread Graham Cox


On 30/07/2009, at 8:15 AM, A B wrote:

Without those, what keypath do I use in the NSTableView I have set  
up to facilitate manipulation of that list?



I'm not sure I've fully followed your question, since I'm not as up  
with bindings as you are, but I'm just wondering: have you overlooked  
the fact that @self is a valid keypath or keypath component? If the  
array holds strings and you are binding to the string itself, its  
value is self.


I hope I haven't misunderstood...

--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: Listening to Eject command

2009-07-29 Thread Dave Keck
I believe you can use even taps for this. Check out:

http://developer.apple.com/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html#//apple_ref/c/func/CGEventTapCreate
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSUserDefault and Negative numerical arguments (Was: Posting mouse clicks with multiple displays)

2009-07-29 Thread Bill Bumgarner

On Jul 29, 2009, at 8:22 PM, Bill Bumgarner wrote:


On Jul 29, 2009, at 7:09 PM, DeNigris Sean wrote:
When using NSUserDefaults to get command line arguments, it doesn't  
seem to handle negative numbers correctly.

In main.m:
NSUserDefaults *args = [NSUserDefaults standardUserDefaults];

int x = [args integerForKey:@x];
int y = [args integerForKey:@y];
If the command line is MyApp -x -100 -y 100, NSUserDefaults does  
not recognize the -100 as the value of the x argument - it sets x  
to 0.  If the '-' is removed, everything is fine.  Is this a bug?   
Is there a way around?


Yes-- -100 is parsed as an argument, not as a value to the previous  
argument.


So, no, it isn't a bug.  It is behaving correctly, for some values of  
correct.   Welcome to shell programming  the interface between shell  
 process.  Fragile space. Coder beware.


If you are writing a command line tool, you'll want to use a parsing  
API that actually lets you specify arguments more completely.


man 3 getopt

That'll give you a start.  But I'd recommend Dave Dribin's DDCLI  
stuff;  http://www.dribin.org/dave/blog/archives/2008/04/29/ddcli/


If this is a Cocoa application, you'll want to do the command line  
parsing *before* NSApplicationMain() is called as it'll munch the  
arguments beyond recovery IIRC.


b.bum
___

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

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


UIWebView: prevent from displaying menu, Copy.

2009-07-29 Thread norio ota

Hi,

I'd like to prevent UIWebView from selecting an area and showing the  
Copy menu item.


I tried subclassing it and implementing touchesEnded:withEvent:.
But since I don't know if double-tap is the exact way to show the  
menu, I'm not sure if I omit the event using the topped count.
Furthermore, even if I placed a breakpoint at the beginning of the  
method, Debugger doesn't stop there.


For your info, the subclass has becomeFirstResponder method, and it is  
to return YES.


Any suggestions would be very appreciated.

Best regards,
Norio
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Binding to an array of NSStrings stored in an application's preferences

2009-07-29 Thread Rob Keniger


On 30/07/2009, at 8:15 AM, A B wrote:

I have an application where I'd like to store an editable set of  
keywords by way of the preferences controller.  Easy, right?   
Unfortunately, for the life of me I can't figure out how to do it.   
I set up an array controller and point it to the shared preferences  
object and give it a keypath for the array.  The problem is that the  
objects being stored in the array are NSStrings and I don't see how  
NSStrings can be KVC-compliant for this kind of operation due to the  
lack of any stringValue/setStringValue methods.  Without those,  
what keypath do I use in the NSTableView I have set up to facilitate  
manipulation of that list?


Also, since the shared preferences object is not one that I own, I'm  
not sure how to go about setting up a new array to represent an  
unedited/newly installed state.  (Registering them as defaults  
doesn't seem to be working for me.)



You can't do this with an array of NSStrings, you have to work with  
strings encapsulated as properties of an object, such as an  
NSDictionary. So you need an array of dictionaries which contain a  
string object for a particular key.


Something like:

NSArray* prefs = [NSArray arrayWithObjects:
 [NSMutableDictionary dictionaryWithObject:@One forKey:@name],
 [NSMutableDictionary dictionaryWithObject:@Two forKey:@name],
 [NSMutableDictionary dictionaryWithObject:@Three forKey:@name],
 nil];

NSDictionary* defaults = [NSDictionary dictionaryWithObject:prefs  
forKey:@MyDefaults];

[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];

Then you can do this:

- instantiate an NSArrayController in your nib and set its Class Name  
field to NSMutableDictionary (the default).
- bind it to the Shared User Defaults Controller with a Controller Key  
of values and a Model Key that is the preferences key you want to  
store/edit (MyDefaults in the example above).
- make sure you check the Handles content as a compound value  
checkbox or editing will not work.
- bind the value of the table column to your NSArrayController's  
arrangedObjects key with a Model Key of name or whatever you set up  
in your dictionary.



--
Rob Keniger



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Binding to an array of NSStrings stored in an application's preferences

2009-07-29 Thread Quincey Morris

On Jul 29, 2009, at 19:58, Graham Cox wrote:

I'm not sure I've fully followed your question, since I'm not as up  
with bindings as you are, but I'm just wondering: have you  
overlooked the fact that @self is a valid keypath or keypath  
component? If the array holds strings and you are binding to the  
string itself, its value is self.


I hope I haven't misunderstood...


You're correct as far as getting the strings is concerned, but  
unfortunately self won't work for changing the string value, which  
the OP also asked for.


Weirdly, NSMutableString has a setString: instance method, so I  
think if you add a string instance method to NSString (via a  
category, with the method just returning self), you end up with a  
valid string property which can be bound to. :)


I *think* I actually tried that once and it worked.

But it's more of a curiosity than anything else:

1. It's likely in the OP's case that actually changing one of the  
strings ought to ripple through to all the objects that have a  
matching string value. It's unlikely that just changing the defaults- 
resident string is enough.


2. It's almost as easy to wrap a string in an object with a string  
property.


Putting those 2 reasons together, I think about 5 minutes after  
getting the string-binding thing working you'd end up using a smarter  
object anyway.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: UIWebView: prevent from displaying menu, Copy.

2009-07-29 Thread glenn andreas
Go to devforums.apple.com/community/iphone and search there - this has  
been discussed, with solutions, there...


Sent from my iPhone

On Jul 29, 2009, at 10:35 PM, norio ota notty@gmail.com wrote:


Hi,

I'd like to prevent UIWebView from selecting an area and showing the  
Copy menu item.


I tried subclassing it and implementing touchesEnded:withEvent:.
But since I don't know if double-tap is the exact way to show the  
menu, I'm not sure if I omit the event using the topped count.
Furthermore, even if I placed a breakpoint at the beginning of the  
method, Debugger doesn't stop there.


For your info, the subclass has becomeFirstResponder method, and it  
is to return YES.


Any suggestions would be very appreciated.

Best regards,
Norio
___

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

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

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

This email sent to gandr...@mac.com

___

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

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

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

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


Re: Listening to Eject command

2009-07-29 Thread Ed Wynne


On Jul 29, 2009, at 9:12 PM, Farooq zaman wrote:

For some reasons, I need to customize (or listen to) Eject command.  
I want this to happen before system actually do something with the  
device i.e eject disc or shows up some error. I want to perform some  
operation on disc before system ejects it.


I tried to do it using DRNotificationCenter but that sends  
notification when the disc has already been ejected.



DR is for DiscRecording, you want DA for DiskArbitration.  
Specifically, either DARegisterDiskUnmountApprovalCallback() or  
DARegisterDiskEjectApprovalCallback().


-Ed



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: Cahnging bgColor of a UIView not working.

2009-07-29 Thread Henry McGilton (Boulevardier)


On Jul 29, 2009, at 11:27 AM, Eric E. Dolecki wrote:


This is good to use:
#define UIColorFromRGB(rgbValue) [UIColor \ colorWithRed:((float) 
((rgbValue
 0xFF)  16))/255.0 \ green:((float)((rgbValue  0xFF00)   
8))/255.0

\ blue:((float)(rgbValue  0xFF))/255.0 alpha:1.0]

cell.textColor = UIColorFromRGB(0x33);

On Wed, Jul 29, 2009 at 1:04 PM, Brian Slick briansl...@mac.com  
wrote:



On Jul 29, 2009, at 12:56 PM, David Duncan wrote:

On Jul 29, 2009, at 4:52 AM, Brandon Walkin wrote:


The arguments to that UIColor method should be in the range of 0  
to 1.

Divide each RGB value by 255 to get them into that range.



This is more of a PSA than anything (because I've seen more than a  
fair
share of devs slap themselves on the head here too): Always ensure  
your
using floating point division if your going to do this. That means  
always
dividing by 255.0. I've seen too many people asking why do I  
always get

black and pointed out because you forgot the .0 :).
--
David Duncan
Apple DTS Animation and Printing


*jaw dropping*

Well, I guess that explains that.  I finally just gave up and did  
the math

myself.

Good tip, thanks!
Brian


What I've always wondered in this particular context of our color  
component specifications
ranging from 0.0 to 1.0 is why the System RGB color chooser displays  
the component
values in the range 0 to 255?   You'd think by now there'd be a  
'Developer Friendly'

version of the chooser . . .

Cheers,
. . . . . . . .Henry


___

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

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