RE: interact with users in a background app

2008-12-08 Thread BirdSong

yep Date: Mon, 8 Dec 2008 02:56:59 -0500 From: [EMAIL PROTECTED] To: [EMAIL 
PROTECTED] Subject: Re: interact with users in a background app CC: 
cocoa-dev@lists.apple.com  On Mon, Dec 8, 2008 at 2:14 AM, BirdSong [EMAIL 
PROTECTED] wrote: Hi all,I want to add a window to a background application 
in order to interact with users sometimes. However, I found the window I added 
is not a keywindow or so because I can not type in the textField which located 
in the window... Does any one know how to solve this problem, I mean edit in 
the window which in a background application.Thanks a lot!  Background 
application?  Like something that launchd starts?  Have you read TN2083 
(Daemons and Agents)? http://developer.apple.com/technotes/tn2005/tn2083.html 
 --Kyle Sluder
_
超炫人气榜给您所有偶像的最新资讯和排名,快来支持自己的偶像!
http://cnweb.search.live.com/xrank/results.aspx?q=%e5%91%a8%e6%9d%b0%e4%bc%a6FORM=MSNH
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Access to this item is restricted?

2008-12-08 Thread Kyle Sluder
On Sun, Dec 7, 2008 at 9:16 AM, Robert Nicholson
[EMAIL PROTECTED] wrote:
 Is there a way to correct that?

Have you tried Get Info on the items in Keychain Access.app?

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Fixed width of left pane in NSSplitView

2008-12-08 Thread Jushin
I would like to have fixed with of the left pane in NSSplitView when I
resize the window,
and I found this code from google search.
http://www.cocoabuilder.com/archive/message/cocoa/2008/3/28/202614

It says,

===
Your split view delegate should implement the following method:

-(void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:
(NSSize)oldSize
===

However, I have no idea how to do this. Should I create a subclass of
NSSplitView?
___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: interact with users in a background app

2008-12-08 Thread BirdSong

you can simply create a cocoa application, add a item in the Info.plist which 
the key is Application Background Only, value is YES. Then add some 
textField, colorWell (or any other editable control )on the window in nib. you 
will find the reaction is not what you want... Date: Mon, 8 Dec 2008 02:56:59 
-0500 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: interact 
with users in a background app CC: cocoa-dev@lists.apple.com  On Mon, Dec 8, 
2008 at 2:14 AM, BirdSong [EMAIL PROTECTED] wrote: Hi all,I want to add a 
window to a background application in order to interact with users sometimes. 
However, I found the window I added is not a keywindow or so because I can not 
type in the textField which located in the window... Does any one know how to 
solve this problem, I mean edit in the window which in a background 
application.Thanks a lot!  Background application?  Like something that 
launchd starts?  Have you read TN2083 (Daemons and Agents)? htt
 p://developer.apple.com/technotes/tn2005/tn2083.html  --Kyle Sluder
_
新版客服页面提供最新MSN客服资讯,助您轻松解决问题。
http://help.cn.msn.com/Cs.html
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fixed width of left pane in NSSplitView

2008-12-08 Thread Benjamin Dobson


On 8 Dec 2008, at 08:03:51, Jushin wrote:


However, I have no idea how to do this. Should I create a subclass of
NSSplitView?


No. Just wire up a different object as the delegate for your split view.
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSArrayController, NSPopupMenu, defaults and arrangedObjects

2008-12-08 Thread Steven Hamilton

Hi folks,
I've got a single NSPopupButton. The content is bound to an  
NSArrayController arrangedObjects and value bound an attribute. All  
good. THe ArrayController is sourcing a Core Data store for its array  
and this is all good too. The problem is when the window is loaded the  
NSPopupButton is showing No Value which I assume is because it  
hasn't been told which object in the array it should be showing by  
default. I have the NSPopupButton SelectedObject bound to an  
NSManageObject *selectedAccount variable in my custom window controller.


Moving the NSPopup correctly points my selectedObject variable at the  
object chosen. However, in my attempts to remove the default No  
Value I'm attempting to set the SelectedObject variable to the first  
object in the array.


selectedObject = [[myArrayController arrangedObjects] objectAtIndex:0];

This doesn't work as the arrangedObject array is empty. NSLog returns  
a count of zero.


This is the correct way to set the default on an NSPopup isn't it? I  
set the bound selectedValue, not the control itself. Why is my  
arrangedObjects array empty on window load?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fixed width of left pane in NSSplitView

2008-12-08 Thread Jushin
Could you tell me more in detail?
It makes me more confusing :(
Sorry for novice question.

On Mon, Dec 8, 2008 at 3:29 AM, Benjamin Dobson
[EMAIL PROTECTED] wrote:

 On 8 Dec 2008, at 08:03:51, Jushin wrote:

 However, I have no idea how to do this. Should I create a subclass of
 NSSplitView?

 No. Just wire up a different object as the delegate for your split view.
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fixed width of left pane in NSSplitView

2008-12-08 Thread Brandon Walkin
Feel free to use the -splitView:resizeSubviewsWithOldSize: delegate  
method implementation from this class:

http://www.bitbucket.org/bwalkin/bwtoolkit/src/tip/BWAnchoredButtonBar.m

It keeps all views except the right most view at a constant width when  
the window is resized.


To incorporate this in your app, just copy the method into a class of  
yours and set it as the split view's delegate using the -setDelegate:  
method. You can read more about delegation in the docs: http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html


Cheers,
Brandon

On 8-Dec-08, at 4:07 AM, Jushin wrote:


Could you tell me more in detail?
It makes me more confusing :(
Sorry for novice question.

On Mon, Dec 8, 2008 at 3:29 AM, Benjamin Dobson
[EMAIL PROTECTED] wrote:


On 8 Dec 2008, at 08:03:51, Jushin wrote:

However, I have no idea how to do this. Should I create a subclass  
of

NSSplitView?


No. Just wire up a different object as the delegate for your split  
view.

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Unit Testing Frameworks

2008-12-08 Thread Chris Hanson

On Dec 7, 2008, at 8:11 PM, Thaddeus Cooper wrote:

Now that that's fixed I'm trying to get debugging of the framework  
working and I keep getting a launch path not accessible error. I  
added the executable target and set the arguments to


-SenTest All
Section Tests.octest


This will be interpreted as 4 arguments, not the 3 that it needs to  
be; as a convenience, Xcode will let you put multiple arguments  
separated by spaces in a single entry in the Arguments table.


Try putting quotes around the name of your test bundle, e.g. Section  
Tests.octest, so it's interpreted as a single argument.


  -- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSKeyedArchiver XML output?

2008-12-08 Thread Stephen J. Butler
On Mon, Dec 8, 2008 at 3:44 AM, Devraj Mukherjee [EMAIL PROTECTED] wrote:
 I am trying to get an sample project that demos NSKeyedArchiver to
 write in the XML format,

 All I can see is a call to a message
 [NSKeyedArchiver archiveRootObject: rootObject toFile: path];

 how do I instruct NSKeyedArchiver to write in its XML format?

alloc and use initForWritingWithMutableData: (take a look at the doc
for this method for instructions). Before encoding anything you can
call setOutputFormat: and get XML put into your mutable data instance.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Monitor Magic packet(wake on lan packet )

2008-12-08 Thread Andrew Farmer

On 08 Dec 08, at 02:55, sheen mac wrote:

In my app,I want to monitor the magic packet .
Where I will get more info about this. Could
give some link for this?.


http://en.wikipedia.org/wiki/Wake-on-LAN


I found a command tcpdump,
Could I use this for wol packet monitoring?


Not very well... the machine is necessarily asleep or turned off when  
it receives the packet, so tcpdump isn't running. Wake-on-LAN is  
implemented in hardware, and can be enabled in OS X from the Energy  
Saver prefpane, under the Options tab (Wake for Ethernet network  
administrator access).

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to use NSWorkspace?

2008-12-08 Thread Rob Keniger


On 08/12/2008, at 8:59 PM, Mike Abdullah wrote:

You probably don't want to use NSWorkspace to do this. You should  
use NSTask to run command line tools.




I'm pretty certain he's doing the reverse. Wants to launch a proper  
application FROM a command-line tool.



Yeah, you're right, sorry about that. Wrote it before my coffee :-)

--
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 [EMAIL PROTECTED]


NSKeyedArchiver XML output?

2008-12-08 Thread Devraj Mukherjee
Hi all,

I am trying to get an sample project that demos NSKeyedArchiver to
write in the XML format,

All I can see is a call to a message
[NSKeyedArchiver archiveRootObject: rootObject toFile: path];

how do I instruct NSKeyedArchiver to write in its XML format?

-- 
I never look back darling, it distracts from the now, Edna Mode (The
Incredibles)
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: PackageMaker installing into /Applications or ~/Applications depending on admin or not?

2008-12-08 Thread Stéphane Sudre


On Dec 8, 2008, at 6:48 AM, Chris Markle wrote:


We have an installer for our current app that use Vise. We'd like to
switch maybe to PackageMaker and its artifacts. One thing that the
Vise-created install does is get installed to /Applications if you're
and admin and to ~/Applications if you're a standard user. Does anyone
know if PackageMaker does the same thing? Or can it be motivated to do
so? I plan on trying this myself but I'm a PackageMaker newby and am
concerned about the influence of various settings on my experiments...


This might be possible if:

- you're using PackageMaker 3

- you're targeting Mac OS X 10.5

Selecting Installation Destination to be Both System Volume and User  
Home directory would be the solution.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSKeyedArchiver XML output?

2008-12-08 Thread Graham Cox


On 8 Dec 2008, at 8:44 pm, Devraj Mukherjee wrote:


Hi all,

I am trying to get an sample project that demos NSKeyedArchiver to
write in the XML format,

All I can see is a call to a message
[NSKeyedArchiver archiveRootObject: rootObject toFile: path];

how do I instruct NSKeyedArchiver to write in its XML format?



Like so:


NSMutableData*  data = [[NSMutableData alloc] init];
	NSKeyedArchiver*	karch = [[NSKeyedArchiver alloc]  
initForWritingWithMutableData:data];


[karch setOutputFormat:NSPropertyListXMLFormat_v1_0];
[karch encodeObject:myArchivableRootObject forKey:@root];
[karch finishEncoding];
[karch release];

return [data autorelease];



hth,

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 [EMAIL PROTECTED]


Re: How to use NSWorkspace?

2008-12-08 Thread Mike Abdullah


On 8 Dec 2008, at 00:45, Rob Keniger wrote:



On 08/12/2008, at 10:07 AM, John Velman wrote:


I want to use NSWorkspace to open an application from a command line
Foundation Tool.



You probably don't want to use NSWorkspace to do this. You should  
use NSTask to run command line tools.




I'm pretty certain he's doing the reverse. Wants to launch a proper  
application FROM a command-line tool.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSArrayController, NSPopupMenu, defaults and arrangedObjects

2008-12-08 Thread Steven Hamilton

Hi folks,
I've got a single NSPopupButton. The content is bound to an
NSArrayController arrangedObjects and value bound an attribute. All
good. THe ArrayController is sourcing a Core Data store for its array
and this is all good too. The problem is when the window is loaded the
NSPopupButton is showing No Value which I assume is because it
hasn't been told which object in the array it should be showing by
default. I have the NSPopupButton SelectedObject bound to an
NSManageObject *selectedAccount variable in my custom window  
controller.


Moving the NSPopup correctly points my selectedObject variable at the
object chosen. However, in my attempts to remove the default No
Value I'm attempting to set the SelectedObject variable to the first
object in the array.

selectedObject = [[myArrayController arrangedObjects] objectAtIndex: 
0];


This doesn't work as the arrangedObject array is empty. NSLog returns
a count of zero.

This is the correct way to set the default on an NSPopup isn't it? I
set the bound selectedValue, not the control itself. Why is my
arrangedObjects array empty on window load?


My, is that english? I really need to slow down a bit. I'll try and  
explain a bit better.


I have a custom NSWindowController called budgetController. Interface  
thus (cropped a bit)


@interface MLBudgetController : NSWindowController {

IBOutlet NSArrayController *incomeEnvelopeController;
NSManagedObject *selectedIncomeEnvelope;
}

My window has an NSPopupButton bound to my NSArraycontroller  
*incomeEnvelopeController. The selectedObject binding is bound to the  
selectedIncomeEnvelope above. The controller sources Core Data for my  
Envelope entities and on running, it fetches and displays the set of  
entities fine showing the correct values. It also sets the  
selectedIncomeEnvelope fine too.


But on first load I have a No Value in the popup. Selecting an entry  
removes the No Value from the list. In my budgetController's  
windowDidLoad{} function I'm attempting to set the  
selectedIncomeEnvelope to the first object in the array like so;


selectedIncomeEnvelope= [[incomeEnvelopeController arrangedObjects]  
objectAtIndex:0];


However, the arrangedObjects array, while existing, contains zero  
objects. I've checked the Outlet is connected ok. A timing issue of  
some sort?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSKeyedArchiver XML output?

2008-12-08 Thread Graham Cox


On 8 Dec 2008, at 9:24 pm, Devraj Mukherjee wrote:


I assume that the NSMutableData Object *data would have the XML
content. What do I need to do to get the XMLString out of that?



To write it to a file, just use NSData's -writeToFile:atomically:  
method.


If you want to convert the NSData bytes to a string containing the  
XML, I'm not sure how to do that, but:


[NSString initWithData: encoding:] looks promising...


But if I'm way off here others are sure to know.

hth,

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 [EMAIL PROTECTED]


Monitor Magic packet(wake on lan packet )

2008-12-08 Thread sheen mac
Hi All,

In my app,I want to monitor the magic packet .
Where I will get more info about this. Could 
give some link for this?.I found a command tcpdump,
Could I use this for wol packet monitoring?.

Thanks In Advance,
Sheen


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Monitor Magic packet(wake on lan packet )

2008-12-08 Thread Jason Stephenson

sheen mac wrote:

In my app,I want to monitor the magic packet .
Where I will get more info about this. Could 
give some link for this?.I found a command tcpdump,

Could I use this for wol packet monitoring?.


As Andrew Farmer pointed out, you don't typically monitor for the magic 
packet, since it is used to wake your computer from sleep or to turn it 
on remotely.


The packet is sent as an UDP broadcast on the LAN and can be sent to any 
port, though port 9 seems to be commonly used among the sample WOL 
broadcaster apps available on the 'Net.


If you wanted to monitor for WOL broadcasts on your LAN, then you might 
want to monitor port 9 for incoming UDP connections and log anything 
that arrives. I'm pretty sure that tcpdump can do that, though I've 
never used it. If you're trying to debug an existing WOL application, 
then you'll want to listen on whatever port it sends to.


A WOL monitor would make for a decent first server exercise for a class 
in network programming. Bonus points to the student who can explain why 
WOL won't work over IPv6.



Cheers,
Jason
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how to manage two nib files

2008-12-08 Thread XiaoGang Li
Thanks. I have read these references, but I still have no idea about my
issue, Maybe I did not understand them completely now, but I am worried that
maybe I have not give a clear expression in my first email. Maybe I need
give a more detailed description:

   this application is a utility for my printer, which be launched
by the utility button on the Printer Setup Center. when user click the
utility button, the Mac OS X will launch the linked application. and the
application should first register an apple event, the Mac OS X then will
send the apple event which used to tell my utility the printer model name
and related information about the device. So, before the appliction be
launched, it should get the apple  event and check the printer name, then it
will load the nib file dependently. If the printer is a USB printer, it will
load a normal window to interact with user, if it is a Network, it will
launch another application to do other things.

So, I have no idea to design this application. I think this
question maybe can not be implemented by cocoa application template, but I
know that it seems no need to use NSDocument class. Thanks.

2008/12/8 Kiel Gillard [EMAIL PROTECTED]

 
 http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindowController_Class/Reference/Reference.html
 
 
 http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/Concepts/WinControllersAndNibs.html#//apple_ref/doc/uid/2026
 
 http://cocoadevcentral.com/articles/64.php

 Hope this helps!

 On 08/12/2008, at 1:47 PM, XiaoGang Li wrote:

  Hi, List,

 I have a question about how to design my applicaiton in Cocoa.

 My applicaiton is not a normal application.  it is a utility for my
 printer device. when user double-click the application icon, the
 application
 first register an apple event before any UI being shown, he application
 will
 receive a apple event from Mac OS later, which tells it that whether the
 device is USB-connected or Network-connected, when the application get
 this
 information, then it will launch the corresponding UI depend on the
 connect
 mode. (there are two nib files, one for USB, another for Network.).

 I have no idea how to manage two nib files, or two window controller.
 I hope soneone can give me some comments. thanks very much.

 XiaogangLi
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Animation proxies and Python

2008-12-08 Thread Mani Ghasemlou
Hello list,

I've been unsuccessfully trying to use an animation proxy for an
NSWindow instance using Python:

For example:


def fadeOut(self, window):
 window.animator().setAlphaValue_(0.0)


causes my application to crash.

Bypassing the proxy, however works:


def fadeOut(self, window):
 window.setAlphaValue_(0.0)


Interestingly, if I invoke the setAlphaValue method on the proxy using
the performSelector method, it works:


def fadeOut(self, window):
 windowProxy = window.animator()
 windowProxy.performSelector_('setAlphaValue:')


The above code will cause the window to animate a fade out to blank,
which is expected because I'm not passing in any parameters and it is
assuming an alpha value of nil or 0. (Note that I am aware of
performSelector_withObject_, but it did not work as expected, probably
because the input parameter is a double and not an NSObject).

Question: Is all of this expected behaviour? If so, what is the best
practice for calling methods on proxy objects like this in Python?

Thanks very much in advance!

Regards,
Mani
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: how to manage two nib files

2008-12-08 Thread jmunson
Not knowing why you need an apple event...here's my two cents (and  
boff on those who don't like my feelings):


1.  find your printer (it is obviously installed, yes?) - you should  
know how to locate that in the Mac's resources. (get a list of  
installed printers/devices, etc.)
2.  you should be able to determine from the installation parameters  
whether it is installed via USB or network.
3.  in your cocoa app, in your main nib, have a an object that uses  
that information to determine which nib to load from there.


If you need information on how to work with nibs, etc., see NSBundle.   
Also, see Hillegass' book Cocoa Programming for Mac OS X Third Edition  
(that's the one I have).  I'm sure there are multiple appropriate  
references available otherwise (incl. Apple dox as previously pointed  
out).


Hope this helps!

Peace, Love, and Light,

/s/ Jon C. Munson II


Quoting XiaoGang Li [EMAIL PROTECTED]:


Thanks. I have read these references, but I still have no idea about my
issue, Maybe I did not understand them completely now, but I am worried that
maybe I have not give a clear expression in my first email. Maybe I need
give a more detailed description:

   this application is a utility for my printer, which be launched
by the utility button on the Printer Setup Center. when user click the
utility button, the Mac OS X will launch the linked application. and the
application should first register an apple event, the Mac OS X then will
send the apple event which used to tell my utility the printer model name
and related information about the device. So, before the appliction be
launched, it should get the apple  event and check the printer name, then it
will load the nib file dependently. If the printer is a USB printer, it will
load a normal window to interact with user, if it is a Network, it will
launch another application to do other things.

So, I have no idea to design this application. I think this
question maybe can not be implemented by cocoa application template, but I
know that it seems no need to use NSDocument class. Thanks.

2008/12/8 Kiel Gillard [EMAIL PROTECTED]



http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindowController_Class/Reference/Reference.html


http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/Concepts/WinControllersAndNibs.html#//apple_ref/doc/uid/2026

http://cocoadevcentral.com/articles/64.php

Hope this helps!

On 08/12/2008, at 1:47 PM, XiaoGang Li wrote:

 Hi, List,


I have a question about how to design my applicaiton in Cocoa.

My applicaiton is not a normal application.  it is a utility for my
printer device. when user double-click the application icon, the
application
first register an apple event before any UI being shown, he application
will
receive a apple event from Mac OS later, which tells it that whether the
device is USB-connected or Network-connected, when the application get
this
information, then it will launch the corresponding UI depend on the
connect
mode. (there are two nib files, one for USB, another for Network.).

I have no idea how to manage two nib files, or two window controller.
I hope soneone can give me some comments. thanks very much.

XiaogangLi
___

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

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

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

This email sent to [EMAIL PROTECTED]





___

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

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

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

This email sent to [EMAIL PROTECTED]





___

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

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

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

This email sent to [EMAIL PROTECTED]


What does 'DO' mean?

2008-12-08 Thread mark

What does 'DO' stand for?

Mark
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSFilesPromisePboardType with copy/paste

2008-12-08 Thread Ling Li
I searched the archives and saw quite a lot discussion about 
NSFilesPromisePboardType with DnD. In my code the DnD part also works well. I 
also tried to implement NSFilesPromisePboardType for copy/paste, but never 
work. So my question is, after I put something into pasteboard, how can I get 
notification when another application does paste?

Here is my test code:

   NSPasteboard *pboard = [NSPasteboard generalPasteboard];
   NSMutableArray *types = [[NSMutableArray alloc] init];
   [types addObject:NSFilesPromisePboardType];
   [pboard declareTypes:types owner:self];
   [types release];

I also implemented namesOfPromisedFilesDroppedAtDestination, which just provide 
the file path. After I run, the paste item with both Finder and 
PasteboardKeeper is never highlighted, so I can not paste. If I click 'Show 
clipboard', it shows nothing in the window, and show 'Clipboard contents: 
unknown' in the bottom status bar.

I also tried first put NSFilenamesPboardType into pboard, and implemented 
pasteboard:provideDataForType:, and still nothing happen.

So my question is:
1. Is there any promised file copy/paste?
2. How can I get paste notification? Can I get destination path then I can 
write files directly to destination like promised DnD did?

Thanks for any help.___

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

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

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

This email sent to [EMAIL PROTECTED]


iPhone Orientation

2008-12-08 Thread Bruce Martin
I'm not sure this is the right list but a search in the Archives  
returned no results for this question so that makes this question a  
simple one, or maybe no one else has had an issue with it.
I am trying to get notifications that the orientation of the iPhone  
has changed, if it changed then I want to change the view to a new  
view which will contain different information than the original  
upright view.


I tried looking for some examples or tutorials but can't find anything  
so the more basic your answer the better :)

Thanks
Bruce Martin
The Martin Solution
[EMAIL PROTECTED]
http://www.martinsolution.com
http://externals.martinsolution.com

___

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

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

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

This email sent to [EMAIL PROTECTED]


Printing File to PDF from Native Application

2008-12-08 Thread Jeff

Hello all,

Long time listener, first time poster...

I'm currently working on an app which needs to open files in their  
native application, print to a PDF (temp file) and then load the PDF  
and programmatically manipulate it.  The main issue I am having is  
finding the correct API for implementing the printing (saving to a  
PDF) portion.


Essentially this is the Print action found in Finder so I expected  
to find something appropriate in Launch Services but that doesn't  
seem to contain what I need.  I figured I could create a default  
printer that prints to temp PDF files, fire off a print method that  
would load the native app and print to the default printer, look in  
the temp folder for the new PDF, load that into my app, do what I need  
to do with it and then delete the temp file.


Sounds easy in theory, but I'm just not seeing what I need in the  
standard APIs, either Cocoa or Core Foundation.


Any ideas or nudges in the right direction are greatly appreciated.

Thank you,
Jeff
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cleanup inside a failed init method

2008-12-08 Thread John Engelhart
On Sat, Dec 6, 2008 at 4:07 PM, Ken Tozier [EMAIL PROTECTED] wrote:
 Hi

 I'm writing my own socket class using a bunch of BSD functions and am a
 little unclear on exactly what I should be doing to insure everything is
 cleaned up if any of the low level functions fail. If I return nil from my
 init, does the system call my dealloc method to allow proper cleanup? Or do
 I have to do the cleanup before returning?

Within an -init method, it's best to assume that the memory allocated
for the object will persist forever (I'm assuming we're talking about
manual memory management here, not GC), and 'some kind' of action is
required to prevent a leak.  This generally means you're going to have
to do a '[self release]' (or equivalent) to make sure that the objects
memory is properly reclaimed by the system.  The authoritative
reference on the subject is:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html

Everyone seems to have their own style, so here's mine for what it's worth.

Consolidate all your clean-up code in one place, and one place only:
dealloc.  I can't even think of a reasonable example where your
dealloc code couldn't figure things out just from the contents of
iVars.  When allocated, your objects memory is zero'd, so you start
from a known state.  If a pointer is non-NULL, then something probably
has to be done with it.  Keeping everything in one place means there's
only one place you need to make changes, not two or three different
places, one of which Murphy will guarantee to not be up to date with
your latest tweaks.

When something goes wrong, you're eventually going to have to do the following:

[self release];
return(NULL);

Don't call -dealloc directly, EVER.  From the NSObject -dealloc documentation:

You never send a dealloc message directly. Instead, an object's
dealloc method is invoked indirectly through the release NSObject
protocol method (if the release message results in the receiver's
retain count becoming 0).

When you call [self dealloc] directly from your -init... method,
you'll break a Cocoa memory management invariant: the objects
reference count is still  0 at that point.

The trick is, of course, to handle all the cases correctly.  Sometimes
there's 'hidden' or non-obvious ways that your init code could
potentially leak.  A prime example is objc exceptions.  If, for
example, in your -init.. code you have an NSArray, but accidentally
feed it a bogus index, it will throw a NSRangeException.  In general,
unless you're inside a @try/@catch (or equivalent) block, control will
not return to your -init... method.

One pattern I've used for when things get 'complicated' like this, or
there's just too many ways that things could potentially go wrong, I
do something along the lines of:

- (id)init...
{
  if((self = [super iniit...]) == NULL) { return(NULL); }
  [self autorelease];

  // Do hairy initialization bits here.

onSuccess:
  return([self retain]);
}

This of course assumes that your -dealloc method will be able to mop
up any partial initialization.  I've found this to be trivial in
practice.  When something goes wrong in your -init... code, all you do
is immediately return(NULL);  When the autorelease pool is popped
latter, your objects reference count will drop to zero, and your
-dealloc method will be called to clean things up, and the memory for
the object will be reclaimed.

The beauty of this approach is just about anything can go wrong in the
middle.  Even if some object deep in the initialization logic throws
an exception which you weren't prepared for, your object is already
pushed on to the autorelease pool and is pretty much guaranteed to
have -dealloc called at some later point.  The only time your object
won't be reclaimed is when you've successfully initialized everything
without an error and 'rescue' yourself from the clutches of the
autorelease pool.  I've found this to drastically simplify complicated
-init... code where it's critical that the -init... method be very
robust and recover gracefully and correctly no matter what happens.


 Here's what I have so far

 - (id) initWithHost:(NSString *) inHost
port:(int) inPort
error:(NSString **) inError
 {
id  result  = nil;

self = [super init];
if (self)
{
host= [inHost copy];
port= inPort;

// if any of the following fails, I want to cleanup
// completely before returning
// am I doing that correctly?
// host and error are the only Cocoa objects
// I'm holding on to. The other stuff is from the BSD
 functions
if ([self getAddress] 
[self createSocket] 
[self connect] 
[self updateStream])
{
result  = self;
}

Shell tool with GUI

2008-12-08 Thread Chris Hiszpanski

Hello,

I'm trying to write a very simple oscilloscope in Cocoa as a shell  
tool that continuously reads samples via standard input and draws them  
as a waveform in a window. I do _not_ want a menu bar (i.e. an  
application), just one window that disappears when the parent shell  
tool receives the interrupt signal.


- How can I create a window without creating a full fledge application  
(i.e. without creating an instance of NSApplication)?


- What is the difference between a Cocoa Shell Tool and a Cocoa  
Application? Can a Cocoa Shell Tool draw GUI objects, or is it  
restricted to text in the shell?


- How can I read standard input? With the NSFileHandle class? I see  
fileHandleWithStandardInput is a class method there, but not an  
instance method...


- How can I draw an oscilloscope type animation? With the drawRect  
method of my own class that inherits from NSView? Or is there a more  
appropriate method?


I'd appreciate any pointers in the right direction.

Chris
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What does 'DO' mean?

2008-12-08 Thread Dave DeLong

Usually Distributed Object.

Cheers,

Dave

On Dec 5, 2008, at 3:31 PM, mark wrote:


What does 'DO' stand for?

Mark

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What does 'DO' mean?

2008-12-08 Thread Keary Suska


On Dec 5, 2008, at 3:31 PM, mark wrote:


What does 'DO' stand for?



Probably Distributed Objects.

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What does 'DO' mean?

2008-12-08 Thread Alexander Spohr

Distributed Objects

atze

Am 05.12.2008 um 23:31 schrieb mark:


What does 'DO' stand for?

Mark

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What does 'DO' mean?

2008-12-08 Thread jmunson

Distributed Objects

Quoting mark [EMAIL PROTECTED]:


What does 'DO' stand for?

Mark
___

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

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

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

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: iPhone Orientation

2008-12-08 Thread Dave DeLong
UIViewController has methods that are called to notify that the iPhone  
will, is, or has rotated:


- (BOOL)shouldAutorotateToInterfaceOrientation: 
(UIInterfaceOrientation)interfaceOrientation
- (void)willRotateToInterfaceOrientation: 
(UIInterfaceOrientation)toInterfaceOrientationduration: 
(NSTimeInterval)duration
- (void)willAnimateFirstHalfOfRotationToInterfaceOrientation: 
(UIInterfaceOrientation)toInterfaceOrientation duration: 
(NSTimeInterval)duration
- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation: 
(UIInterfaceOrientation)fromInterfaceOrientation duration: 
(NSTimeInterval)duration
- (void)didRotateFromInterfaceOrientation: 
(UIInterfaceOrientation)fromInterfaceOrientation


All you would need to do is implement any of those in your  
ViewController to rearrange your interface appropriately.  You can  
call [self setVew:someNewUIView] in a method, or whatever.


Cheers,

Dave

On Dec 6, 2008, at 10:19 AM, Bruce Martin wrote:

I'm not sure this is the right list but a search in the Archives  
returned no results for this question so that makes this question a  
simple one, or maybe no one else has had an issue with it.
I am trying to get notifications that the orientation of the iPhone  
has changed, if it changed then I want to change the view to a new  
view which will contain different information than the original  
upright view.


I tried looking for some examples or tutorials but can't find  
anything so the more basic your answer the better :)

Thanks
Bruce 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 [EMAIL PROTECTED]


Re: iPhone Orientation

2008-12-08 Thread Luke Hiesterman
The UIKit changes orientation for you if you respond YES to  
shouldAutoRotateToOrientation which is part of UIViewController.


Luke

Sent from my iPhone.

On Dec 6, 2008, at 9:19 AM, Bruce Martin [EMAIL PROTECTED] wrote:

I'm not sure this is the right list but a search in the Archives  
returned no results for this question so that makes this question a  
simple one, or maybe no one else has had an issue with it.
I am trying to get notifications that the orientation of the iPhone  
has changed, if it changed then I want to change the view to a new  
view which will contain different information than the original  
upright view.


I tried looking for some examples or tutorials but can't find  
anything so the more basic your answer the better :)

Thanks
Bruce Martin
The Martin Solution
[EMAIL PROTECTED]
http://www.martinsolution.com
http://externals.martinsolution.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/luketheh%40apple.com

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: One-way communication from NSPanel in MainMenu.xib to Custom View

2008-12-08 Thread Keary Suska

On Dec 7, 2008, at 8:05 PM, Gordon Hughes wrote:

I've been pulling my hair out over this for a few days now.  I know  
I'm not
understanding something quite elementary, so I'd greatly appreciate  
any

insights offered.
I'm attempting to write a game show-like application.  My laptop  
would
display a window (the NSPanel) which controls what's going on on a  
projected
window.  The communication would be strictly one-way from the  
controlling

NSPanel (or NSWindow, whatever's more appropriate) to the game board's
window.

My difficulty seems to be with finding a bridge between the two  
windows
while still allowing the projected game board to have two different  
views.


When I wired the NSPanel and window with a single custom view in
MainMenu.xib through the AppDelegate, it worked.  Text entered on the
NSPanel was sent to the custom view with the appropriate button  
action.
Other buttons would trigger animations on the projected game board.   
When I

added the second view and tried to handle the views with a subclassed
NSViewController, it stopped working.

Am I at least on the right track?


OTOH, sounds like you need NSWindowControllers rather than view  
controllers. Since it looks like you have a distinct parent-child  
relationship, the panel controller can own the projected  
controller and hence your bridge.


HTH,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: iPhone Orientation

2008-12-08 Thread Roland King
have you looked at UIViewController at all? That's the generally  
recommended (in the documentation) way of controlling views and has  
all the methods required for telling you when orientations change,  
allowing you to say you do or do not want an orientation change and  
poking your view when it happens.


I've used this quite successfully in my applications generally for  
controlling views and for the few I have which are orientation-aware,  
it's fine.


On Dec 7, 2008, at 1:19 AM, Bruce Martin wrote:

I'm not sure this is the right list but a search in the Archives  
returned no results for this question so that makes this question a  
simple one, or maybe no one else has had an issue with it.
I am trying to get notifications that the orientation of the iPhone  
has changed, if it changed then I want to change the view to a new  
view which will contain different information than the original  
upright view.


I tried looking for some examples or tutorials but can't find  
anything so the more basic your answer the better :)

Thanks
Bruce Martin
The Martin Solution
[EMAIL PROTECTED]
http://www.martinsolution.com
http://externals.martinsolution.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/rols%40rols.org

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cocoa-dev Digest, Vol 5, Issue 2097

2008-12-08 Thread Karl Moskowski


On 8-Dec-08, at 10:31 AM, mark [EMAIL PROTECTED] wrote:


What does 'DO' stand for?



In the context of Cocoa progamming, probably Distributed Objects.

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/DistrObjects/DistrObjects.html 




Karl Moskowski [EMAIL PROTECTED]
Voodoo Ergonomics Inc. http://voodooergonomics.com/



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: iPhone Orientation

2008-12-08 Thread I. Savant
On Sat, Dec 6, 2008 at 12:19 PM, Bruce Martin [EMAIL PROTECTED] wrote:
 I'm not sure this is the right list but a search in the Archives returned no
 results for this question so that makes this question a simple one, or maybe
 no one else has had an issue with it.

  The best place for detailed discussion (officially, anyway) is the
iPhone Developer Center:

http://developer.apple.com/iphone/

  Registration, a US$100 fee, and a signed NDA are required. Apple's
way of limiting public release of information which they feel works.
:-)  There's also all the documentation that you should probably read
(since this is a pretty basic function that should be easily found
with a search of the documentation) ...

  Unofficially, most iPhone-related discussions seem to be allowed on
this list but the official rules of this aren't yet entirely clear.

--
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 [EMAIL PROTECTED]


Re: Shell tool with GUI

2008-12-08 Thread I. Savant
On Mon, Dec 8, 2008 at 12:57 AM, Chris Hiszpanski [EMAIL PROTECTED] wrote:

 I'm trying to write a very simple oscilloscope in Cocoa as a shell tool that
 continuously reads samples via standard input and draws them as a waveform
 in a window. I do _not_ want a menu bar (i.e. an application), just one
 window that disappears when the parent shell tool receives the interrupt
 signal.
...
 - How can I create a window without creating a full fledge application (i.e.
 without creating an instance of NSApplication)?

  So ... you want a GUI application without a GUI? That makes little sense.

 - What is the difference between a Cocoa Shell Tool and a Cocoa Application?
 Can a Cocoa Shell Tool draw GUI objects, or is it restricted to text in the
 shell?

  A Cocoa Shell Tool is usually linked only against the Foundation
framework (sans all the GUI goodness of AppKit, which means it's also
sans all the reasonably-convenient drawing and animation stuff). It
also has no link to the window server so it can't create or 'have'
windows.

 - How can I read standard input? With the NSFileHandle class? I see
 fileHandleWithStandardInput is a class method there, but not an instance
 method...

  Have you searched the archives? The documentation? This comes up
fairly often and is pretty well documented.

 - How can I draw an oscilloscope type animation? With the drawRect method
 of my own class that inherits from NSView? Or is there a more appropriate
 method?

  How do I write a program? -- your question is about this vague. If
you accept that in order to make use of NSView, windows, and the GUI
in general, you must create an actual application, then you should
start by reading all the documentation (Cocoa Drawing Guide and
View Programming Guide are good places to start), then ask more
specific questions.

  To answer your -drawRect:/NSView subclass method: It depends. If
you desire kick-ass graphics (really nice animations and effects) you
probably want to look into layer-backed views. If you just want a
basic plot that changes in realtime (ie, not necessarily an
animation but just a continuously-updating plot), then you can
probably get away with just using a view subclass and handling the
drawing in -drawRect:, updating only when new data comes in (or
regularly updating at an interval, fired by a timer).

--
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 [EMAIL PROTECTED]


Re: Shell tool with GUI

2008-12-08 Thread Nick Zitzmann


On Dec 7, 2008, at 10:57 PM, Chris Hiszpanski wrote:

- How can I create a window without creating a full fledge  
application (i.e. without creating an instance of NSApplication)?


While not technically supported, you can use anything in the AppKit  
after calling NSApplicationLoad() once.


- What is the difference between a Cocoa Shell Tool and a Cocoa  
Application? Can a Cocoa Shell Tool draw GUI objects, or is it  
restricted to text in the shell?


The latter are bundles; the former are not (and are linked only to the  
Foundation framework by default).


- How can I read standard input? With the NSFileHandle class? I see  
fileHandleWithStandardInput is a class method there, but not an  
instance method...


I'd just use scanf() here unless you have a really good reason not to  
do that.


- How can I draw an oscilloscope type animation? With the drawRect  
method of my own class that inherits from NSView?



Yes.

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Shell tool with GUI

2008-12-08 Thread I. Savant
On Mon, Dec 8, 2008 at 11:13 AM, Nick Zitzmann [EMAIL PROTECTED] wrote:

 On Dec 7, 2008, at 10:57 PM, Chris Hiszpanski wrote:

 - How can I create a window without creating a full fledge application
 (i.e. without creating an instance of NSApplication)?

 While not technically supported, you can use anything in the AppKit after
 calling NSApplicationLoad() once.

  Sure, but unless you really know what you're doing and have a very
good reason for doing it, this approach for a GUI-less app with a
window is just plain silly. If you want a Cocoa program (avoiding
use of the word application to avoid confusion with an NSApplication
instance) with a window in the GUI, just create a normal Cocoa
application and be done with it.

  Maybe the OP can give a more thorough description of what he's
trying to accomplish and why he wants a window but no other GUI
elements. It raises some pretty important questions: How will the user
control this disembodied window floating on his/her desktop? Why have
a window if you're making your user launch (and quit) the program
from the command line?

  Sorry to harp on this, but it just seems like a very, very wrong way
of approaching Mac OS X application design.

--
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 [EMAIL PROTECTED]


Re: iPhone Orientation

2008-12-08 Thread Ricky Sharp


On Dec 8, 2008, at 9:58 AM, I. Savant wrote:


On Sat, Dec 6, 2008 at 12:19 PM, Bruce Martin [EMAIL PROTECTED] wrote:
I'm not sure this is the right list but a search in the Archives  
returned no
results for this question so that makes this question a simple one,  
or maybe

no one else has had an issue with it.


 The best place for detailed discussion (officially, anyway) is the
iPhone Developer Center:

http://developer.apple.com/iphone/

 Registration, a US$100 fee, and a signed NDA are required. Apple's
way of limiting public release of information which they feel works.
:-)  There's also all the documentation that you should probably read
(since this is a pretty basic function that should be easily found
with a search of the documentation) ...


Not to mention the existing sample code from Apple.

Anyhow, there's other reasons for Apple moving towards an on-line  
discussion forum format.  E-mail lists did not address many of the  
developer's needs.



 Unofficially, most iPhone-related discussions seem to be allowed on
this list but the official rules of this aren't yet entirely clear.


The boundaries sometimes do blur.  For example, the recent thread  
about responding to low-memory situations.  While clearly only an  
iPhone OS issue, it did raise many best practices that would work in  
general.


My personal take... Any FoundationKit or fundamental types of  
questions should be OK on this list.  However, specific UIKit-related  
stuff should go elsewhere.  This is nothing new.  For example,  
developers often need to step down to direct quartz APIs and often the  
best forum for help is the dedicated quartz-dev list.  I thus view  
UIKit as being a very specialized area and thus deserves a more  
dedicated forum.


For my personal iPhone OS needs, I've gotten all answers by (a)  
reading docs, (b) working through Apple's sample code, (c) attending  
the iPhone tech talk and (d) contacting DTS** when all else failed.


** You'll get two DTS incidents in the iPhone standard account (i.e.  
you don't have to use up the ones in your Select/Premier account  
should you have those as well).


___
Ricky A. Sharp mailto:[EMAIL PROTECTED]
Instant Interactive(tm)   http://www.instantinteractive.com



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Shell tool with GUI

2008-12-08 Thread jmunson
Not to mention that the menu occupies an extremely small amount of  
screen real estate...


Quoting I. Savant [EMAIL PROTECTED]:


On Mon, Dec 8, 2008 at 11:13 AM, Nick Zitzmann [EMAIL PROTECTED] wrote:


On Dec 7, 2008, at 10:57 PM, Chris Hiszpanski wrote:


- How can I create a window without creating a full fledge application
(i.e. without creating an instance of NSApplication)?


While not technically supported, you can use anything in the AppKit after
calling NSApplicationLoad() once.


  Sure, but unless you really know what you're doing and have a very
good reason for doing it, this approach for a GUI-less app with a
window is just plain silly. If you want a Cocoa program (avoiding
use of the word application to avoid confusion with an NSApplication
instance) with a window in the GUI, just create a normal Cocoa
application and be done with it.

  Maybe the OP can give a more thorough description of what he's
trying to accomplish and why he wants a window but no other GUI
elements. It raises some pretty important questions: How will the user
control this disembodied window floating on his/her desktop? Why have
a window if you're making your user launch (and quit) the program
from the command line?

  Sorry to harp on this, but it just seems like a very, very wrong way
of approaching Mac OS X application design.

--
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/jmunson%40his.com

This email sent to [EMAIL PROTECTED]





___

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

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

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

This email sent to [EMAIL PROTECTED]


Sheet opens but not attached to window

2008-12-08 Thread Mike Chambers
I am trying to create a custom sheet for my application.

The sheet is contained in a separate nib named CalendarSheet, and
has a class called CalendarSheetController set as its File Owner. (The
class is below).

I open the sheet like so:

[calendarSheet showSheet:mainWindow];

Where mainWindow is defined as:

IBOutlet NSWindow *mainWindow;

(and is set up correctly).

This loads the nib, but displays it as a separate window, and not a
sheet. It doesnt have a title bar, but it is not attached to the
application window, and is not modal. In searching on google, I have
seen this reported a couple of times, but found no resolution.

I apologize if this is a super simple issue, but I am relatively new
to Cocoa, and am trying to get my head around the model.

Anyone see what I might be doing wrong? or any tips on what to check?

---CalendarSheet.h-
#import Cocoa/Cocoa.h


@interface CalendarSheetController : NSWindowController
{
   IBOutlet NSWindow *sheet;
}

- (void)showSheet: (NSWindow *)window;

@end
---CalendarSheet.m-
#import CalendarSheetController.h

@implementation CalendarSheetController


-(id)init
{
   if(![super init])
   {
   return nil;
   }

   return self;
}

-(void)dealloc
{
   [super dealloc];
}

- (void)showSheet: (NSWindow *)window
{
   if (sheet == nil)
   {
   [NSBundle loadNibNamed: @CalendarSheet owner: self];
   }

   [NSApp beginSheet: sheet
  modalForWindow: window
   modalDelegate: self
  didEndSelector: @selector(didEndSheet:returnCode:contextInfo:)
 contextInfo: nil];
}

@end
---

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 [EMAIL PROTECTED]


Re: Shell tool with GUI

2008-12-08 Thread I. Savant
On Mon, Dec 8, 2008 at 11:35 AM,  [EMAIL PROTECTED] wrote:
 Not to mention that the menu occupies an extremely small amount of screen
 real estate...

  An interesting thought - maybe the OP is interested in a full-screen
display? The path of least resistance here is still to create a
Cocoa Application and use all the built-in full screen stuff.

--
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 [EMAIL PROTECTED]


Re: Changing key behaviors for NSTableView

2008-12-08 Thread Corbin Dunn


Le Dec 5, 2008 à 10:12 PM, Steven W Riggins a écrit :


I have written a simple application with a table view.

I want the table to edit a cell when I press return.

I could not find a way to do this other than subclassing and  
overriding keyDown.


Did I miss a more elegant solution?


This should just work on Leopard, if there is only one editable cell  
available. If there is more than one, you must tab to it.


-corbin___

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

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

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

This email sent to [EMAIL PROTECTED]


NSArray represented in 2 different views at same time

2008-12-08 Thread Alexander Cohen

Hi,

I've got a list of objects in an NSArray and i'm currently managing  
them with an NSArrayController and a view that is binded to it. Now i  
need to be able to show that same view in a new window with the same  
content but with possibly different selections and sort descriptors. I  
also need to update the content display in both views when an item is  
added or removed. I guess the closest approach i can think of is  
iTunes when you double click an item in its source list and it opens  
up a new window with the same content.


My question is how should I approach this. Should i have an array  
controller for each view and have them notify each other of changes?  
Does anyone have any experience with this sort of workflow and if so,  
how did you manage all of this.


thx

AC
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Shell tool with GUI

2008-12-08 Thread douglas welton

Hi Chris,

Not having a menu and not being an application are not the same  
thing.  If you don't want to have a menu around, simply hide it using  
the available mechanisms (e.g., [NSMenu setMenuBarVisible: NO] or  
kiosk mode) and create a window to cover the entire screen.  IMHO,  
you'll be fighting the framework if you try to force a window onto  
the screen without using the window server (which is there to help you  
- not be an insurmountable obstacle)


If you choose this route, make sure you give your user a way to return  
to a non-fullscreen mode of operations (typically, pressing the escape  
key will work for this task).


regards,

douglas

On Dec 8, 2008, at 12:57 AM, Chris Hiszpanski wrote:

I'm trying to write a very simple oscilloscope in Cocoa as a shell  
tool that continuously reads samples via standard input and draws  
them as a waveform in a window. I do _not_ want a menu bar (i.e. an  
application), just one window that disappears when the parent shell  
tool receives the interrupt signal.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Shell tool with GUI

2008-12-08 Thread Philip Ershler


On Dec 7, 2008, at 10:57 PM, Chris Hiszpanski wrote:


Hello,

I'm trying to write a very simple oscilloscope in Cocoa as a shell  
tool that continuously reads samples via standard input and draws  
them as a waveform in a window. I do _not_ want a menu bar (i.e. an  
application), just one window that disappears when the parent shell  
tool receives the interrupt signal.


- How can I create a window without creating a full fledge  
application (i.e. without creating an instance of NSApplication)?


- What is the difference between a Cocoa Shell Tool and a Cocoa  
Application? Can a Cocoa Shell Tool draw GUI objects, or is it  
restricted to text in the shell?


- How can I read standard input? With the NSFileHandle class? I see  
fileHandleWithStandardInput is a class method there, but not an  
instance method...


- How can I draw an oscilloscope type animation? With the drawRect  
method of my own class that inherits from NSView? Or is there a more  
appropriate method?


I'd appreciate any pointers in the right direction.

Chris


Another way to do this would be to write the entire app in either C or  
Objective C (without any Cocoa frameworks) and use OpenGL to handle  
the graphics.


Phil

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSDictionary mutability test

2008-12-08 Thread [EMAIL PROTECTED]
There are a number of posts detailing with the ethics of the issue of  
determining an object's mutability.

eg: http://www.cocoabuilder.com/archive/message/cocoa/2004/7/7/73
Does anyone have a current informed pragmatic opinion on how to deal  
with the following example?


I am not trying to determine program flow by determining mutability,  
merely trying to limit the number of self inflicted injuries.
The following never seems to assert, regardless of whether dict is  
mutable or not.


 NSAssert([dict isKindOfClass:[NSMutableDictionary class]], @dict is  
not mutable);


I know that it is my responsibility to remain aware of an object's  
allocated class but sometimes I find myself wanting.


Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




___

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

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

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

This email sent to [EMAIL PROTECTED]


Not getting KeyDown events (and other peculiar things)

2008-12-08 Thread Shayne Wissler
Hello,

I'm writing something like a game engine using NSOpenGLView and am
getting some odd behaviors (I am new to Cocoa):

1. Clicking on the title bar of my application does not activate my
application, but clicking inside my window does. I can move the window
around on the screen, but unlike all the other applications I must
click inside the window to make it the main window.

2. The resize handle that's normally on the bottom right corner is not
shown, but it is apparently there because when I click in that area
and drag the window resizes. [window showsResizeIndicator] returns
true even though the indicator isn't shown.

3. The worst problem is that I'm not getting key events even though I
have defined these methods:

- (BOOL)acceptsFirstResponder
{
 return YES;
}

- (BOOL)becomeFirstResponder
{
 return YES;
}

- (BOOL)canBecomeKeyView
{
 return YES;
}

- (void)keyDown:(NSEvent*)theEvent
{
...
}

- (void)keyUp:(NSEvent*)theEvent
{
...
}

I am getting mouse events just fine, but when I click on a key, the
keypress goes to the previously selected application, or if there is
none, I just hear a beep. I have printed out the status  [[self
window] isKeyWindow] on a mouseDown event and it is indeed true,
making this seem even more bizarre to me.

Note: I am not using nib files so awakeFromNib does not get called
in my application.

Any helpful comments would be appreciated!


Shayne Wissler
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Sheet opens but not attached to window

2008-12-08 Thread Mike Abdullah
In IB, your window is probably set to be visible at launch. Turn that  
off as you are managing the visibility yourself.


Mike.

On 8 Dec 2008, at 16:44, Mike Chambers wrote:


I am trying to create a custom sheet for my application.

The sheet is contained in a separate nib named CalendarSheet, and
has a class called CalendarSheetController set as its File Owner. (The
class is below).

I open the sheet like so:

[calendarSheet showSheet:mainWindow];

Where mainWindow is defined as:

IBOutlet NSWindow *mainWindow;

(and is set up correctly).

This loads the nib, but displays it as a separate window, and not a
sheet. It doesnt have a title bar, but it is not attached to the
application window, and is not modal. In searching on google, I have
seen this reported a couple of times, but found no resolution.

I apologize if this is a super simple issue, but I am relatively new
to Cocoa, and am trying to get my head around the model.

Anyone see what I might be doing wrong? or any tips on what to check?

---CalendarSheet.h-
#import Cocoa/Cocoa.h


@interface CalendarSheetController : NSWindowController
{
  IBOutlet NSWindow *sheet;
}

- (void)showSheet: (NSWindow *)window;

@end
---CalendarSheet.m-
#import CalendarSheetController.h

@implementation CalendarSheetController


-(id)init
{
  if(![super init])
  {
  return nil;
  }

  return self;
}

-(void)dealloc
{
  [super dealloc];
}

- (void)showSheet: (NSWindow *)window
{
  if (sheet == nil)
  {
  [NSBundle loadNibNamed: @CalendarSheet owner: self];
  }

  [NSApp beginSheet: sheet
 modalForWindow: window
  modalDelegate: self
 didEndSelector:  
@selector(didEndSheet:returnCode:contextInfo:)

contextInfo: nil];
}

@end
---

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/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Mike Abdullah


On 8 Dec 2008, at 17:15, [EMAIL PROTECTED] wrote:

There are a number of posts detailing with the ethics of the issue  
of determining an object's mutability.

eg: http://www.cocoabuilder.com/archive/message/cocoa/2004/7/7/73
Does anyone have a current informed pragmatic opinion on how to deal  
with the following example?


I am not trying to determine program flow by determining mutability,  
merely trying to limit the number of self inflicted injuries.
The following never seems to assert, regardless of whether dict is  
mutable or not.


NSAssert([dict isKindOfClass:[NSMutableDictionary class]], @dict is  
not mutable);


I know that it is my responsibility to remain aware of an object's  
allocated class but sometimes I find myself wanting.


This is because NSDictionary is a class cluster. What happens behind  
the scenes is that Cocoa has a hierarchy of:


NSCFDictionary : NSMutableDictionary : NSDictionary

You are being handed an NSCFDictionary object which Cocoa has set up  
to be immutable internally. Try to use one of the mutable methods and  
it will throw an exception, but testing the class inheritance will  
suggest it is mutable.


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 [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Charles Steinman
- Original Message 

 From: [EMAIL PROTECTED] [EMAIL PROTECTED]
 To: cocoa-dev@lists.apple.com
 Sent: Monday, December 8, 2008 9:15:45 AM
 Subject: NSDictionary mutability test
 
 There are a number of posts detailing with the ethics of the issue of 
 determining an object's mutability.
 eg: http://www.cocoabuilder.com/archive/message/cocoa/2004/7/7/73
 Does anyone have a current informed pragmatic opinion on how to deal with the 
 following example?
 
 I am not trying to determine program flow by determining mutability, merely 
 trying to limit the number of self inflicted injuries.
 The following never seems to assert, regardless of whether dict is mutable or 
 not.
 
 NSAssert([dict isKindOfClass:[NSMutableDictionary class]], @dict is not 
 mutable);

This is explained in the thread you referenced. All NSDictionary objects are 
instances of NSCFDictionary. Thus the only way to check if they are mutable 
through public API is to try mutating them and see if Cocoa throws a hissy fit.

Cheers,
Chuck



  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSArrayController, NSPopupMenu, defaults and arrangedObjects

2008-12-08 Thread Quincey Morris

On Dec 8, 2008, at 04:18, Steven Hamilton wrote:

I have a custom NSWindowController called budgetController.  
Interface thus (cropped a bit)


@interface MLBudgetController : NSWindowController {

IBOutlet NSArrayController *incomeEnvelopeController;
NSManagedObject *selectedIncomeEnvelope;
}

My window has an NSPopupButton bound to my NSArraycontroller  
*incomeEnvelopeController. The selectedObject binding is bound to  
the selectedIncomeEnvelope above. The controller sources Core Data  
for my Envelope entities and on running, it fetches and displays  
the set of entities fine showing the correct values. It also sets  
the selectedIncomeEnvelope fine too.


But on first load I have a No Value in the popup. Selecting an  
entry removes the No Value from the list. In my budgetController's  
windowDidLoad{} function I'm attempting to set the  
selectedIncomeEnvelope to the first object in the array like so;


selectedIncomeEnvelope= [[incomeEnvelopeController arrangedObjects]  
objectAtIndex:0];


However, the arrangedObjects array, while existing, contains zero  
objects. I've checked the Outlet is connected ok. A timing issue of  
some sort?


No. Based on the above, your code isn't KVO compliant.

First of all, it's important to realize that nothing is ever bound to  
an instance variable (selectedIncomeEnvelope), but to an object  
property (MLBudgetController instance, key selectedIncomeEnvelope).  
The two are not the same thing, although KVO will *pretend* there's a  
property when there's only a variable (which appears to be your case,  
and which is why it works some of the time).


When you go to set the initial selected object, you need to change the  
property, not the variable. This is easiest if you actually define the  
property (or write the getter  setter):


@property NSManagedObject *selectedIncomeEnvelope;
...
@synthesize selectedIncomeEnvelope;
...
	self.selectedIncomeEnvelope= [[incomeEnvelopeController  
arrangedObjects] objectAtIndex:0];


That should cause the proper KVO notification to be sent, and for the  
correct object to be selected in the user interface.


Or, if you don't want to define the property explicitly, then you have  
to generate the notification yourself:


[self willChangeValueForKey: @selectedIncomeEnvelope];
	selectedIncomeEnvelope= [[incomeEnvelopeController arrangedObjects]  
objectAtIndex:0];

[self didChangeValueForKey: @selectedIncomeEnvelope];


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Devon Ferns
Instead of using exceptions, wouldn't 
-(BOOL)respondsToSelector:(SEL)aSelector

work if you test for an NSMutableDictionary mutable method?
Or does that not work with class clusters either(can't try it since I'm 
not at home)


Devon

[EMAIL PROTECTED] wrote:

Thanks for the reply.

I am aware of why the assertion is never applied but the thread I 
referenced was several years old and I was hoping that there had been 
some progress on this.

Maybe not.
I was using this assertion (written some time ago in ignorance) and 
wasted an afternoon tracking down the fact that it didn't work.

Maybe the only solution is to set up an exception handler.

On 8 Dec 2008, at 17:31, Jonathan Hendry wrote:


It's because NSMutableDictionary is part of a class cluster:

From the NSObject protocol docs:

Be careful when using this method on objects represented by a class 
cluster. Because of the nature of class clusters, the object you get 
back may not always be the type you expected. If you call a method 
that returns a class cluster, the exact type returned by the method is 
the best indicator of what you can do with that object. For example, 
if a method returns a pointer to an NSArray object, you should not use 
this method to see if the array is mutable, as shown in the following 
code:


// DO NOT DO THIS!
if ([myArray isKindOfClass:[NSMutableArray class]])
{
// Modify the object
}

On Dec 8, 2008, at 12:15 PM, [EMAIL PROTECTED] wrote:

There are a number of posts detailing with the ethics of the issue of 
determining an object's mutability.

eg: http://www.cocoabuilder.com/archive/message/cocoa/2004/7/7/73
Does anyone have a current informed pragmatic opinion on how to deal 
with the following example?


I am not trying to determine program flow by determining mutability, 
merely trying to limit the number of self inflicted injuries.
The following never seems to assert, regardless of whether dict is 
mutable or not.


NSAssert([dict isKindOfClass:[NSMutableDictionary class]], @dict is 
not mutable);


I know that it is my responsibility to remain aware of an object's 
allocated class but sometimes I find myself wanting.


Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.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/jonhendry%40mac.com

This email sent to [EMAIL PROTECTED]


Jonathan Hendry

Howard Hughes Medical Institute
Maunsell Lab
Harvard Medical School




Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.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/dferns%40devonferns.com

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Weird behavior of mouse location when performing a drag

2008-12-08 Thread Gustavo Pizano

Hello all.

Well Im performing a drag-ndrop between views of the same app, I  
implemented the  - (NSDragOperation)draggingUpdated:(id   
NSDraggingInfo )sender method, because I need to know the location of  
the mouse so I can place the image in the correct position of the  
view. But weirdly after converting the point to the currentview  there  
was a gap of about 145ox in x coordinate and 45 px in the y coord,  
those values are not even close to where the view resides in the  
window. So what I did to fix the problem was the following.


- (NSDragOperation)draggingUpdated:(id  NSDraggingInfo )sender
{
NSPoint converted = [NSEvent mouseLocation];
actualDragPoint = [self convertPoint:converted fromView:nil];   
actualDragPoint.x = actualDragPoint.x - 144 ;
actualDragPoint.y =  actualDragPoint.y -76; 
return NSDragOperationMove;
}

it fixed the problem, but Im wondering why is this happening?


Any clues?

Thanks

Gustavo

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Nick Zitzmann


On Dec 8, 2008, at 10:44 AM, Devon Ferns wrote:

Instead of using exceptions, wouldn't -(BOOL)respondsToSelector: 
(SEL)aSelector

work if you test for an NSMutableDictionary mutable method?
Or does that not work with class clusters either(can't try it since  
I'm not at home)



It does not work with class clusters, since NSCFDictionary implements  
the mutable and immutable methods.


The only method I'm aware of that allows you to tell mutable  
dictionaries from immutable ones is to use the -classForCoder method.  
An immutable dictionary will return [NSDictionary class]; a mutable  
one will return [NSMutableDictionary class].


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

___

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

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

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

This email sent to [EMAIL PROTECTED]


best practice to create Custom Objects represented by a image in a d-n-d operation

2008-12-08 Thread Gustavo Pizano

Hello.

I have in a view images of ships, and Im able to drag them to another  
view which is the sea board, now, what is better, to create the  
objects of the ships in the shipsviewcontainer and set the object in  
the Pasteboard, or, just have representative images in the  
shipsviewcontainer of each ship, and once dragged to the sea create  
the instances of the ship that the images represent.  If the last one  
is correct Iw as thinking if how to know which Ship Object the images  
that is being dragged represents, (maybe by image Size? ) I dunno what  
do you think its better to do, if I explain my self good.



Thanks

Gus

___

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

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

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

This email sent to [EMAIL PROTECTED]


building a custom NSView with IB?

2008-12-08 Thread Bill Janssen
I'd like to build a custom view that is just an assemblage of an
NSTextView, a couple of pushbuttons, and a checkbox.  It seems to me
that there should be some way to do this with IB, but I haven't figured
it out yet.  All the examples on the net seem to focus on overriding
drawRect, which I *don't* need to do.  Anyone have an example of doing
this?

Bill
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Sherm Pendley

On Dec 8, 2008, at 12:38 PM, [EMAIL PROTECTED] wrote:

I am aware of why the assertion is never applied but the thread I  
referenced was several years old and I was hoping that there had  
been some progress on this.


Your use of the word progress implies that something is broken and  
needs to be fixed. That is not the case.


I was using this assertion (written some time ago in ignorance) and  
wasted an afternoon tracking down the fact that it didn't work.


It does work - it does the job it's designed to do.


Maybe the only solution is to set up an exception handler.


No, the solution is to not try to test for mutability. Such tests  
don't work because they're not *supposed* to work - code that tries to  
do such things is broken as designed. And no, it's not an ethical  
issue. Writing broken code isn't a question of good and evil, it's  
simply a question of what works and doesn't work.


sherm--

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: best practice to create Custom Objects represented by a image in a d-n-d operation

2008-12-08 Thread jmunson

Hopefully this will come across well...

If each ship you are dragging is a visual representation of a ship  
object, then, your receiver needs to be able to accept that object.


While I don't know much about how drag-n-drop works (haven't  
implemented it yet), I imagine that what you need to know is  
well-covered in the documentation  various examples as it is a  
basic/staple of a visual operating system such as Mac.


Essentially, at least in older versions of Windows, you had some sort  
of object identifier that was passed and then the receiver acted on  
that identifier appropriately.  Perhaps the newer systems will pass  
the whole object, or maybe (better) just a reference to it.


Hopefully this will get you started.  If not, just File 13 the message.

Peace, Love, and Light,
/s/ Jon C. Munson II

Quoting Gustavo Pizano [EMAIL PROTECTED]:


Hello.

I have in a view images of ships, and Im able to drag them to another
view which is the sea board, now, what is better, to create the objects
of the ships in the shipsviewcontainer and set the object in the
Pasteboard, or, just have representative images in the
shipsviewcontainer of each ship, and once dragged to the sea create
the instances of the ship that the images represent.  If the last one
is correct Iw as thinking if how to know which Ship Object the images
that is being dragged represents, (maybe by image Size? ) I dunno what
do you think its better to do, if I explain my self good.


Thanks

Gus

___

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

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

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

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: D.O. [NSPortCoder sendBeforeTime:sendReplyPort:] timed out

2008-12-08 Thread Jonathon Kuo
No, we were never able to find a fix or workaround for this. We're  
operating now on the assumption that it's an unfixable design flaw in  
DO. This makes for a very fragile client/server implementation.


Jonathon

On Dec 6, 2008, at 1:31 AM, Bridger Maxwell wrote:


Hey,

Did you ever figure out what the problem is? It sounds like I am  
having the exact same problem. It has been driving me insane for a  
while now. I can't figure it out for the life of me.


Thank You,
Bridger Maxwell

On Thu, May 22, 2008 at 10:02 PM, R.L. Grigg [EMAIL PROTECTED] 
 wrote:
I have a Cocoa DO server and a client that connects to it. When the  
client orderly exits with [server removeMessageClient:self] the  
client can reconnect and everything just works. But if the client  
crashes and then tries to reconnect to the server, the server  
somehow refuses the request:


2008-05-23 09:33:20.855 client[6621:10b] [NOTE: this exception  
originated in the server.]
[NSPortCoder sendBeforeTime:sendReplyPort:] timed out  
(10233202800.854183 233202800.854681) 1


Is there some exception the server can detect when a client crashes  
so it can drop/reset that connection? Or is there some way to do  
this from the client side when trying to reconnect? The only way I  
can clear it is to restart the server.


Russ
Xcode 3.0, OSX 10.5.2, Cocoa

___

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

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

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


This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread I. Savant
On Mon, Dec 8, 2008 at 1:53 PM, Sherm Pendley [EMAIL PROTECTED] wrote:

 I was using this assertion (written some time ago in ignorance) and wasted
 an afternoon tracking down the fact that it didn't work.

 It does work - it does the job it's designed to do.

  I'll join the fray on this one. :-) I agree with you, Sherm, to a
point. It works (does what it's designed to do), but because of the
special case of class clusters, it'd be handy in some cases to be able
to ask an object if it -isMutable.

 Maybe the only solution is to set up an exception handler.

 No, the solution is to not try to test for mutability. Such tests don't work
 because they're not *supposed* to work - code that tries to do such things
 is broken as designed. And no, it's not an ethical issue. Writing broken
 code isn't a question of good and evil, it's simply a question of what works
 and doesn't work.

  This is the most salient point. Either you (the developer) created
the dictionary or it was handed to you. If you created it, you should
know whether it is mutable. If you did not, the documentation (if it
exists) and the method signature should tell you all you need to know.
The only thing you could consider broken is if the method promises
an immutable object but gives you a mutable one (or vice-versa).

  If there's ever an ambiguous situation and you need to enforce one
or the other, make a -copy or -mutableCopy of the object to be sure,
and rid yourself of the worry.

--
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 [EMAIL PROTECTED]


NSFilesPromisePboardType with copy/paste

2008-12-08 Thread Ling Li
I searched the archives and saw quite a lot discussion about 
NSFilesPromisePboardType with DnD. In my code the DnD part also works well. I 
also tried to implement NSFilesPromisePboardType for copy/paste, but never 
work. So my question is, after I put something into pasteboard, how can I get 
notification when another application does paste?

Here is my test code:

NSPasteboard *pboard = [NSPasteboard generalPasteboard];

NSMutableArray *types = [[NSMutableArray alloc] init];

[types addObject:NSFilesPromisePboardType];

[pboard declareTypes:types owner:self];

[types release];

I also implemented namesOfPromisedFilesDroppedAtDestination, which just provide 
the file path. After I run, the paste item with both Finder and 
PasteboardKeeper is never highlighted, so I can not paste. If I click 'Show 
clipboard', it shows nothing in the window, and show 'Clipboard contents: 
unknown' in the bottom status bar.

I also tried first put NSFilenamesPboardType into pboard, and implemented 
pasteboard:provideDataForType:, and still nothing happen.

So my question is:

1. Is there any promised file copy/paste?

2. How can I get paste notification? Can I get destination path then I can 
write files directly to destination like promised DnD did?

Thanks for any help.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread [EMAIL PROTECTED]


On 8 Dec 2008, at 18:53, Sherm Pendley wrote:


On Dec 8, 2008, at 12:38 PM, [EMAIL PROTECTED] wrote:

I am aware of why the assertion is never applied but the thread I  
referenced was several years old and I was hoping that there had  
been some progress on this.


Your use of the word progress implies that something is broken and  
needs to be fixed. That is not the case.


I cannot see the harm in requesting if anyone has new insights into  
old issues.





I was using this assertion (written some time ago in ignorance) and  
wasted an afternoon tracking down the fact that it didn't work.


It does work - it does the job it's designed to do.


Maybe the only solution is to set up an exception handler.


No, the solution is to not try to test for mutability. Such tests  
don't work because they're not *supposed* to work - code that tries  
to do such things is broken as designed. And no, it's not an  
ethical issue. Writing broken code isn't a question of good and  
evil, it's simply a question of what works and doesn't work.


I would disagree. I see nothing wrong with the logically necessity of  
testing for mutability. It's just a property.






sherm--



Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Michael Ash
On Mon, Dec 8, 2008 at 12:29 PM, Charles Steinman
[EMAIL PROTECTED] wrote:
 This is explained in the thread you referenced. All NSDictionary objects are 
 instances of NSCFDictionary. Thus the only way to check if they are mutable 
 through public API is to try mutating them and see if Cocoa throws a hissy 
 fit.

You can use -classForCoder and that will give you either NSDictionary
or NSMutableDictionary. This is a public API but the result is not
documented to be useful in this manner, so don't use this in any
shipping app. (Although given the need for archives to remain
backwards compatible I would not expect it to ever change.) However it
could be handy for debugging purposes.

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 [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Jonathan Hess


On Dec 8, 2008, at 2:59 PM, Michael Ash wrote:


On Mon, Dec 8, 2008 at 12:29 PM, Charles Steinman
[EMAIL PROTECTED] wrote:
This is explained in the thread you referenced. All NSDictionary  
objects are instances of NSCFDictionary. Thus the only way to check  
if they are mutable through public API is to try mutating them and  
see if Cocoa throws a hissy fit.


You can use -classForCoder and that will give you either NSDictionary
or NSMutableDictionary. This is a public API but the result is not
documented to be useful in this manner, so don't use this in any
shipping app. (Although given the need for archives to remain
backwards compatible I would not expect it to ever change.) However it
could be handy for debugging purposes.


To add to this, a framework may choose to implement a custom  
NSDictionary/NSMutableDictionary subclass and hand an instance of it  
back out through an  NSDictionary * typed pointer. A classForCoder  
method on a custom subclass like this might not return NSDictionary or  
NSMutableDictionary.


Jon Hess




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/jhess%40apple.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread [EMAIL PROTECTED]


On 8 Dec 2008, at 19:05, I. Savant wrote:



I was using this assertion (written some time ago in ignorance)  
and wasted

an afternoon tracking down the fact that it didn't work.


It does work - it does the job it's designed to do.


 I'll join the fray on this one. :-) I agree with you, Sherm, to a
point. It works (does what it's designed to do), but because of the
special case of class clusters, it'd be handy in some cases to be able
to ask an object if it -isMutable.

Absolutely.




Maybe the only solution is to set up an exception handler.


No, the solution is to not try to test for mutability. Such tests  
don't work
because they're not *supposed* to work - code that tries to do such  
things
is broken as designed. And no, it's not an ethical issue. Writing  
broken
code isn't a question of good and evil, it's simply a question of  
what works

and doesn't work.


 This is the most salient point. Either you (the developer) created
the dictionary or it was handed to you. If you created it, you should
know whether it is mutable. If you did not, the documentation (if it
exists) and the method signature should tell you all you need to know.
The only thing you could consider broken is if the method promises
an immutable object but gives you a mutable one (or vice-versa).

 If there's ever an ambiguous situation and you need to enforce one
or the other, make a -copy or -mutableCopy of the object to be sure,
and rid yourself of the worry.



This is all fine and dandy but the original post makes it clear that  
the mutability test is being applied in an NSAssert().

We are testing for broken promises and faulty assumptions.

Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Gregory Weston

jonathan wrote:


I am aware of why the assertion is never applied but the thread I
referenced was several years old and I was hoping that there had been
some progress on this.
Maybe not.
I was using this assertion (written some time ago in ignorance) and
wasted an afternoon tracking down the fact that it didn't work.
Maybe the only solution is to set up an exception handler.


Untrue. Another solution - and I'd suggest a superior one even if it  
takes more work up front - is to identify and correct the design flaw  
that ends up giving you collections of unknown mutability.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread [EMAIL PROTECTED]

Thanks for the lateral insight.
Ran a quick test and it looks as if  the defective

NSAssert([dict isKindOfClass:[NSMutableDictionary class]], @dict is  
not mutable);


can be recomposed as

NSAssert([dict classForCoder] == [NSMutableDictionary class], @dict  
is not mutable);


The recomposed assert catches the fault condition that the original  
missed.


Very useful, but given the nature of this I would hesitate to cook up  
an -isMutable category method.


By the way, putting isKindOfClass: NSMutableDictionary class into  
google code search implies that everyone is at it.



[EMAIL PROTECTED] wrote:
This is explained in the thread you referenced. All NSDictionary  
objects are instances of NSCFDictionary. Thus the only way to check  
if they are mutable through public API is to try mutating them and  
see if Cocoa throws a hissy fit.


You can use -classForCoder and that will give you either NSDictionary
or NSMutableDictionary. This is a public API but the result is not
documented to be useful in this manner, so don't use this in any
shipping app. (Although given the need for archives to remain
backwards compatible I would not expect it to ever change.) However it
could be handy for debugging purposes.

Mike


Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: building a custom NSView with IB?

2008-12-08 Thread Corbin Dunn


Le Dec 8, 2008 à 10:45 AM, Bill Janssen a écrit :


I'd like to build a custom view that is just an assemblage of an
NSTextView, a couple of pushbuttons, and a checkbox.  It seems to me
that there should be some way to do this with IB, but I haven't  
figured

it out yet.  All the examples on the net seem to focus on overriding
drawRect, which I *don't* need to do.  Anyone have an example of doing
this?


It should be as easy as dragging a custom NSView out into your nib,  
and placing your subviews on it.


corbin___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Bill Bumgarner

On Dec 8, 2008, at 11:53 AM, [EMAIL PROTECTED] wrote:
I would disagree. I see nothing wrong with the logically necessity  
of testing for mutability. It's just a property.


The AppKit and Foundation were designed with the decision to not allow  
for differentiation between mutable and immutable versions of a class  
cluster at runtime.


This decisions was purposeful, explicit, and intentional.

Thus, any code that tries to influence behavior based upon detecting  
mutable vs. immutable instances will be counter to the design patterns  
of the AppKit and Foundation.


And it will be problematic.   As has been noted, the AppKit/Foundation  
APIs are written such that a method declared as returning  
(NSDictionary*) will not have said dictionary modified after the  
fact.  Writing code that detects mutability and then mutates, if  
possible, would violate this contract and will cause unpredictable,  
potentially crashy, behavior.


If the intention is to only use this for debugging purposes and to  
never influence at runtime behavior based on the mutability of an  
object, then the intention is more reasonable.  However, this is still  
problematic specifically because many classes may return a mutable  
object as the result of calling a method that is declared as returning  
an instance of the immutable parent.


Thus, such code can really only be reliable when limited to testing  
the objects produced by your own code.  Potentially valuable, but only  
of a limited nature.


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 [EMAIL PROTECTED]


Drawing a string with a clearColor background

2008-12-08 Thread Randall Meadows
I know I've seen a discussion of this, but my search-fu is weak today,  
apparently.  Please feel free to reply in links to the answer, if you  
wish...


I'm trying to draw (in a view's -drawRect: method) a string over top  
an image background:


NSDictionary   *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
  font, NSFontAttributeName,
  textColor, NSForegroundColorAttributeName,
  [NSColor clearColor], NSBackgroundColorAttributeName,
  nil];
[text drawInRect:textBounds withAttributes:attrs];

draws the string in the correct text color and font, with a black  
rectangular background.  I want the background image to show through  
the holes in the string I'm drawing.  I tried adding


[[NSColor clearColor] set];
NSRectFill(textBounds);

before the -drawInRect: call, to no avail.  What am I missing?

Thanks!
randy
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: best practice to create Custom Objects represented by a image in a d-n-d operation

2008-12-08 Thread Sandeep Chayapathi
Go for option #1, use a  custom drag type (in your case ships) to
pasteboard. You could update the pasteboard with the array of dictionary
objects, the dictionary could hold the image/link to image and an identifier
field for the same.
Make sure you register you drag destination for your custom drap type. (
http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/Tasks/acceptingdrags.html
)

-- Sandeep


On Mon, Dec 8, 2008 at 1:11 PM, Gustavo Pizano
[EMAIL PROTECTED]wrote:

 Hello.

 I have in a view images of ships, and Im able to drag them to another view
 which is the sea board, now, what is better, to create the objects of the
 ships in the shipsviewcontainer and set the object in the Pasteboard, or,
 just have representative images in the shipsviewcontainer of each ship,
 and once dragged to the sea create the instances of the ship that the images
 represent.  If the last one is correct Iw as thinking if how to know which
 Ship Object the images that is being dragged represents, (maybe by image
 Size? ) I dunno what do you think its better to do, if I explain my self
 good.


 Thanks

 Gus

 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread [EMAIL PROTECTED]


On 8 Dec 2008, at 21:25, Bill Bumgarner wrote:


On Dec 8, 2008, at 11:53 AM, [EMAIL PROTECTED] wrote:
I would disagree. I see nothing wrong with the logically necessity  
of testing for mutability. It's just a property.


The AppKit and Foundation were designed with the decision to not  
allow for differentiation between mutable and immutable versions of  
a class cluster at runtime.


This decisions was purposeful, explicit, and intentional.
I find this an interesting point. Why was such a decision made? It  
seems counter intuitive.


Thus, any code that tries to influence behavior based upon detecting  
mutable vs. immutable instances will be counter to the design  
patterns of the AppKit and Foundation.


And it will be problematic.   As has been noted, the AppKit/ 
Foundation APIs are written such that a method declared as returning  
(NSDictionary*) will not have said dictionary modified after the  
fact.  Writing code that detects mutability and then mutates, if  
possible, would violate this contract and will cause unpredictable,  
potentially crashy, behavior.


If the intention is to only use this for debugging purposes and to  
never influence at runtime behavior based on the mutability of an  
object, then the intention is more reasonable.  However, this is  
still problematic specifically because many classes may return a  
mutable object as the result of calling a method that is declared as  
returning an instance of the immutable parent.


Thus, such code can really only be reliable when limited to testing  
the objects produced by your own code.  Potentially valuable, but  
only of a limited nature.



b.bum



Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




___

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

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

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

This email sent to [EMAIL PROTECTED]


CocoaHeads: switzerland / zurich area

2008-12-08 Thread John Clayton

Hi All,

Sorry to spam you non-europeans, but I'm sure you support the idea at  
least in concept anyway:


I'm considering starting the Switzerland chapter of CocoaHeads - and  
would like to gauge interest of fellow Mac programmers in the greater  
Zurich / Rapperswil area.


If you are in the area, and would be interested in a monthly Mac  
programmer meet up to share ideas and generally geek out with at least  
one other crazy Mac programmer - please contact me direct and let me  
know - just a 'yes yes - pick me!' is fine as an indication of  
interest to begin with!


Thanks, happy coding.
--
John Clayton
Skype: johncclayton




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Bill Bumgarner

On Dec 8, 2008, at 1:43 PM, [EMAIL PROTECTED] wrote:

This decisions was purposeful, explicit, and intentional.
I find this an interesting point. Why was such a decision made? It  
seems counter intuitive.



Performance

An NSMutableDictionary instance can be returned from a method declared  
as returning (NSDictionary*) without risk that the client is going to  
go and change the contents behind your back.  If test for mutability  
were common, then all kinds of methods across the 'kits would have to - 
copy the return value and, potentially, deeply.


Simplicity

What does mutable even mean in the case of a collection?  If an  
NSArray of NSDictionaries is mutable, does that also mean the  
NSDictionaries contained within are mutable?   The current design  
point is that pretty much everything is immutable unless (a) you  
specifically created a mutable data structure or (b) the 'kit  
explicitly returned a mutable data structure.


Reliability

Having lots of if (mutable) this else that decision points would  
reduce the reliability of code in that it would increase the testing  
load.Example:  Unit tests would have to explicitly test the code  
for both the immutable vs. mutable variants.  And that doesn't  
consider the mutable container vs. immutable contents potential  
myriad of combinations.


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 [EMAIL PROTECTED]


Re: Core Data request predicates and to-many relationships

2008-12-08 Thread Melissa J. Turner


On Dec 6, 2008, at 01:45, Luke Evans wrote:

If there are any NSPredicate gurus out there, I'm scratching my head  
on this one:


I have an entity that can optionally have a set of attributes (name- 
value pairs).  This is set up in the model as a optional to-many  
relationship to an attribute entity.
Now, I want to fetch the list of managed objects of this entity  
whose attributes exactly match a dictionary that is passed.  The  
predicate for this needs to filter the objects that have all the  
required attributes; matching both the name, and value for each  
attribute.


At this point I'm not seeing how you can code this in a predicate.   
If I AND some clauses like:

...ANY attr.name == %@ AND ANY attr.value == [EMAIL PROTECTED]
for each attribute I'm testing for, then AFAICS I'm not testing that  
the _same_ attr has the name and value.


I wondered about:
...ANY (attr.name == %@ AND attr.value == %@)...
but this doesn't appear to be legal syntax.

I'm still experimenting, but if anyone knows how to express a query  
that allows multiple clauses on the _same_ entity across a to-many  
relationship I'd appreciate a clue!


Cheers

Luke


If you're targetting 10.5 or later, there's a subquery expression in  
the predicates that was added to support this kind of query. The  
syntax for what you're doing would be:


SUBQUERY(toMany, $each, $each.name == %@ AND $each.value = %@)[EMAIL PROTECTED]  
 0


Note that this is on the list of expensive predicate operations, so it  
should be towards the end of a compound predicate.


Cheers,
+Melissa

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Adam Leonard


The only thing you could consider broken is if the method promises
an immutable object but gives you a mutable one (or vice-versa).


I agree that it is definitely wrong to declare method as returning a  
mutable object, and actually returning a immutable object instead.


But is it really true that it is wrong to do it the other way around?

I often declare a method as returning an NSDictionary, but in the  
actual implementation, I work with an NSMutableDictionary. It seems  
sort of pointless to do a return [[mutableDictionary  
copy]autorelease] on it, since a mutable dictionary can do everything  
a immutable dictionary can. Either way, the receiver should not be  
trying to call any mutating methods on something that is declared to  
return an NSDictionary *, so there should be no adverse effects.


And of course, if the client wants a mutable dictionary, there is  
nothing wrong with calling -mutableCopy on the returned secretly  
mutable dictionary.


If you are just saying that you shouldn't explicitly write in the  
documentation returns an immutable dictionary if you actually return  
a mutable dictionary, then sure, that makes sense.


But using NSDictionary as a placeholder for something that actually  
happens to be mutable seems fine to me if you don't want to have  
clients relying on the method's implementation using a mutable  
dictionary internally.


I'm pretty sure I have seen the Cocoa frameworks doing this.

Or are there other concerns, like breaking the technique here of  
checking for the classForCoder? Like people have been saying, that  
seems like bad design to me anyway.


Adam Leonard
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing a string with a clearColor background

2008-12-08 Thread Rob Keniger


On 09/12/2008, at 7:31 AM, Randall Meadows wrote:


NSDictionary   *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
 font, NSFontAttributeName,
 textColor, NSForegroundColorAttributeName,
 [NSColor clearColor], NSBackgroundColorAttributeName,
 nil];
[text drawInRect:textBounds withAttributes:attrs];

draws the string in the correct text color and font, with a black  
rectangular background.  I want the background image to show through  
the holes in the string I'm drawing.  I tried adding


[[NSColor clearColor] set];
NSRectFill(textBounds);

before the -drawInRect: call, to no avail.  What am I missing?



If you don't set the background at all the text should draw with no  
background.


NSDictionary   *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
 font, NSFontAttributeName,
 textColor, NSForegroundColorAttributeName,
 nil];
[text drawInRect:textBounds withAttributes:attrs];
--
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 [EMAIL PROTECTED]


NSTask

2008-12-08 Thread Filip van der Meeren

Good evening (for my region),

I am currently working on a small project to manage the different  
builds of perl and its modules. Since it is such a hassle to find/ 
install PerlModules and newer builds of Perl itself.


I am trying to retrieve all paths that perl uses to retrieve modules.
I found the command: perl -v. I know how to parse this, but how do I  
get it inside my Cocoa application?


I have tried to following:

NSTask *task = [[[NSTask alloc] init] autorelease];
[task setLaunchPath:@/System/Library/Perl/5.8.8];
[task setArguments:[NSArray arrayWithObject:@-v]];
[task launch];
[task waitUntilExit];

But it seems to get the same exception every time I try this, even in  
different configs.


2008-12-08 23:15:11.459 PerlManager[924:203] *** NSTask: Task create  
for path '/System/Library/Perl/5.8.8' failed: 13, Permission  
denied.  Terminating temporary process.


Any ideas on how to fix my problem ?

Thank you,

Filip van der Meeren
[EMAIL PROTECTED]
http://www.sourceforge.net/projects/perlmanager

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Shell tool with GUI

2008-12-08 Thread Rob Keniger


On 09/12/2008, at 3:06 AM, Michael Ash wrote:


Can't be done. NSApplication is a prerequisite to creating windows
with Cocoa. NSApplication is not incompatible with a shell tool as
others have mentioned so you can simply do this *with* an instance of
NSApplication, however I would like to point out a couple of
alternative strategies that you may not have considered.



It's probably also worth mentioning the LSUIElement key that you can  
insert into your app's Info.plist file. If you set LSUIElement to 1,  
your app will be a full-blown graphical application that can open  
windows etc, but it will not appear in the Dock and does not have a  
menu bar.


--
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 [EMAIL PROTECTED]


Re: Weird behavior of mouse location when performing a drag

2008-12-08 Thread Rob Keniger


On 09/12/2008, at 3:56 AM, Gustavo Pizano wrote:

Well Im performing a drag-ndrop between views of the same app, I  
implemented the  - (NSDragOperation)draggingUpdated:(id   
NSDraggingInfo )sender method, because I need to know the location  
of the mouse so I can place the image in the correct position of the  
view. But weirdly after converting the point to the currentview   
there was a gap of about 145ox in x coordinate and 45 px in the y  
coord, those values are not even close to where the view resides in  
the window. So what I did to fix the problem was the following.


- (NSDragOperation)draggingUpdated:(id  NSDraggingInfo )sender
{
NSPoint converted = [NSEvent mouseLocation];
actualDragPoint = [self convertPoint:converted fromView:nil];   
actualDragPoint.x = actualDragPoint.x - 144 ;
actualDragPoint.y =  actualDragPoint.y -76; 
return NSDragOperationMove;
}

it fixed the problem, but Im wondering why is this happening?



[NSEvent mouseLocation] returns the location of the mouse in screen  
coordinates and you are treating it as if it is in Window coordinates.


You want the following:

- (NSDragOperation)draggingUpdated:(id  NSDraggingInfo )sender
{
NSPoint locationOnScreen = [NSEvent mouseLocation];
actualDragPoint = [self convertPointFromBase: locationOnScreen];
return NSDragOperationMove;
}

--
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 [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread [EMAIL PROTECTED]

Thanks for the insight into this. Some subtle stuff here.

On 8 Dec 2008, at 21:54, Bill Bumgarner wrote:


On Dec 8, 2008, at 1:43 PM, [EMAIL PROTECTED] wrote:

This decisions was purposeful, explicit, and intentional.
I find this an interesting point. Why was such a decision made? It  
seems counter intuitive.



Performance

An NSMutableDictionary instance can be returned from a method  
declared as returning (NSDictionary*) without risk that the client  
is going to go and change the contents behind your back.  If test  
for mutability were common, then all kinds of methods across the  
'kits would have to -copy the return value and, potentially, deeply.



Is this a bit like the emperor's new clothes?
As long as everyone says its an NSDictionary then it matters not if  
its an NSMutableDictionary!

A sort of mutually agreed insurance.

Simplicity

What does mutable even mean in the case of a collection?  If an  
NSArray of NSDictionaries is mutable, does that also mean the  
NSDictionaries contained within are mutable?   The current design  
point is that pretty much everything is immutable unless (a) you  
specifically created a mutable data structure or (b) the 'kit  
explicitly returned a mutable data structure.
This reminds me of the memory retain/release rules (if you alloc it  
you release it etc).
If these points aren't already in the docs already then they wouldn't  
be out of place there.



Reliability

Having lots of if (mutable) this else that decision points would  
reduce the reliability of code in that it would increase the testing  
load.Example:  Unit tests would have to explicitly test the code  
for both the immutable vs. mutable variants.  And that doesn't  
consider the mutable container vs. immutable contents potential  
myriad of combinations.


b.bum


Jonathan Mitchell

Central Conscious Unit
http://www.mugginsoft.com




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTask

2008-12-08 Thread Torsten Curdt
 I have tried to following:

 NSTask *task = [[[NSTask alloc] init] autorelease];
[task setLaunchPath:@/System/Library/Perl/5.8.8];
[task setArguments:[NSArray arrayWithObject:@-v]];
[task launch];
[task waitUntilExit];

You might want to point it to an executable ;) ...not just a path and option.

Depending on want you want to do NSTask might not be as easy to use as
it looks on the first glance. You might want to re-use some existing
wrapper. Here is one for example:

http://github.com/tcurdt/feedbackreporter/tree/master/Sources/Main/FRCommand.m

HTH
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTask

2008-12-08 Thread Darren Adkinson

Filip,

the perl executable itself will be in somewhere like /usr/bin/perl  
(type 'which perl'). It looks like you'd need uppercase 'V' as the  
argument, I assume this was a typo. (no idea if the rest will work or  
not, I only scanned through your email...)


darren


On Dec 8, 2008, at 2:21 PM, Filip van der Meeren wrote:


Good evening (for my region),

I am currently working on a small project to manage the different  
builds of perl and its modules. Since it is such a hassle to find/ 
install PerlModules and newer builds of Perl itself.


I am trying to retrieve all paths that perl uses to retrieve modules.
I found the command: perl -v. I know how to parse this, but how do  
I get it inside my Cocoa application?


I have tried to following:

NSTask *task = [[[NSTask alloc] init] autorelease];
[task setLaunchPath:@/System/Library/Perl/5.8.8];
[task setArguments:[NSArray arrayWithObject:@-v]];
[task launch];
[task waitUntilExit];

But it seems to get the same exception every time I try this, even  
in different configs.


2008-12-08 23:15:11.459 PerlManager[924:203] *** NSTask: Task create  
for path '/System/Library/Perl/5.8.8' failed: 13, Permission  
denied.  Terminating temporary process.


Any ideas on how to fix my problem ?

Thank you,

Filip van der Meeren
[EMAIL PROTECTED]
http://www.sourceforge.net/projects/perlmanager


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Andy Lee

On Dec 8, 2008, at 5:15 PM, Adam Leonard wrote:
But using NSDictionary as a placeholder for something that actually  
happens to be mutable seems fine to me if you don't want to have  
clients relying on the method's implementation using a mutable  
dictionary internally.


I'm pretty sure I have seen the Cocoa frameworks doing this.


Yup.  I just did a quick test using -[NSView subviews].  The return  
type is NSArray*, but if you send -addSubview: to the view, the size  
of the previously returned array grows by 1.


I would never assume a returned array is immutable just because the  
declared return type of a method is NSArray*.


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTask

2008-12-08 Thread Filip van der Meeren

Ok, I did not type out the example as I should, but still, it fails.
With an no permission exception.
And I would love to execute the example with something like:

[task setLaunchPath:@perl];

You never know what version is installed on the target computer...

Filip van der Meeren
[EMAIL PROTECTED]
http://www.sourceforge.net/projects/perlmanager

On 08 Dec 2008, at 23:33, Torsten Curdt wrote:


I have tried to following:

NSTask *task = [[[NSTask alloc] init] autorelease];
  [task setLaunchPath:@/System/Library/Perl/5.8.8];
  [task setArguments:[NSArray arrayWithObject:@-v]];
  [task launch];
  [task waitUntilExit];


You might want to point it to an executable ;) ...not just a path  
and option.


Depending on want you want to do NSTask might not be as easy to use as
it looks on the first glance. You might want to re-use some existing
wrapper. Here is one for example:

http://github.com/tcurdt/feedbackreporter/tree/master/Sources/Main/FRCommand.m

HTH
--
Torsten


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTask

2008-12-08 Thread Filip van der Meeren

I already replied to my typos.
But still the exception is thrown every codesetup I use.

Filip van der Meeren
[EMAIL PROTECTED]
http://www.sourceforge.net/projects/perlmanager

On 08 Dec 2008, at 23:36, Darren Adkinson wrote:


Filip,

the perl executable itself will be in somewhere like /usr/bin/perl  
(type 'which perl'). It looks like you'd need uppercase 'V' as the  
argument, I assume this was a typo. (no idea if the rest will work  
or not, I only scanned through your email...)


darren


On Dec 8, 2008, at 2:21 PM, Filip van der Meeren wrote:


Good evening (for my region),

I am currently working on a small project to manage the different  
builds of perl and its modules. Since it is such a hassle to find/ 
install PerlModules and newer builds of Perl itself.


I am trying to retrieve all paths that perl uses to retrieve modules.
I found the command: perl -v. I know how to parse this, but how  
do I get it inside my Cocoa application?


I have tried to following:

NSTask *task = [[[NSTask alloc] init] autorelease];
[task setLaunchPath:@/System/Library/Perl/5.8.8];
[task setArguments:[NSArray arrayWithObject:@-v]];
[task launch];
[task waitUntilExit];

But it seems to get the same exception every time I try this, even  
in different configs.


2008-12-08 23:15:11.459 PerlManager[924:203] *** NSTask: Task  
create for path '/System/Library/Perl/5.8.8' failed: 13,  
Permission denied.  Terminating temporary process.


Any ideas on how to fix my problem ?

Thank you,

Filip van der Meeren
[EMAIL PROTECTED]
http://www.sourceforge.net/projects/perlmanager




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTask

2008-12-08 Thread Andrew Farmer

On 08 Dec 08, at 14:36, Darren Adkinson wrote:
the perl executable itself will be in somewhere like /usr/bin/perl  
(type 'which perl'). It looks like you'd need uppercase 'V' as the  
argument...


Or, better yet:

[task setArguments:[NSArray arrayWithObjects: @-e, @print join $/,  
@INC, nil]];


You'll still need to read the input into a string, though... sending  
it to the system console isn't much use.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data request predicates and to-many relationships

2008-12-08 Thread Luke Evans

Thanks for the reply Melissa - much appreciated.

I was beginning to toy with the idea of trying a function expression  
(which I have used before for other purposes) to isolate an individual  
attribute object and perform the several comparisons therein.
Presumably SUBQUERY, being designed for the job, benefits from some  
performance advantages over the function approach(?).


Regards

Luke



On 8-Dec-08, at 2:07 PM, Melissa J. Turner wrote:



On Dec 6, 2008, at 01:45, Luke Evans wrote:

If there are any NSPredicate gurus out there, I'm scratching my  
head on this one:


I have an entity that can optionally have a set of attributes (name- 
value pairs).  This is set up in the model as a optional to-many  
relationship to an attribute entity.
Now, I want to fetch the list of managed objects of this entity  
whose attributes exactly match a dictionary that is passed.  The  
predicate for this needs to filter the objects that have all the  
required attributes; matching both the name, and value for each  
attribute.


At this point I'm not seeing how you can code this in a predicate.   
If I AND some clauses like:

...ANY attr.name == %@ AND ANY attr.value == [EMAIL PROTECTED]
for each attribute I'm testing for, then AFAICS I'm not testing  
that the _same_ attr has the name and value.


I wondered about:
...ANY (attr.name == %@ AND attr.value == %@)...
but this doesn't appear to be legal syntax.

I'm still experimenting, but if anyone knows how to express a query  
that allows multiple clauses on the _same_ entity across a to-many  
relationship I'd appreciate a clue!


Cheers

Luke


If you're targetting 10.5 or later, there's a subquery expression in  
the predicates that was added to support this kind of query. The  
syntax for what you're doing would be:


SUBQUERY(toMany, $each, $each.name == %@ AND $each.value =  
%@)[EMAIL PROTECTED]  0


Note that this is on the list of expensive predicate operations, so  
it should be towards the end of a compound predicate.


Cheers,
+Melissa




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Weird behavior of mouse location when performing a drag

2008-12-08 Thread Graham Cox


On 9 Dec 2008, at 4:56 am, Gustavo Pizano wrote:


- (NSDragOperation)draggingUpdated:(id  NSDraggingInfo )sender
{
NSPoint converted = [NSEvent mouseLocation];



You should use the information you're given, where possible:


NSPoint location = [sender draggingLocation];


In this case you are supplied the appropriate point in the dragging  
info, there's no need to go outside to get it from somewhere else.



hth,

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 [EMAIL PROTECTED]


Re: best practice to create Custom Objects represented by a image in a d-n-d operation

2008-12-08 Thread Graham Cox


On 9 Dec 2008, at 5:11 am, Gustavo Pizano wrote:

I have in a view images of ships, and Im able to drag them to  
another view which is the sea board, now, what is better, to create  
the objects of the ships in the shipsviewcontainer and set the  
object in the Pasteboard, or, just have representative images in the  
shipsviewcontainer of each ship, and once dragged to the sea  
create the instances of the ship that the images represent.  If the  
last one is correct Iw as thinking if how to know which Ship Object  
the images that is being dragged represents, (maybe by image Size? )  
I dunno what do you think its better to do, if I explain my self good.



Use a custom drag type for your ship objects.

Definitely DO NOT use image size as a way to identify the ship! That's  
just weird.


Learn about MVC (Model-View-Controller). Your ship objects are part of  
the model, which could include a list of possible ships, and a list of  
those ships which are at sea. Then your drag-n-drop operation really  
is just a cover for simply moving ship objects between the two lists.  
The shipsviewcontainer and the view that shows them at sea are just  
views that visualise the contents of your model.


If you forget about (for the moment) the way stuff is represented on  
screen and instead work on developing a model that accurately  
represents the various states of the system, you should find that  
questions about how to visualise things and other UI-level stuff like  
drag-n-drop become obvious. It sounds to me that right now you're  
trying to make your views be the model, which is a whole bag of hurt ;-)


hth,

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 [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Bill Bumgarner

On Dec 8, 2008, at 2:25 PM, [EMAIL PROTECTED] wrote:
An NSMutableDictionary instance can be returned from a method  
declared as returning (NSDictionary*) without risk that the client  
is going to go and change the contents behind your back.  If test  
for mutability were common, then all kinds of methods across the  
'kits would have to -copy the return value and, potentially, deeply.



Is this a bit like the emperor's new clothes?
As long as everyone says its an NSDictionary then it matters not if  
its an NSMutableDictionary!

A sort of mutually agreed insurance.


Well... yes... but since you can't reliably differentiate between  
mutable and immutable, then it is difficult to tell if the emperor is  
clothed or not.


Objective-C is C with objects and C provides an infinite amount of  
rope.  The implementation philosophy of the AppKit and Foundation is  
such that it tries to make not entangling yourself the most natural of  
coding pattern available.   Given the great lengths that one would  
have to go through to determine behavior based upon mutable vs.  
immutable, the inconvenience keeps most from entanglement.


(A bit of trivia -- there were several major versions of Mac OS X  
released where NSDictionary instances *were* mutable.)



Simplicity

What does mutable even mean in the case of a collection?  If an  
NSArray of NSDictionaries is mutable, does that also mean the  
NSDictionaries contained within are mutable?   The current design  
point is that pretty much everything is immutable unless (a) you  
specifically created a mutable data structure or (b) the 'kit  
explicitly returned a mutable data structure.
This reminds me of the memory retain/release rules (if you alloc it  
you release it etc).
If these points aren't already in the docs already then they  
wouldn't be out of place there.


A bug was filed to track documentation clarification: rdar://problem/6428503 



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 [EMAIL PROTECTED]


Re: Drawing a string with a clearColor background

2008-12-08 Thread Randall Meadows

On Dec 8, 2008, at 3:17 PM, Rob Keniger wrote:


On 09/12/2008, at 7:31 AM, Randall Meadows wrote:

If you don't set the background at all the text should draw with no  
background.


DOH!  Of course the simplest answer is the correct one.

Thanks a bunch.
randy
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data request predicates and to-many relationships

2008-12-08 Thread Melissa J. Turner


On Dec 8, 2008, at 14:47, Luke Evans wrote:


Thanks for the reply Melissa - much appreciated.

I was beginning to toy with the idea of trying a function expression  
(which I have used before for other purposes) to isolate an  
individual attribute object and perform the several comparisons  
therein.
Presumably SUBQUERY, being designed for the job, benefits from some  
performance advantages over the function approach(?).


Regards

Luke


It depends on the query/dataset. There's no real way to tell until you  
run against a sample that's a good approximation the data your  
application will be working with. That sounds kind of fluffy, but as  
with most things, it's a tradeoff between the time spent doing the  
joins and the time it would take to do the fetch differently, which  
usually involves additional IO or in-memory computation. Subqueries  
are supported natively by CoreData/SQLite, so you do avoid a lot of  
the object instantiation you'd be dealing with if you were  
postprocessing the potential results (the set of objects without the  
correlated subquery) in memory.


Another option is to invert the query: fetch all the destination  
objects which meet your criteria for the destination, set the request  
to prefetch the relationship you're actually interested in, then do a  
second fetch with (targetObjects IN  
[EMAIL PROTECTED]) and  
includesPropertyValues set to NO (the data is already in the row cache  
at this point).


Cheers,
+Melissa

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread I. Savant

On Dec 8, 2008, at 5:15 PM, Adam Leonard wrote:

I agree that it is definitely wrong to declare method as returning a  
mutable object, and actually returning a immutable object instead.



But is it really true that it is wrong to do it the other way around?


  I absolutely cede that point. I admit I was mostly thinking of the  
'advertise-mutable-but-return-immutable' situation more than the other  
way around.


  But ... :-) ... I believe it is sloppy and imprecise. For this  
reason, I consider it bad programming. Nothing should be ambiguous  
unless the ambiguity is necessary (for which id exists).


  I would not argue that you should return [[mutableDict copy]  
autorelease] ... this has performance implications that outweigh  
precision.


  None of the above, however, detracts from the original point I  
jumped in on: asking if a collection is mutable is of limited utility  
precisely because you should already know what you're getting and  
controlling flow based on mutability only adds unnecessary complexity  
to the logic of your code.



I'm pretty sure I have seen the Cocoa frameworks doing this.


  I've also seen Cocoa crash. And miscalculate dates. And do a number  
of other unsavory things over the last decade. I'm not saying this is  
one of those cases (ie it's a bug), but Cocoa does it doesn't  
automatically classify the behavior as unassailably correct. :-) It's  
likely that the developers also decided precision wasn't worth the  
[[mutableDict copy] autorelease] overhead, given the relative  
harmlessness of the other way around as above.


   gets down off Idiot Soap Box™ 

--
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 [EMAIL PROTECTED]


Re: NSDictionary mutability test

2008-12-08 Thread Charles Steinman
- Original Message 
 From: Adam Leonard [EMAIL PROTECTED]
 To: I. Savant [EMAIL PROTECTED]; cocoa-dev@lists.apple.com
 Sent: Monday, December 8, 2008 2:15:47 PM
 Subject: Re: NSDictionary mutability test
 
  
  The only thing you could consider broken is if the method promises
  an immutable object but gives you a mutable one (or vice-versa).
 
 I agree that it is definitely wrong to declare method as returning a mutable 
 object, and actually returning a immutable object instead.
 
 But is it really true that it is wrong to do it the other way around?
 
 I often declare a method as returning an NSDictionary, but in the actual 
 implementation, I work with an NSMutableDictionary. It seems sort of 
 pointless 
 to do a return [[mutableDictionary copy]autorelease] on it, since a mutable 
 dictionary can do everything a immutable dictionary can. Either way, the 
 receiver should not be trying to call any mutating methods on something that 
 is 
 declared to return an NSDictionary *, so there should be no adverse effects.


Yes, that makes sense. It's the Liskov substitution principle. You can 
substitute a subclass in place of its superclass, but not vice versa. If the 
interface says it's an NSDictionary, it should be treated like an NSDictionary, 
but there's no need that it actually be immutable as long as you can treat it 
that way.

Cheers,
Chuck


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


  1   2   >