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

2008-12-09 Thread Gustavo Pizano

Go for option #1, use a  custom drag type (in your case ships) to
pasteboard.


aha ok understood that part. I think I know how to do it, shouldn't be  
different form registering a tiff representation of an image just  
register the NSData of the custom object no?



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.


didn't get that part good... :s,  if I put in the pasteboard custom  
objetcs (in my case ships) each Ship has an image associated with  so  
in my destination when I read the pasteboard I can get the ship, and  
know exactly which instance of ship is? for example, a carrier or a  
frigate or destroyer and so on. I design my model having a super class  
Ship, and sub classes of Ship, carrier frigate and so on.


Thanks for your help






-- 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/gustavxcodepicora%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: best practice to create Custom Objects represented by a image in a d-n-d operation

2008-12-09 Thread Gustavo Pizano


On 9.12.2008, at 0:01, Graham Cox wrote:



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


In fact I have my ships the grid and the cells in my model level, teh  
controllers (AppController, which is in charge of the logic of the  
game, and ViewController, which is in charge of controlling the  
output) in a controller level, and the views are, well, in a view  
level. Last night when I went to bed I realize myself that I was  
making  mistake trying to   identify the ship my image size, I asked  
myself what if the image size change? well, then yes what you say is  
better,  in the ShipsContainerView I will instantiate each ship, I  
will put each object in the pb and then in the destination I will get   
the object, that should be the best way.


Thanks for your help

G

___

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

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

2008-12-09 Thread Volker in Lists

Hi,

you should be able to detect a double click and call a method then  
that either temporarily allows the selection or directly starts the  
edit mode. I do have a similar setup - don't do editing, but I use the  
double click action via bindings to attach notes to such an  
unselectable item.


Hth,
volker

Am 09.12.2008 um 06:55 schrieb Graham Cox:

In my NSOutlineView, I disallow selection of group items by  
implementing the delegate method -outlineView:shouldSelectItem:,  
which works fine, but I still want to be able to edit the titles of  
group items. The above method prevents this also.


How can I prevent selection of the the item but still allow editing  
of its title string?



tia,

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/volker_lists%40ecoobs.de

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: NSAlert with NSTimer

2008-12-09 Thread rajesh

I did something like this , long time back

hope, this is close enough to your requirement  or may be its a wrong  
practice ( user discretion required :) )


-()runAlert
{
..// show modal window
NSTimer *myTimer = [[NSTimer scheduledTimerWithTimeInterval:someTime  
target:self selector:@selector(killwindow:) userInfo:nil repeats:No];

}

-() killwindow:(NSTimer *) theTimer
{
//kill the window
}


if the user click on the alert window then   – invalidate the myTimer

This worked for me

~Rajesh

On Dec 9, 2008, at 10:37 AM, Rashmi Vyshnavi wrote:


Hi,
I want to close a Modal NSAlertPanel after specific period of time  
if user
does not click on any of the buttons. Is there a way to set up a  
NSTimer to

close the Alert Panel after 10 secs.

--
Thanks..
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/rajesh%40vangennep.nl

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]


NSAlert with NSTimer

2008-12-09 Thread Rashmi Vyshnavi
Hi,
I want to close a Modal NSAlertPanel after specific period of time if user
does not click on any of the buttons. Is there a way to set up a NSTimer to
close the Alert Panel after 10 secs.

-- 
Thanks..
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAlert with NSTimer

2008-12-09 Thread Rashmi Vyshnavi
I am using NSAlert. When runModal is called on the NSAlert's object, timer
is not fired till the time i close the alert panel..

On Tue, Dec 9, 2008 at 3:20 PM, rajesh [EMAIL PROTECTED] wrote:

 I did something like this , long time back

 hope, this is close enough to your requirement  or may be its a wrong
 practice ( user discretion required :) )

 -()runAlert
 {
 ..// show modal window
 NSTimer *myTimer = [[NSTimer scheduledTimerWithTimeInterval:someTime
 target:self selector:@selector(killwindow:) userInfo:nil repeats:No];
 }

 -() killwindow:(NSTimer *) theTimer
 {
 //kill the window
 }


 if the user click on the alert window then   – invalidate the myTimer

 This worked for me

 ~Rajesh

 On Dec 9, 2008, at 10:37 AM, Rashmi Vyshnavi wrote:

 Hi,
 I want to close a Modal NSAlertPanel after specific period of time if user
 does not click on any of the buttons. Is there a way to set up a NSTimer to
 close the Alert Panel after 10 secs.

 --
 Thanks..
 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rajesh%40vangennep.nl

 This email sent to [EMAIL PROTECTED]





-- 
Rashmi Vyshnavi
___

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

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

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


Ah, I understand. I've implemented the correct property now but I  
still have the problem of arrangedObjects returning an empty array  
when called in windowDidLoad. So I can't set my property as I have  
nothing to set it with. Any ideas why arrangedObjects would return  
zero? It's like the window and controls and initialised before Core  
Data can return the fetch.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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-09 Thread Roland King
no longer a violation of the NDA provided you're discussing publicly  
released software, as the new NDA states; as far as I understand it.


You may or may not have better luck over the iPhone dev forums,  
there's a couple of great people over there who are very good at  
answering the iPhone oddity questions but not the wealth of experience  
in cocoa you find here. One of the powerful things about cocoa touch  
(IMO) is that it's really just like the rest of cocoa and there's a  
lot to be gained from asking questions here and just reading the  
posts. The design patterns are the same, a lot of the workhorse  
classes are the same and the display classes do share some similarities.


I would recommend, if you haven't done so, reading all the tutorials  
about UIViewController, 'your first iPhone app' etc. I've read them a  
couple of times now and just having a passing familiarity with the  
concepts and terms means I can search quite efficiently and find  
things. The documentation is I think mostly extremely good; for  
instance had you just typed 'orientation' into the search box with  
'API' and one or other of the iPhone doc sets highlighted .. you would  
have have UIViewController and UIApplicationDelegate methods to dig in  
to and probably answered your own question. When you are reading  
documentation I would also suggest only having the iPhone doc set  
selected .. I have gone down the path of trying to use what looked  
like a great piece of cocoa only to find ... it wasn't going to work  
on the device.


On Dec 9, 2008, at 11:16 AM, Bruce Martin wrote:


Thanks for the answers. I was told that it was a violation of the NDA:

Until an announcement is made otherwise, developers should be aware
that the iPhone SDK is still under non-disclosure (section 5.3 of the
iPhone Development Agreement). It can't be discussed here, or anywhere
publicly. This includes other mailing lists, forums, and also blogs.
Violating the NDA will result in WWDR being notified of the breach.
Further action is at their (and legal's) discretion.

/
I was confused because Apple had stated recently:

On October 1st, Apple decided to remove the non-disclosure agreement  
(NDA) for released iPhone software. The updated iPhone SDK agreement  
is posted on the iPhone Dev Center.View now


So until the confusion can be resolved I will not continue this, but  
I thank you all for any answers you have given so far.



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

On Dec 8, 2008, at 10:51 AM, Dave DeLong wrote:

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/bmartin%40mac.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/rols%40rols.org

This email sent to [EMAIL PROTECTED]


___

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


Re: NSArrayController, NSPopupMenu, defaults and arrangedObjects

2008-12-09 Thread Volker in Lists

Hi Steven,

as far as I know, the fect happens in the next run loop. So you would  
need to set the selection then. This is possible for example via the  
performSelector:withObject:afterDelay: and a delay of 0.0 on self (?).



Cheers,
Volker









Ah, I understand. I've implemented the correct property now but I  
still have the problem of arrangedObjects returning an empty array  
when called in windowDidLoad. So I can't set my property as I have  
nothing to set it with. Any ideas why arrangedObjects would return  
zero? It's like the window and controls and initialised before Core  
Data can return the fetch.

___



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Optimized image drawing (currently using CGImageCreate - CGContextDrawImage)

2008-12-09 Thread Matthew Johnson
As far as I remember, you can get something like 1000 512x512 image  
draw per

sec on a mac pro (not a very good card, but not bad also). If you use
OpenGL instead of CoreGraphics, this is more like 7000 1024x768  
image per sec.


Did you have QuartzGL turned on when you tested this?

Matthew
___

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

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


Development workflows for signed code?

2008-12-09 Thread Jack Repenning
I'm just dipping my toes into the world of signed code. After spending  
some time with the Code Signing guide, I'm still not clear on how this  
affects the work flows around my product (SCPlugin, http://scplugin.tigris.org 
, which adds Subversion capabilities to Finder), partly because of  
some peculiarities it has:


 - It's a Finder plugin, not an app
 - It's open-source, so the developers don't work for the same  
company, and I need to make it very easy for developers to start
 - Many devs work on Tiger, where codesign is not available (release  
happens from Leopard)


I think I know how to generate identities and sign the plugin  
bundle. I see claims that self-signed certs are good enough for  
developers. What I'm not clear on, primarily, is what are the effects  
of mixing up copies of the same bundle signed with different  
identities? Will there be pop-ups that mention the certifying  
identity, for instance? Will there be difficulties installing one  
version over another (where the signing identity changes)?


My experiments so far seem to show that none of those things happens.  
In fact, even if I modify one of the files, so that codesign -v no  
longer likes the bundle, it still seems to work. Is codesign -v the  
only (Leopard) thing that cares about all this?



-==-
Jack Repenning
[EMAIL PROTECTED]
Project Owner
SCPlugin
http://scplugin.tigris.org
Subversion for the rest of OS X


___

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

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

2008-12-09 Thread Jean-Daniel Dupas


Le 9 déc. 08 à 05:12, Jack Repenning a écrit :

I'm just dipping my toes into the world of signed code. After  
spending some time with the Code Signing guide, I'm still not clear  
on how this affects the work flows around my product (SCPlugin, http://scplugin.tigris.org 
, which adds Subversion capabilities to Finder), partly because of  
some peculiarities it has:


- It's a Finder plugin, not an app
- It's open-source, so the developers don't work for the same  
company, and I need to make it very easy for developers to start
- Many devs work on Tiger, where codesign is not available (release  
happens from Leopard)


I think I know how to generate identities and sign the plugin  
bundle. I see claims that self-signed certs are good enough for  
developers. What I'm not clear on, primarily, is what are the  
effects of mixing up copies of the same bundle signed with different  
identities? Will there be pop-ups that mention the certifying  
identity, for instance? Will there be difficulties installing one  
version over another (where the signing identity changes)?


My experiments so far seem to show that none of those things  
happens. In fact, even if I modify one of the files, so that  
codesign -v no longer likes the bundle, it still seems to work. Is  
codesign -v the only (Leopard) thing that cares about all this?




Have a look at this technote. There is a lot of answers in it, for  
example, the list of technologies that rely on code signing in Leopard.


http://developer.apple.com/technotes/tn2007/tn2206.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]


[Moderator] Re: Design patterns: MVC, MVP, Passive View... where is Apple heading???

2008-12-09 Thread Scott Anguish


On 9-Dec-08, at 8:36 AM, Karan, Cem (Civ, ARL/CISD) wrote:

To lay the groundwork for this question, I'm going to state that I'm  
getting my definitions for MVC, MVP, and Passive View from the  
following:


http://en.wikipedia.org/wiki/Model-view-controller
http://en.wikipedia.org/wiki/Model_View_Presenter
http://www.martinfowler.com/eaaDev/PassiveScreen.html

Apple has always stated that it uses the MVC design pattern, but I  
noticed in OS X 10.5 we've gotten NSViewController, KVO, bindings,  
etc.,  objects that seem to behave more like the Passive View design  
pattern.  Is this where Apple wants us to head?  I want to plan out  
my code in a manner that plays as well as possible with Apple's  
chosen design patterns, which is why I want to know where Apple is  
headed.




this is a much more fundamental argument than a cocoa technical one.  
Please don't clutter the Cocoa list with this type of contennt.


Consider obj-c-language or other forums

[closed]

thanks

scott
[moderatr]

___

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

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

2008-12-09 Thread Sherm Pendley
The +scheduledTimer* methods schedule the timer using the default  
runloop mode. Try creating a timer without scheduling it, then adding  
it yourself to the current runloop with NSRunLoop's -addTimer:forMode:  
instead, using the NSModalPanelRunLoopMode mode:


myTimer = [NSTimer timerWithTimeInterval:1.0
   target:self
   selector:@selector(killWindow:)
   userInfo:nil
   repeats:NO];

[[NSRunLoop currentRunLoop] addTimer:myTimer
forMode:NSModalPanelRunLoopMode];

sherm--

On Dec 9, 2008, at 4:59 AM, Rashmi Vyshnavi wrote:

I am using NSAlert. When runModal is called on the NSAlert's object,  
timer

is not fired till the time i close the alert panel..

On Tue, Dec 9, 2008 at 3:20 PM, rajesh [EMAIL PROTECTED] wrote:


I did something like this , long time back

hope, this is close enough to your requirement  or may be its a wrong
practice ( user discretion required :) )

-()runAlert
{
..// show modal window
NSTimer *myTimer = [[NSTimer scheduledTimerWithTimeInterval:someTime
target:self selector:@selector(killwindow:) userInfo:nil repeats:No];
}

-() killwindow:(NSTimer *) theTimer
{
//kill the window
}


if the user click on the alert window then   – invalidate the  
myTimer


This worked for me

~Rajesh

On Dec 9, 2008, at 10:37 AM, Rashmi Vyshnavi wrote:

Hi,
I want to close a Modal NSAlertPanel after specific period of time  
if user
does not click on any of the buttons. Is there a way to set up a  
NSTimer to

close the Alert Panel after 10 secs.

--
Thanks..
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/rajesh 
%40vangennep.nl


This email sent to [EMAIL PROTECTED]






--
Rashmi Vyshnavi
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/sherm.pendley%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]


Issue with the preference window

2008-12-09 Thread Arnab Ganguly
Hi All,
I am trying out for the preference window.It is a simple app, and under the
main menu when I click on the preference it shows the preference menu popup.
But when I quit the preference window my app seemed to getting hang.I am not
able to quit the application and also the main menu also becoms inactive.

I have linked the Preference menu with  function  makeKeyAndOrderFront
in the IB. But in the IB Tool in case of the Preference window under the
Panel Connetions corresponding to makeKeyAndOrderFront i see some number 121
, is it ok?
Anybody came across similar issues?
Thanks in advance
Arnab
___

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

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

2008-12-09 Thread Jean-Daniel Dupas


Le 9 déc. 08 à 11:51, Ingvar Nedrebo a écrit :


On Dec 9, 2008, at 00:43, Chris Idou wrote:


I want to call a script with NSTask and I want to set an environment
variable.

But it seems like bad form to blow away the current environment. So  
I guess I
need to read the current environment and extend it before passing  
it to

NSTask.

Is there any Cocoa API which returns the environment as a  
NSDictionary, or do

I need to drop down to the UNIX getenv() level?



I just call setenv(). That sets one variable without affecting the  
rest of the environment, as far as I know?


i.



[[NSProcessInfo processInfo] environment]




___

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

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

2008-12-09 Thread Ingvar Nedrebo

On Dec 9, 2008, at 00:43, Chris Idou wrote:


I want to call a script with NSTask and I want to set an environment
variable.

But it seems like bad form to blow away the current environment. So  
I guess I
need to read the current environment and extend it before passing it  
to

NSTask.

Is there any Cocoa API which returns the environment as a  
NSDictionary, or do

I need to drop down to the UNIX getenv() level?



I just call setenv(). That sets one variable without affecting the  
rest of the environment, as far as I know?


i.

___

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

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

2008-12-09 Thread Rashmi Vyshnavi
It worked after adding timer in NSModalPanelRunLoopMode.Thanks

On Tue, Dec 9, 2008 at 3:46 PM, Sherm Pendley [EMAIL PROTECTED]wrote:

 The +scheduledTimer* methods schedule the timer using the default runloop
 mode. Try creating a timer without scheduling it, then adding it yourself to
 the current runloop with NSRunLoop's -addTimer:forMode: instead, using the
 NSModalPanelRunLoopMode mode:

myTimer = [NSTimer timerWithTimeInterval:1.0
   target:self
   selector:@selector(killWindow:)
   userInfo:nil
   repeats:NO];

[[NSRunLoop currentRunLoop] addTimer:myTimer
forMode:NSModalPanelRunLoopMode];

 sherm--


 On Dec 9, 2008, at 4:59 AM, Rashmi Vyshnavi wrote:

  I am using NSAlert. When runModal is called on the NSAlert's object, timer
 is not fired till the time i close the alert panel..

 On Tue, Dec 9, 2008 at 3:20 PM, rajesh [EMAIL PROTECTED] wrote:

  I did something like this , long time back

 hope, this is close enough to your requirement  or may be its a wrong
 practice ( user discretion required :) )

 -()runAlert
 {
 ..// show modal window
 NSTimer *myTimer = [[NSTimer scheduledTimerWithTimeInterval:someTime
 target:self selector:@selector(killwindow:) userInfo:nil repeats:No];
 }

 -() killwindow:(NSTimer *) theTimer
 {
 //kill the window
 }


 if the user click on the alert window then   – invalidate the myTimer

 This worked for me

 ~Rajesh

 On Dec 9, 2008, at 10:37 AM, Rashmi Vyshnavi wrote:

 Hi,
 I want to close a Modal NSAlertPanel after specific period of time if
 user
 does not click on any of the buttons. Is there a way to set up a NSTimer
 to
 close the Alert Panel after 10 secs.

 --
 Thanks..
 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rajesh%40vangennep.nl

 This email sent to [EMAIL PROTECTED]





 --
 Rashmi Vyshnavi
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]





-- 
Rashmi Vyshnavi
___

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

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


Design patterns: MVC, MVP, Passive View... where is Apple heading???

2008-12-09 Thread Karan, Cem (Civ, ARL/CISD)
To lay the groundwork for this question, I'm going to state that I'm getting my 
definitions for MVC, MVP, and Passive View from the following:

http://en.wikipedia.org/wiki/Model-view-controller
http://en.wikipedia.org/wiki/Model_View_Presenter
http://www.martinfowler.com/eaaDev/PassiveScreen.html

Apple has always stated that it uses the MVC design pattern, but I noticed in 
OS X 10.5 we've gotten NSViewController, KVO, bindings, etc.,  objects that 
seem to behave more like the Passive View design pattern.  Is this where Apple 
wants us to head?  I want to plan out my code in a manner that plays as well as 
possible with Apple's chosen design patterns, which is why I want to know where 
Apple is headed.

Thanks,
Cem Karan
___

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

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

2008-12-09 Thread Gregory Weston

Mahaboob wrote:


Hi all,
In my application NSPopUpButton shows the table names in the database.
When I'm pointing one table name and hitting  delete key, I need  
to  delete
the table from the database. How can I implement delete key event  
for PopUp

Button?


If I'm understanding correctly (or even close to correctly) what  
you're asking for, I think my answer is going to be that you need to  
rethink your UI. The behavior you seem to be describing is well  
outside the normal interaction with a popup button and I'd argue that  
it's likely to confuse users or even be invoked unintentionally. Both  
of those are undesirable during an operation that's inherently  
destructive.


___

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

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

2008-12-09 Thread Chris Suter
On Tue, Dec 9, 2008 at 4:12 AM, Jack Repenning [EMAIL PROTECTED] wrote:

 My experiments so far seem to show that none of those things happens. In
 fact, even if I modify one of the files, so that codesign -v no longer
 likes the bundle, it still seems to work. Is codesign -v the only
 (Leopard) thing that cares about all this?

My understanding is that the main thing that it affects at the moment
is access to the Keychain. If you break the signature, I think users
will be prompted to enter their password whenever they access the
Keychain. There are also implications for when upgraded applications
try and access the Keychain. The other thing that it affects is the
parental controls but I don't know the details. You can change the
behaviour of your application by using the Kill flag (IIRC) which will
prevent the application from running with an invalid signature.

It wouldn't surprise me if future releases of OS X make more use of
the code signature.

By the way, you should post code signing questions to the apple-cdsa
list rather than the Cocoa list as you'll get a better response there.

-- 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: ASLExpireTime Format? [Solved, somewhat]

2008-12-09 Thread Karl Moskowski
So, I think I know why ASLExpireTime had no effect on the making  
messages persist in the main database.


It looks like syslogd has to be started with the -a flag to enable  
archiving. When I added the flag to the ProgramArguments section of / 
System/Library/LaunchDaemons/com.apple.syslogd.plist, the messages  
correctly expired and the database was archived daily. However, in a  
standard Mac OS X installation, the flag is omitted and archiving is  
disabled - old messages are purged from /var/log/asl.db weekly and the  
log database starts fresh.


I guess the only option is to use asl_add_log_file() and manage the  
log files manually.



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: Printing File to PDF from Native Application

2008-12-09 Thread Scott Ribe
There is no reliable documented API for switching the default printer. There
are workarounds which might or might not work in the future.

Briefly: there are CUPS techniques for setting the default printer. Under
10.4 these worked. Under 10.5 these work unless the user has chosen Last
Printer in System preferences as the default printer, in which case the
CUPS setting is ignored. So you have to check that preference, and
potentially switch it temporarily. Hint:

/usr/bin/defaults -currentHost read com.apple.print.PrintingPrefs
UseLastPrinterAsCurrentPrinter

There is no system facility for creating a printer which creates a PDF file.
There is a download called CUPS-PDF which will do this. There are certain
things about it that I don't like WRT file naming  placement. There are
also some shell scripts floating around that accomplish the same thing. If
you examine them, you find that they're basically just passing data through,
since CUPS sends PDF to the driver. So what they really do is a batch of
setup WRT to parsing command-line arguments, naming creating  placing a
file, and so on. 

The biggest problem with these is that they assume one instance, and if you
try to create multiple printer instances, they all put files in the same
place. So your custom printer would potentially interfere with ones set up
by a user, rather than being truly dedicated to your use. It would be
possible to modify one of these to name  place the PDF files as you prefer.
I would have done that, but I hate bash scripting, so I wrote my own in
Ruby.

In or to print a file using another program, you want to look into
AppleScript and possibly Launch Services.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

2008-12-09 Thread Nick Zitzmann


On Dec 9, 2008, at 9:17 AM, Chunk 1978 wrote:


that works... but now i want that rect to redraw itself when notified
to do so, but i can't figure out how to notify the NSRect to draw
again... all my NSUserDefaults colorAsData is in place, as well as my
NSNotifications.  it will print to NSLog so i know that notification
is being called, but how do direct that notification to the drawRect
method?



-setNeedsDisplay: or -setNeedsDisplayInRect:.

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: Text Not Anti-Aliased In NSView

2008-12-09 Thread Nick Zitzmann


On Dec 9, 2008, at 9:21 AM, Chunk 1978 wrote:


this link ( 
http://att.macrumors.com/attachment.php?attachmentid=147663d=1228770137
) will show you an image displaying this problem.  the window on the
left is from
within Interface Builder (anti-aliased text), the window on the right
is the running build (text with aliasing).  how can i solve this
problem?



Are you sure you're placing the rect in an integral frame, and drawing  
the text in integral bounds?


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 way to do hit testing on an image?

2008-12-09 Thread Karan, Cem (Civ, ARL/CISD)
I am in the process of creating a new interface for my program, which, for lack 
of any good comparison, can be thought of as a 2D scrolling game with a bunch 
of clickable sprites.  I need to do hit testing to see if particular bitmaps 
have been clicked on.  I have the following information available to me:

- An array of NSImages that I can get bitmaps and masks from
- The view I'm compositing the images into.
- The order I'm compositing the images (so I know which image is painted on top 
of which other one, letting me calculate a new bitmask)
- The location I'm compositing the images relative to the view.

What I want to know is if a user has clicked on a particular image.  I know I 
need to do hit testing, and I know I can create my own code to do so, but I was 
wondering if Cocoa had some built-in method to determine if a point is within a 
bitmask or not.  If there is a built-in way, I'd rather use that.

Thanks,
Cem Karan
___

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

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

2008-12-09 Thread rajesh


On Dec 9, 2008, at 5:17 PM, Chunk 1978 wrote:


i'm assuming this is simple, but i can't solve the problem. at launch
of the application, an NSRect is drawn with a userdefault color:

-=-=-=-=-
- (void)drawRect:(NSRect)rect
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSData *colorAsData;
colorAsData = [defaults objectForKey:@aColor];
NSColor *menuBarColor = [NSKeyedUnarchiver
unarchiveObjectWithData:colorAsData];
[menuBarColor set];
NSRectFill([self bounds]);
}
-=-=-=-=-

that works... but now i want that rect to redraw itself when notified
to do so, but i can't figure out how to notify the NSRect to draw
again... all my NSUserDefaults colorAsData is in place, as well as my
NSNotifications.  it will print to NSLog so i know that notification
is being called, but how do direct that notification to the drawRect
method?

-=-=-=-=-
- (void)awakeFromNib
{
[MenuBarWindow setAlphaValue:0.0];

NSNotificationCenter *notificationCenter = [NSNotificationCenter
defaultCenter];
NSString *changeColorNotification = @changeColorNotification;
[notificationCenter addObserver:self selector:@selector(changeColor:)
changeColorNotification object:nil];
}

- (void)changeColor:(NSNotification *)notification
{
NSLog(@Call drawRect);
//call drawRect:(NSRect)rect method


Let me cover the obvious part... ( just to see that no stone is  
unturned )


you mean , even after when you tried[self setNeedsDisplay:YES] 
I guess you know that , you are not supposed to invoke the drawRect  
directly ..


Are you sure this what you wanted ? or I didn't get the tone of   
obvious tricky question ??





}
-=-=-=-=-
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/rajesh%40vangennep.nl

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: Right way to implement contextual menu in table/outline view?

2008-12-09 Thread Corbin Dunn


Le Dec 8, 2008 à 8:12 PM, Graham Cox a écrit :



On 9 Dec 2008, at 2:56 pm, Jim Correia wrote:


On Dec 8, 2008, at 10:51 PM, Graham Cox wrote:

In my app I have an NSOutlineView. I have contextual menus  
relating to the overall table, but also relating to an individual  
item row. I notice that when I right-click on a row, I get a  
special highlight (blue outline) independent of the selected row.  
How can I find out what row that was when the menu item's action  
is called? I need to handle the menu differently depending on  
whether a specific row was right-clicked or just the general table.


I don't know if this made the general docs, but this is discussed  
in the AppKit release notes for Leopard.


The relevant section is titled NSTableView/NSOutlineView -  
Contextual menu support.


Jim



Thanks Jim, just what I needed (in a nutshell, -clickedRow:)


Also look at the DragNDropOutlineView example that shows how to do  
this. If -clickedRow is in the -selectedRowIndexes, then you should  
apply your context to all selectedRows.


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: How Can I Notify DrawRect Method?

2008-12-09 Thread Chunk 1978
i hadn't tried setNeedsDisplay:YES... but this works... and now i know
what setNeedsDisplay means, which is exciting :)

thanks everyone.

On Tue, Dec 9, 2008 at 11:27 AM, rajesh [EMAIL PROTECTED] wrote:

 On Dec 9, 2008, at 5:17 PM, Chunk 1978 wrote:

 i'm assuming this is simple, but i can't solve the problem. at launch
 of the application, an NSRect is drawn with a userdefault color:

 -=-=-=-=-
 - (void)drawRect:(NSRect)rect
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSData *colorAsData;
colorAsData = [defaults objectForKey:@aColor];
NSColor *menuBarColor = [NSKeyedUnarchiver
 unarchiveObjectWithData:colorAsData];
[menuBarColor set];
NSRectFill([self bounds]);
}
 -=-=-=-=-

 that works... but now i want that rect to redraw itself when notified
 to do so, but i can't figure out how to notify the NSRect to draw
 again... all my NSUserDefaults colorAsData is in place, as well as my
 NSNotifications.  it will print to NSLog so i know that notification
 is being called, but how do direct that notification to the drawRect
 method?

 -=-=-=-=-
 - (void)awakeFromNib
{
[MenuBarWindow setAlphaValue:0.0];

NSNotificationCenter *notificationCenter = [NSNotificationCenter
 defaultCenter];
NSString *changeColorNotification = @changeColorNotification;
[notificationCenter addObserver:self
 selector:@selector(changeColor:)
 changeColorNotification object:nil];
}

 - (void)changeColor:(NSNotification *)notification
{
NSLog(@Call drawRect);
//call drawRect:(NSRect)rect method

 Let me cover the obvious part... ( just to see that no stone is unturned
 )

 you mean , even after when you tried[self setNeedsDisplay:YES] 
 I guess you know that , you are not supposed to invoke the drawRect directly
 ..

 Are you sure this what you wanted ? or I didn't get the tone of  obvious
 tricky question ??



}
 -=-=-=-=-
 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rajesh%40vangennep.nl

 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: Another NSOutlineView question

2008-12-09 Thread Corbin Dunn

Le Dec 9, 2008 à 12:40 AM, Volker in Lists a écrit :


Hi,

you should be able to detect a double click and call a method then  
that either temporarily allows the selection or directly starts the  
edit mode. I do have a similar setup - don't do editing, but I use  
the double click action via bindings to attach notes to such an  
unselectable item.




This approach may work, but it will give some undesired UI; this app  
would the only be editable on double clicking, while other apps edit  
on single-click (ala Leopard NSTableView and Finder).


You want to use this delegate method:

/*  Optional - Custom tracking support
It is possible to control the ability to track a cell or not.  
Normally, only selectable or selected cells can be tracked. If you  
implement this method, cells which are not selectable or selected can  
be tracked, and vice-versa. For instance, this allows you to have an  
NSButtonCell in a table which does not change the selection, but can  
still be clicked on and tracked.

*/
- (BOOL)tableView:(NSTableView *)tableView shouldTrackCell:(NSCell *) 
cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row  
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;



Return YES for your cell, and it should be trackable, and hence  
editable...


corbin




Hth,
volker

Am 09.12.2008 um 06:55 schrieb Graham Cox:

In my NSOutlineView, I disallow selection of group items by  
implementing the delegate method -outlineView:shouldSelectItem:,  
which works fine, but I still want to be able to edit the titles of  
group items. The above method prevents this also.


How can I prevent selection of the the item but still allow editing  
of its title string?



tia,


___

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

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

2008-12-09 Thread I. Savant
On Tue, Dec 9, 2008 at 11:17 AM, Chunk 1978 [EMAIL PROTECTED] wrote:
 that works... but now i want that rect to redraw itself when notified
 to do so, but i can't figure out how to notify the NSRect to draw
 again... all my NSUserDefaults colorAsData is in place, as well as my
 NSNotifications.  it will print to NSLog so i know that notification
 is being called, but how do direct that notification to the drawRect
 method?

  In addition to NIck's advice, you should give this a thorough read
(to save yourself lots of headaches):

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaDrawingGuide/Introduction/chapter_1_section_1.html

  Also, the custom view that draws the rectangle should probably
maintain this property itself (such as -rectColor). It's probably
trivial for your current application (which looks like a learning
exercise) but has performance implications in a full-fledged app. This
way, you can always use [self rectColor] instead of all the messaging
overhead of asking preferences each time you draw.

  To handle the color change in the user defaults, use the same method
(the notification) but set the new color as the notification's object
when you post the notification in the first place, then your view can
ask the notification for its -object and (if it's a proper color),
call [self setRectColor:[aNotification object]].

  In your -setRectColor: you can store the color then immediately call
[self setNeedsDisplay:YES] (if the color is different). This way, any
time the view's color is set (either directly or by notification), the
view is always marked as needing display and no further calls to
-setNeedsDisplay: are needed for rect color changes. That means less
to debug. :-)

--
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: The thread that starts by NSTask didn't clear up

2008-12-09 Thread Etienne Guérard
	I started an AP use NSTask in my project ,when I loaded this AP,  
thread count will be increased ,after sending apple event to AP ,  
and AP will exit, but thread count can't decrease. If I used this  
method load AP more times, thread count will increased, but there  
was no problem on tiger, just  present leopard. Sorry for my poor  
english.


I assume that AP acually means application.
I understand that you send some Apple event to your application like a  
quit' event, right?
You say that your application exit. OK. So what process the threads  
you're talking about belong to?

Where does NSTask come into this?

You have to be more precise to get an answer...

EG

This message and any attachments (the message) are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is prohibited. E-mails 
are susceptible to alteration. Neither DxO Labs nor any of its subsidiaries or affiliates 
shall be liable for the message if altered, changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le message) sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation 
ou diffusion non autorisee est interdite. Tout message electronique est susceptible 
d'alteration. DxO Labs et ses filiales declinent toute responsabilite au titre de ce 
message s'il a ete altere, modifie ou falsifie.

___

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

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


How to launch window of the application on clicking of dock icon?

2008-12-09 Thread Arun
Hi,

I have created a simple application in cocoa.
when it is ran, the main window appears and a default dock icon in the Dock.
If i close the window, the dock icon still stays. But if i click on the dock
icon then also the main window is visible.
The only way i can see the main window is by quitting the app and launching
it again. Is there any way in which upon clicking on the dock,
the application window becomes visible.

Thanks
Arun KA
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 launch window of the application on clicking of dock icon?

2008-12-09 Thread Josh Abernathy
In your app delegate, implement -applicationDidBecomeActive: to show  
your window.


On Dec 9, 2008, at 12:02 PM, Arun wrote:


Hi,

I have created a simple application in cocoa.
when it is ran, the main window appears and a default dock icon in  
the Dock.
If i close the window, the dock icon still stays. But if i click on  
the dock

icon then also the main window is visible.
The only way i can see the main window is by quitting the app and  
launching

it again. Is there any way in which upon clicking on the dock,
the application window becomes visible.

Thanks
Arun KA
___

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

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

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

This email sent to [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: How to launch window of the application on clicking of dock icon?

2008-12-09 Thread Benjamin Dobson


On 9 Dec 2008, at 17:02:19, Arun wrote:


Hi,

I have created a simple application in cocoa.
when it is ran, the main window appears and a default dock icon in  
the Dock.
If i close the window, the dock icon still stays. But if i click on  
the dock

icon then also the main window is visible.
The only way i can see the main window is by quitting the app and  
launching

it again. Is there any way in which upon clicking on the dock,
the application window becomes visible.

Thanks
Arun KA


I don't actually have an answer, but it sounds like the  
applicationShouldTerminateAfterLastWindowClosed: delegate method might  
be right for you. Although I am just guessing here.


http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSObject/ 
applicationShouldTerminateAfterLastWindowClosed:

___

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

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


Fwd: Text Not Anti-Aliased In NSView

2008-12-09 Thread Chunk 1978
-- Forwarded message --
From: Chunk 1978 [EMAIL PROTECTED]
Date: Tue, Dec 9, 2008 at 12:34 PM
Subject: Re: Text Not Anti-Aliased In NSView
To: Nick Zitzmann [EMAIL PROTECTED]


i studied apple's Basic Cocoa Animations example found here:
http://developer.apple.com/samplecode/BasicCocoaAnimations/index.html

in apple's example the text is also aliased (check out the Medium
view)... so i'm wondering if fixing aliased text with this method is
just something they didn't touch upon in the example, or if there is
really no fix.

On Tue, Dec 9, 2008 at 11:25 AM, Nick Zitzmann [EMAIL PROTECTED] wrote:

 On Dec 9, 2008, at 9:21 AM, Chunk 1978 wrote:

 this link (
 http://att.macrumors.com/attachment.php?attachmentid=147663d=1228770137
 ) will show you an image displaying this problem.  the window on the
 left is from
 within Interface Builder (anti-aliased text), the window on the right
 is the running build (text with aliasing).  how can i solve this
 problem?


 Are you sure you're placing the rect in an integral frame, and drawing the
 text in integral bounds?

 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]


Accessing NSKeyedArchiver's archivedDataWithRootObject by name

2008-12-09 Thread Jim Turner
I have a situation where I'm archiving an array of objects via
NSKeyedArchiver's archivedDataWithRootObject: and later needing to set
a delegate on the NSKeyedUnarchiver that decodes it.  The
documentation is a bit unclear on how one starts the unarchive process
when a NSKeyedUnarchiver is created on an archive where you don't
know, for certain, the keys it contains.

So my question... is this legitimate?

NSKeyedUnarchiver *_keyedUnarchiver = [[[NSKeyedUnarchiver alloc]
initForReadingWithData:archivedData] autorelease];
[_keyedUnarchiver setDelegate:self];
NSMutableArray *archivedArray = [_keyedUnarchiver decodeObjectForKey:@root];
[_keyedUnarchiver finishDecoding];

It works, but I always question things when I hard-code a string for
something.  Will 'root' always be the key that represents the root
object?

If I could do something like [NSKeyedUnarchiver
unarchiveObjectWithData:delegate:], that would be better than perfect.

-- 
Jim
http://nukethemfromorbit.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: performance problem with IORegistryEntryCreateCFProperties

2008-12-09 Thread Raleigh Ledet
I totally agree with Herb here. If matching on a specific serial  
number is not feasible, at the very least, match on the  
IOHIDDevicesKey. As opposed to polling, you will be informed with the  
HID topology changes.


One very important note though. I would avoid calling  
IORegistryEntryCreateCFProperties() unless you are the creator of the  
device. IORegistryEntryCreateCFProperties() can be expensive,  
especially if all you want is the serial number. Use  
IORegistryEntryCreateCFProperty() to just get the serial number.


Why is IORegistryEntryCreateCFProperties() so bad?... well it causes  
the entire HID descriptor to be parsed, and there are some devices  
(certain keyboards) that have cause the parsing to expand into  
hundreds of elements. If seen this effectively stall the machine.  
Thus, making multiple calls to IORegistryEntryCreateCFProperty() to  
get a handful of properties is much better than creating the full  
dictionary.


-raleigh

On 09 Dec,2008, at 9:01 AM, Herb Petschauer wrote:


Out of curiosity, why spawn a second thread to poll when you can use
IOServiceAddMatchingNotification() [and friends, search in
/Developer/Examples] to get you notifications of devices appearing and
disappearing?  That is going to faster than walking the entire
IORegistry every time to find the matches which is effectively what
IOServiceGetMatchingServices() is going to be doing [do an ioreg -l
in  Terminal window to get the full list]

Cheers,
-H.

2008/12/8 Brad Justice [EMAIL PROTECTED]:
My application spawns a POSIX background thread that polls for  
certain
hardware changes. I have found that according to Activity Monitor  
and BigTop

it is consuming about 5% of the CPU, which seems inexplicable to me.

The thread loop calls sleep(2) and then begins its checks. Setting  
Activity
Monitor granularity to 0.5 seconds, I find that every 4 periods the  
thread
consumes 20% of the CPU, and 0 % for the other three. By commenting  
out
sections of code, I have isolated the CPU usage to one loop that  
executes 7
times. I have confirmed the number of iterations by single stepping  
in the

debugger.In particular, the execution of seven paired calls to
IORegistryEntryCreateCFProperties and CFRelease result in 5% CPU  
usage on my

MacBook Pro according to my tools.

Am I misinterpreting my tools, is this an Activity Monitor bug, or  
are
IORegistryEntryCreateCFProperties and CFRelease heavily CPU  
intensive for

some reason? It seems to me seven calls every two seconds should not
register activity at this level.

Thanks for any advice that you can provide. Source for the  
offending loop

below.

 classToMatch = IOServiceMatching (kIOHIDDeviceKey);
 if (classToMatch)
 { numberRef = NULL; mach_port_t  
mport =

[myList getMasterport];
 result =
IOServiceGetMatchingServices(mport,classToMatch,iterator);
 if (KERN_SUCCESS == result) {
 if(iterator)
 {
 while( ( serviceObject = IOIteratorNext  
( iterator ) ) )

 {
 CFMutableDictionaryRef hidProperties = 0;
 result = IORegistryEntryCreateCFProperties
(serviceObject, hidProperties, kCFAllocatorDefault, kNilOptions);
 if (result == KERN_SUCCESS)
 {
 serialNumberValue = (NSString *)
CFDictionaryGetValue(hidProperties,CFSTR(SerialNumber));
 if (serialNumberValue != NULL)
 {
 range = [serialNumberValue
rangeOfString:matchingString];
 if (range.length != 0)
 {
 count++;
 }
 }
 }
 CFRelease(hidProperties);
 }
 IOObjectRelease(iterator);
 } } }
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bogvardi%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/ledet%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 

Quote in path name

2008-12-09 Thread David Blanton

The following returns a nil image with a path of lg002025-Santa.tif

NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
bool ok = [image isValid];

but returns a valid image if the path is lg002025-Santa.tif

so how can the finder allow  in the name but NSImage burps on 

?


David Blanton




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 launch window of the application on clicking of dock icon?

2008-12-09 Thread Raleigh Ledet

This depends on your application.

A document based application will automatically create a new untitled  
document for you. Which is generally what you want. If you app is  
really document based, its best to use the document based project  
template.


If you app is not document based (say Mail or System preferences) then  
you have to consider what the expected / correct behavior is. Mail  
stays active when you close all of it's windows (checking email in the  
background). For this behavior use -applicationDidBecomeActive: to  
check if any widows are shown. If not, then show the expected window.


For some (rare) apps on OS X, staying open is not expected / wanted.  
For example, System Preferences quits when you close its one and only  
window. This can be done via - 
applicationShouldTerminateAfterLastWindowClosed.


If this is just a test app, you might want to try them all to get a  
feel for it. But for a real app, consider very carefully which  
behavior you want.


-raleigh

On 09 Dec,2008, at 9:02 AM, Arun wrote:


Hi,

I have created a simple application in cocoa.
when it is ran, the main window appears and a default dock icon in  
the Dock.
If i close the window, the dock icon still stays. But if i click on  
the dock

icon then also the main window is visible.
The only way i can see the main window is by quitting the app and  
launching

it again. Is there any way in which upon clicking on the dock,
the application window becomes visible.

Thanks
Arun KA
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/ledet%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: NSNumberFormatter strange symbols on PPC/10.4

2008-12-09 Thread Stéphane BARON
I did encounter the same problem (developing on 10.5 and testing on  
10.4)


It seem's to be a know bug in NSNumberFormatter

I solved it by subclassing NSNumberFormatter like this:

#import MCNumberFormatter.h


@implementation MCNumberFormatter
- (NSString *)stringForObjectValue:(id)anObject
{
NSLog(@stringforobject anobject: %@ ,anObject);
if([anObject isEqualTo:[NSDecimalNumber zero]])
return @;
else
return [super stringForObjectValue:anObject];
}

- (BOOL)getObjectValue:(id *)anObject forString:(NSString *)string  
errorDescription:(NSString **)error

{
NSLog(@getObjectValueforString: %@ aString,string);
	return [super getObjectValue:anObject forString:string  
errorDescription:error];

}

@end



and used this class like this:

MCNumberFormatter *totalFormatter = [[MCNumberFormatter alloc] init];
[totalFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
[totalFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
[totalFormatter setLocalizesFormat:YES];
[totalFormatter setMinimumFractionDigits:2];
[totalFormatter setMaximumFractionDigits:2];

Hopes it help

Stéphane

Le 8 déc. 08 à 20:53, Andy Bettis a écrit :


Hi,

In my app I have an NSTableView in the main window, within this  
there's a column with an NSNumberFormatter attached. The formatter  
is set to 10.4 behaviour and currency style. On my development  
machine all looks OK, however the customer's machine shows the  
numbers as a currency symbol (£, I'm in the UK) then a series of  
symbols replacing the numbers. Most numbers show as a white, rounded  
cornered square with a sort of T character inside, zeroes show as a  
black, rounded cornered square with a crossed zero inside, some  
others show as a double apostrophe in the white square. Decimal  
points show OK.


When printed the numbers are replaced with punctuation characters,  
not the symbols shown on the screen.


I'm developing on an Intel Mac Mini running 10.5.5. I've tried a few  
older machines which all show the weird characters, they are mostly  
running 10.4.11 and using PPC processors so I don't know if this is  
a PPC or Tiger problem.


I have a few projects lined up that will probably run on Tiger  
systems so I'd like to know if this is easily fixable or whether I  
need to write my own cash formatting routine.


Ta.

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/cocoa%40olitrans.fr

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: Quote in path name

2008-12-09 Thread Charles Steinman
It works for me. How is the string for path getting created?

Cheers,
Chuck


- Original Message 
 From: David Blanton [EMAIL PROTECTED]
 To: Cocoa-dev List cocoa-dev@lists.apple.com
 Sent: Tuesday, December 9, 2008 10:32:19 AM
 Subject: Quote in path name
 
 The following returns a nil image with a path of lg002025-Santa.tif
 
 NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
 bool ok = [image isValid];
 
 but returns a valid image if the path is lg002025-Santa.tif
 
 so how can the finder allow  in the name but NSImage burps on 
 
 ?
 
 
 David Blanton
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/acharlieblue%40yahoo.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]


NSArrayController with a base class

2008-12-09 Thread Todd Heberlein

Hi all,

I'm looking for documentation/tutorial/pointers on how to handle the  
situation when an NSArrayController is managing an NSMutableArray  
which will contain multiple types of objects but all of which have the  
same base class. So the NSArrayController's Object Controller Class  
Name is actually a base class.


Then when a user selects an item in the list, depending on the  
subclass type a different view will be displayed, each with different  
fields that will be views for the data in the subclass instance.


Is this possible with controllers? Is it recommended/discouraged? Any  
pointers?


Thanks,

Todd

___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTextField in a sheet and focus

2008-12-09 Thread Mike Chambers
I have a sheet which contains an NSTextField. I need to allow users to
enter line returns in the textfield, so I have implemented the
functionality according to this apple note:

http://developer.apple.com/qa/qa2006/qa1454.html

This works great. However, if the user clicks out of the text field
(onto the sheet, or another control), the textfield does not loose
focus. The only way that it will loose focus is if another textfield
is selected in the sheet.

The problem is that, if the user gives the textfield focus, then they
can no longer hit the return key to submit / accept the sheet (return
is set as the sheets OK button key equivalent).

Has anyone run into this before? If the textfield would loose focus
when the user clicks out of it, I would not have a problem. I looked
at NSTextView, but it also has the same focus issues.

Anyone have any thoughts on possible solutions?

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: Development workflows for signed code?

2008-12-09 Thread Jack Repenning

On Dec 9, 2008, at 6:36 AM, Chris Suter wrote:


By the way, you should post code signing questions to the apple-cdsa
list rather than the Cocoa list as you'll get a better response there.


Thanks for that. I did look for a more focused list, but I guess that  
acronym didn't catch my eye.




-==-
Jack Repenning
[EMAIL PROTECTED]
Project Owner
SCPlugin
http://scplugin.tigris.org
Subversion for the rest of OS X


___

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

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


NSTextField + Drag'n'Drop

2008-12-09 Thread Jean-Nicolas Jolivet
I'm trying to subclass NSTextField so that it accepts dragged  
directory from the Finder... (I know it already does, but I need to  
modify the behavior slightly)...


Instead of inserting the dragged file's path in the current text of  
the text field, I need to replace the whole textfield's text with the  
newly dragged file's path... also, I need to accept directory only,  
dragged files will not be accepted...


Normally I wouldn't have any problems doing it with a custom NSView,  
however, since NSTextField already has a default drag and drop  
behavior, are there any special considerations? Also, are those  
default drag/drop behaviors implemented in NSTextField or higher up  
the class hierarchy? (i.e. NSResponder or NSControl etc..)... which  
methods should I override (i.e.  is it only draggingEntered: and  
performDragOpeation:, as I am doing with my custom NSViews?)


Any information would be appreciated!

Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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: Text Not Anti-Aliased In NSView

2008-12-09 Thread Peter Ammon


On Dec 9, 2008, at 8:21 AM, Chunk 1978 wrote:


i have several views that are added and replaced by a main window
using core animation... i've noticed that the text (label objects,
checkbox text, etc.) in each view is not being anti-aliased.

this link ( 
http://att.macrumors.com/attachment.php?attachmentid=147663d=1228770137
) will show you an image displaying this problem.  the window on the
left is from
within Interface Builder (anti-aliased text), the window on the right
is the running build (text with aliasing).  how can i solve this
problem?  it's kinda surprising that it's not anti-aliasing the text
automatically.  hopefully there's some option i'm just forgetting to
check off.


Assuming your text is always going to be drawn on top the window, the  
simple fix is to check the Draws Background property of your text  
field in IB, and then choose the windowBackgroundColor from the  
Developer palette in the color picker.


What's going on is this: the text is (normally) antialiased, but what  
is not active is subpixel antialiasing, which is what Quartz calls  
font smoothing.  The problem is that subpixel antialiasing requires  
that the text know the background color that it is drawing onto at the  
time it is drawn.  But CoreAnimation renders everything into separate  
layers, and then composites them all together.


-Peter


___

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

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

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

This email sent to [EMAIL PROTECTED]


Multithreading and Mach ports

2008-12-09 Thread John Love

Reference:

http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/chapter_6_section_5.html#/ 
/apple_ref/doc/uid/1057i-CH16-SW7


I've got several questions since I'm just starting to investigate Mach  
Ports.


1) Why is +LaunchThreadWithPort: so designated, ie, a class method.   
It seems to me that as far as the specific code listings presented, a  
class method is not required?  For example, [workerObj  
sendCheckinMessage:distantPort] could be replaced with [self  
sendCheckinMessage:distantPort] if LaunchThreadWithPort would be  
changed to an instance method.


2) Maybe the real question #1 is:  What exactly is the object in the  
background thread, named workerObj ??


3) I've saved my most general question to last, at least for this  
trip:  currently when I enter my method to start up my background  
thread or threads, I simply call (several times if I have multiple  
threads:


[NSThread detachNewThreadSelector:@selector(bgCalcThread:)  
toTarget:self withObject:nil]


If I have multiple background threads, I can use a NSMutableDictionary  
with multiple keys for inter-thread communication


So, what do Mach Ports give me that the above doesn't?


John Love
Touch the Future! Teach!



___

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

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

2008-12-09 Thread Charles Steinman
Can you not recreate the bug in testing or identify the code where the possibly 
faulty path variable is created?

Cheers,
Chuck


- Original Message 
 From: David Blanton [EMAIL PROTECTED]
 To: Charles Steinman [EMAIL PROTECTED]
 Sent: Tuesday, December 9, 2008 11:50:26 AM
 Subject: Re: Quote in path name
 
 I don't know, a user of the app is creating the path name.  This came  
 in to me as a bug from the user.
 On Dec 9, 2008, at 12:23 PM, Charles Steinman wrote:
 
  It works for me. How is the string for path getting created?
 
  Cheers,
  Chuck
 
 
  - Original Message 
  From: David Blanton 
  To: Cocoa-dev List 
  Sent: Tuesday, December 9, 2008 10:32:19 AM
  Subject: Quote in path name
 
  The following returns a nil image with a path of lg002025-Santa.tif
 
  NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
  bool ok = [image isValid];
 
  but returns a valid image if the path is lg002025-Santa.tif
 
  so how can the finder allow  in the name but NSImage burps on 
 
  ?
 
 
  David Blanton
 
 
 
 
  ___
 
  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
  Please do not post admin requests or moderator comments to the list.
  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
  Help/Unsubscribe/Update your Subscription:
  http://lists.apple.com/mailman/options/cocoa-dev/acharlieblue% 
  40yahoo.com
 
  This email sent to [EMAIL PROTECTED]
 
 
 
 
 
 
 
 David Blanton



  
___

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

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

2008-12-09 Thread Jean-Daniel Dupas


Le 9 déc. 08 à 21:36, John Love a écrit :


Reference:

http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/chapter_6_section_5.html#/ 
/apple_ref/doc/uid/1057i-CH16-SW7


I've got several questions since I'm just starting to investigate  
Mach Ports.


1) Why is +LaunchThreadWithPort: so designated, ie, a class method.   
It seems to me that as far as the specific code listings presented,  
a class method is not required?  For example, [workerObj  
sendCheckinMessage:distantPort] could be replaced with [self  
sendCheckinMessage:distantPort] if LaunchThreadWithPort would be  
changed to an instance method.


2) Maybe the real question #1 is:  What exactly is the object in the  
background thread, named workerObj ??


An arbitrary object that perform some long works that should be  
execute in a background thread. Worker is a very common term in  
multithreading programming.




3) I've saved my most general question to last, at least for this  
trip:  currently when I enter my method to start up my background  
thread or threads, I simply call (several times if I have multiple  
threads:


[NSThread detachNewThreadSelector:@selector(bgCalcThread:)  
toTarget:self withObject:nil]


If I have multiple background threads, I can use a  
NSMutableDictionary with multiple keys for inter-thread communication




I think I miss something in the NSDictionary reference. I though it  
was not thread safe, and I never saw any reference to synchronisation  
or communication methods. What do you mean by using dictionary for  
inter thread communication ?



So, what do Mach Ports give me that the above doesn't?


A channel to send arbitrary message to another thread (of course, it  
can also be done using performOnThread methods).



___

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

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


Setting company checkbox programatically in an AddressBook

2008-12-09 Thread development2
I am having a problem setting the Checkbox to show the address book  
item is for a company. It seems to crash settig the value. What am I  
doing wrong?


// we need to create this address item
addressItem = [[[ABPerson alloc] init] autorelease];
[addressItem setValue:NSLocalizedString(@ADDRESS_ITEM_NAME, 
nil)
  forProperty:kABOrganizationProperty];

ABMutableMultiValue* emailList = [[ABMutableMultiValue alloc] 
init];
[emailList insertValue:NSLocalizedString(@OTHER_EMAIL_VALUE, 
nil)
 
withLabel:NSLocalizedString(@OTHER_EMAIL_NAME, nil)
 atIndex:0];
[addressItem setValue:emailList
  forProperty:kABEmailProperty];

		int personFlags = [[addressItem valueForProperty:kABPersonFlags]  
intValue];

personFlags = (kABShowAsMask  kABShowAsCompany);

[addressItem removeValueForProperty:kABPersonFlags];
		[addressItem setValue:[[NSNumber numberWithInt:personFlags]  
stringValue]   Crashes HERE

  forProperty:kABPersonFlags];

[[ABAddressBook sharedAddressBook] addRecord:addressItem];
[[ABAddressBook sharedAddressBook] save];


If I take this line out everythign works fine I don't get it this  
should be so simple...


Thanks for any help in advance.


___

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

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


Creating a window when pressing a button

2008-12-09 Thread Jushin
In my application, I have to open a form window when a user press a button.
It is somewhat similar to Apple Mail. In Apple Mail, if you click New
Message button from the toolbar, a New Message window is appeared.

For now, what I did was something like this:
In IB, I added a window (or a panel), and the associated button shows
the window by using makeKeyAndOrderFront method when pressed.
However, I realized it is not what I want.
In this case, a window is already created, and the button only shows
or hides the window.
What I want is really creating a window when a user presses the
button, so that the user can creates multiple windows by pressing the
button.
I wonder how can I do this.
The window will contain form fields to get values for Core Data models.

Thanks,
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Setting company checkbox programatically in an AddressBook

2008-12-09 Thread Nick Zitzmann


On Dec 9, 2008, at 2:18 PM, development2 wrote:

		int personFlags = [[addressItem valueForProperty:kABPersonFlags]  
intValue];


That should be an NSInteger, not an int, and you should use - 
integerValue instead.



personFlags = (kABShowAsMask  kABShowAsCompany);


That should be one ampersand, not two.


[addressItem removeValueForProperty:kABPersonFlags];
		[addressItem setValue:[[NSNumber numberWithInt:personFlags]  
stringValue]   Crashes HERE

  forProperty:kABPersonFlags];



Why are you setting a string in that property? Remove the -stringValue  
and change the +numberWithInt: to +numberWithInteger: and it ought to  
work.


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: Setting company checkbox programatically in an AddressBook

2008-12-09 Thread development2


On Dec 9, 2008, at 2:31 PM, Nick Zitzmann wrote:



On Dec 9, 2008, at 2:18 PM, development2 wrote:

		int personFlags = [[addressItem valueForProperty:kABPersonFlags]  
intValue];


That should be an NSInteger, not an int, and you should use - 
integerValue instead.


Yeah thanks, saw that in the docs but forgot about it.






personFlags = (kABShowAsMask  kABShowAsCompany);


That should be one ampersand, not two.


Yeah I had changed that right after I sent the email out when I saw it  
was wrong.






[addressItem removeValueForProperty:kABPersonFlags];
		[addressItem setValue:[[NSNumber numberWithInt:personFlags]  
stringValue]   Crashes HERE

  forProperty:kABPersonFlags];



Why are you setting a string in that property? Remove the - 
stringValue and change the +numberWithInt: to +numberWithInteger:  
and it ought to work.


Well I was under the impression that all the property values you get  
back form valueForProperty where strings. I stand corrected. It works  
great now.


Thanks much.



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]


Cocoaheads Lake Forest (92630) meeting 11/12/2008 at 7 pm on Using and optimizing Core Data in a commercial application

2008-12-09 Thread Scott Ellsworth
Hello, all,

CocoaHeads Lake Forest will be meeting on the second Wednesday in
December, 12/10, from 7 to 9 PM.  We will meet in our usual location
at the Orange County Public Library (El Toro) community room, 24672
Raymond Way, Lake Forest, CA 92630.

Peter Hosey, one of the developers of the instant-messaging client
Adium, will show us the reasons and steps to add unit tests to Cocoa
applications.

I would again like to extend my own personal thanks as well as the
groups for the guest speakers we have been having.  It is greatly
appreciated

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

As always, details can be found on the cocoaheads web site at
www.cocoaheads.org.

Thanks go to O'Reilly Media for providing us one of their books as a
door prize.  They have also provided us a user group discount, and are
willing to send review copies of their books.

Note: if you receive this directly from me, and no longer wish to,
please reply offlist, and I will pull you from future mailings.
___

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

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


Correction: Cocoaheads Lake Forest (92630) meeting 12/10/2008 at 7 pm on Adding Unit Tests to a Cocoa Application

2008-12-09 Thread Scott Ellsworth
Please note corrected subject.

Hello, all,

CocoaHeads Lake Forest will be meeting on the second Wednesday in
December, 12/10, from 7 to 9 PM.  We will meet in our usual location
at the Orange County Public Library (El Toro) community room, 24672
Raymond Way, Lake Forest, CA 92630.

Peter Hosey, one of the developers of the instant-messaging client
Adium, will show us the reasons and steps to add unit tests to Cocoa
applications.

I would again like to extend my own personal thanks as well as the
groups for the guest speakers we have been having.  It is greatly
appreciated

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

As always, details can be found on the cocoaheads web site at
www.cocoaheads.org.

Thanks go to O'Reilly Media for providing us one of their books as a
door prize.  They have also provided us a user group discount, and are
willing to send review copies of their books.

Note: if you receive this directly from me, and no longer wish
___

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

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


NSUserDefaults and valueForKeyPath ?

2008-12-09 Thread Arthur C.
I've been busy adding some structure to the NSUserDefaults in my app. So I
would have a dictionary like 'generalPrefs' with some key/value pairs,
separate from 'otherPrefs' etc.

Now I wonder why the following doesn't work:

[[NSUserDefaultsController sharedUserDefaultsController] valueForKeyPath:
@values.generalPrefs.numberOfPoints]

while this does work:

[[NSUserDefaultsController sharedUserDefaultsController] valueForKeyPath:
@values.generalPrefs],

after which generalPrefs can be referenced.

Am I missing some elementary KVC or is there something special about the
user defaults?


Thanks for your time,
Arthur

___

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

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


How to detect a paste request for file copy/paste?

2008-12-09 Thread Ling Li
I want to implement a delayed file paste feature for file copy/paste. When I 
first put file lists into the clipboard, the files are actually not existing 
yet (in another unmapped network place). These files will only be created after 
got the paste request. So my question is how to detect the paste request? I 
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: Accessing NSKeyedArchiver's archivedDataWithRootObject by name

2008-12-09 Thread Michael Ash
On Tue, Dec 9, 2008 at 1:17 PM, Jim Turner [EMAIL PROTECTED] wrote:
 I have a situation where I'm archiving an array of objects via
 NSKeyedArchiver's archivedDataWithRootObject: and later needing to set
 a delegate on the NSKeyedUnarchiver that decodes it.  The
 documentation is a bit unclear on how one starts the unarchive process
 when a NSKeyedUnarchiver is created on an archive where you don't
 know, for certain, the keys it contains.

 So my question... is this legitimate?

 NSKeyedUnarchiver *_keyedUnarchiver = [[[NSKeyedUnarchiver alloc]
 initForReadingWithData:archivedData] autorelease];
 [_keyedUnarchiver setDelegate:self];
 NSMutableArray *archivedArray = [_keyedUnarchiver decodeObjectForKey:@root];
 [_keyedUnarchiver finishDecoding];

 It works, but I always question things when I hard-code a string for
 something.  Will 'root' always be the key that represents the root
 object?

 If I could do something like [NSKeyedUnarchiver
 unarchiveObjectWithData:delegate:], that would be better than perfect.

This is an interesting question. NSArchiver describes exactly how the
root object stuff works in terms of the rest, but NSKeyedArchiver
doesn't. I would file a bug, at least to get it documented.

However, one of the painful and pleasurable thing about stuff like
NSCoder is that it essentially has to remain forward and backward
compatible for eternity. An NSKeyedArchiver running on 10.7 must
produce an archive which can be read on 10.2. This sort of thing
presumably couldn't be changed without breaking 10.2 or some other
past OS, so uncomfortable as it may be, if it works today it ought to
keep working forever.

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: Quote in path name

2008-12-09 Thread David Blanton
Ok, my problem! We have some C++ code that preprocess our paths (for  
our reasons) and it was REMOVING the  , duh, sorry!


But I did learn something.  Some names come in with some UTF8  
encoding and those were a problem until I realized  
stringWithUTF8Encoding.


On Dec 9, 2008, at 1:45 PM, Charles Steinman wrote:

Can you not recreate the bug in testing or identify the code where  
the possibly faulty path variable is created?


Cheers,
Chuck


- Original Message 

From: David Blanton [EMAIL PROTECTED]
To: Charles Steinman [EMAIL PROTECTED]
Sent: Tuesday, December 9, 2008 11:50:26 AM
Subject: Re: Quote in path name

I don't know, a user of the app is creating the path name.  This came
in to me as a bug from the user.
On Dec 9, 2008, at 12:23 PM, Charles Steinman wrote:


It works for me. How is the string for path getting created?

Cheers,
Chuck


- Original Message 

From: David Blanton
To: Cocoa-dev List
Sent: Tuesday, December 9, 2008 10:32:19 AM
Subject: Quote in path name

The following returns a nil image with a path of  
lg002025-Santa.tif


NSImage *image = [[NSImage alloc] initWithContentsOfFile:path];
bool ok = [image isValid];

but returns a valid image if the path is lg002025-Santa.tif

so how can the finder allow  in the name but NSImage burps on 

?


David Blanton




___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]









David Blanton









David Blanton




___

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

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

2008-12-09 Thread I. Savant



Even if it were slower, contorting the code like this without
having profiled the code and demonstrated that this is in fact a
significant slowdown is bad practice.


  I disagree. Certainly it's profile first, but to have a view that  
reads a simple property from user defaults every time it draws  
requires more overhead than using an instance variable. Especially  
when you're using an NSColor object which must be properly archived  
and unarchived.


  Imagine adding complexity to this view and using multiple values  
like this per draw cycle, and having to draw a whole bunch of stuff.  
Directly reading colors from user defaults is suddenly a whole lot  
more expensive.


  It doesn't matter much for the simple case the OP presented, but it  
certainly does for a custom view that does heavy drawing, especially  
if it's involved in an animation.


--
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: Another NSOutlineView question

2008-12-09 Thread Graham Cox


On 10 Dec 2008, at 3:34 am, Corbin Dunn wrote:


Le Dec 9, 2008 à 12:40 AM, Volker in Lists a écrit :


Hi,

you should be able to detect a double click and call a method then  
that either temporarily allows the selection or directly starts the  
edit mode. I do have a similar setup - don't do editing, but I use  
the double click action via bindings to attach notes to such an  
unselectable item.




This approach may work, but it will give some undesired UI; this app  
would the only be editable on double clicking, while other apps edit  
on single-click (ala Leopard NSTableView and Finder).


You want to use this delegate method:

/*  Optional - Custom tracking support
   It is possible to control the ability to track a cell or not.  
Normally, only selectable or selected cells can be tracked. If you  
implement this method, cells which are not selectable or selected  
can be tracked, and vice-versa. For instance, this allows you to  
have an NSButtonCell in a table which does not change the selection,  
but can still be clicked on and tracked.

*/
- (BOOL)tableView:(NSTableView *)tableView shouldTrackCell:(NSCell  
*)cell forTableColumn:(NSTableColumn *)tableColumn row: 
(NSInteger)row AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;



Return YES for your cell, and it should be trackable, and hence  
editable...


corbin




Hth,
volker

Am 09.12.2008 um 06:55 schrieb Graham Cox:

In my NSOutlineView, I disallow selection of group items by  
implementing the delegate method -outlineView:shouldSelectItem:,  
which works fine, but I still want to be able to edit the titles  
of group items. The above method prevents this also.


How can I prevent selection of the the item but still allow  
editing of its title string?



tia,




OK, I added that method (in its outlineView version) to my delegate  
and I'm simply returning YES always. I have verified that the method  
is being called when I click on the view.


Unfortunately, it's not doing anything useful for me - it always  
changes the selection to the row I click before flipping checkbox  
states for example, and I am still unable to edit the name of a group  
item (which is being prevented from being selected as desired by the - 
outlineView:shouldSelectItem: delegate method).


Any idea why this wouldn't work as advertised? These are the only two  
delegate methods I'm implementing other than watching for selection  
changes and item expansion notifications.



Code:

- (BOOL)outlineView:(NSOutlineView*) outlineView shouldSelectItem: 
(id) item

{
#pragma unused(outlineView)

return [item layerMayBecomeActive];
}


- (BOOL)outlineView:(NSOutlineView*) oView shouldTrackCell: 
(NSCell*) cell forTableColumn:(NSTableColumn*) tableColumn item:(id)  
item

{
#pragma unused(oView,cell,tableColumn,item)

NSLog(@will track cell: %@, cell ); // this does log on each click

return YES;
}



Another question - is there a way to prevent the outline view from  
making itself first responder when clicked unless absolutely  
necessary, but without subclassing to override -acceptsFirstResponder?


thanks,

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]


problems debugging cocoa app w/ gdb

2008-12-09 Thread kvic...@pobox.com
for sometime now (i don't remember when this started, possibly w/ 
leopard or 10.5.5 or the previous dev tools update), i've been 
getting a number of lines like the following on the debugger console 
when hitting breakpoints:


warning: Trying to look up NSString in 'this' but 'this' is not an aggregate
warning: Trying to look up description in 'this' but 'this' is not 
an aggregate

warning: Trying to look up void in 'this' but 'this' is not an aggregate
warning: Trying to look up _pbxgdb_objc_dynamic_type in 'this' but 
'this' is not an aggregate
warning: Trying to look up _pbxgdb_objc_compute_super_class_list in 
'this' but 'this' is not an aggregate
warning: Trying to look up _pbxgdb_cf_introspect_string in 'this' 
but 'this' is not an aggregate


additionally, the variables pane of the debugger window (the top 
right pane) will show

incomplete type
as the value of many of my variables, usually scaler type (e.g., int, 
BOOL) or variables declared as: id.


i've been working around this via assorted NSLog statements, but its 
getting really old. a clean build did not make the problem go away.


i'm using 10.5.5 and objective-c++ and the latest release xcode tools.

can anyone suggest how to fix this?

thanx,
ken
___

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

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

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

This email sent to [EMAIL PROTECTED]


commitEditing and unrecognized selector

2008-12-09 Thread Chris Idou
I've got a modal dialog with a couple of NSTextFields. Changes weren't getting 
saved, so I thought I'd better call commitEditing on the text field before 
retrieving its value with stringValue.

But when I call commitEditing on the NSTextField it gives the error: 
-[NSTextField commitEditing]: unrecognized selector sent to instance 

But there are no warnings from the compiler that commitEditing is an invalid 
method.

What am I doing wrong?





  Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now 
http://au.docs.yahoo.com/homepageset/?p1=otherp2=aup3=tagline
___

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

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

2008-12-09 Thread Graham Cox


On 10 Dec 2008, at 10:53 am, Chris Idou wrote:

I've got a modal dialog with a couple of NSTextFields. Changes  
weren't getting saved, so I thought I'd better call commitEditing on  
the text field before retrieving its value with stringValue.


But when I call commitEditing on the NSTextField it gives the error:  
-[NSTextField commitEditing]: unrecognized selector sent to instance


But there are no warnings from the compiler that commitEditing is an  
invalid method.


What am I doing wrong?



Call -validateEditing instead, that should do what you want.

You don't get a warning because -commitEditing is implemented as a  
category on NSObject, which means that NSTextField does effectively  
implement it. It's just that -commitEditing is not the same as - 
validateEditing.


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: Another NSOutlineView question

2008-12-09 Thread Corbin Dunn


Le Dec 9, 2008 à 3:36 PM, Graham Cox a écrit :



On 10 Dec 2008, at 3:34 am, Corbin Dunn wrote:


Le Dec 9, 2008 à 12:40 AM, Volker in Lists a écrit :


Hi,

you should be able to detect a double click and call a method then  
that either temporarily allows the selection or directly starts  
the edit mode. I do have a similar setup - don't do editing, but I  
use the double click action via bindings to attach notes to such  
an unselectable item.




This approach may work, but it will give some undesired UI; this  
app would the only be editable on double clicking, while other apps  
edit on single-click (ala Leopard NSTableView and Finder).


You want to use this delegate method:

/*  Optional - Custom tracking support
  It is possible to control the ability to track a cell or not.  
Normally, only selectable or selected cells can be tracked. If you  
implement this method, cells which are not selectable or selected  
can be tracked, and vice-versa. For instance, this allows you to  
have an NSButtonCell in a table which does not change the  
selection, but can still be clicked on and tracked.

*/
- (BOOL)tableView:(NSTableView *)tableView shouldTrackCell:(NSCell  
*)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger) 
row AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;



Return YES for your cell, and it should be trackable, and hence  
editable...


corbin




Hth,
volker

Am 09.12.2008 um 06:55 schrieb Graham Cox:

In my NSOutlineView, I disallow selection of group items by  
implementing the delegate method -outlineView:shouldSelectItem:,  
which works fine, but I still want to be able to edit the titles  
of group items. The above method prevents this also.


How can I prevent selection of the the item but still allow  
editing of its title string?



tia,




OK, I added that method (in its outlineView version) to my delegate  
and I'm simply returning YES always. I have verified that the method  
is being called when I click on the view.


Unfortunately, it's not doing anything useful for me - it always  
changes the selection to the row I click before flipping checkbox  
states for example, and I am still unable to edit the name of a  
group item (which is being prevented from being selected as desired  
by the -outlineView:shouldSelectItem: delegate method).


Any idea why this wouldn't work as advertised? These are the only  
two delegate methods I'm implementing other than watching for  
selection changes and item expansion notifications.




Actually, I think the row does have to be selected to allow it to be  
edited. Is there a reason you can't let it be selected at this point?


In other words, what are you trying to do? I may be able to offer  
another solution.




Code:

- (BOOL)outlineView:(NSOutlineView*) outlineView  
shouldSelectItem:(id) item

{
#pragma unused(outlineView)

return [item layerMayBecomeActive];
}


- (BOOL)outlineView:(NSOutlineView*) oView shouldTrackCell: 
(NSCell*) cell forTableColumn:(NSTableColumn*) tableColumn item:(id)  
item

{
#pragma unused(oView,cell,tableColumn,item)

NSLog(@will track cell: %@, cell ); // this does log on each click

return YES;
}



Another question - is there a way to prevent the outline view from  
making itself first responder when clicked unless absolutely  
necessary, but without subclassing to override -acceptsFirstResponder?


No; feel free to log a bug request asking for API to easily do this.  
You want it to become first responder only in certain situations, like  
editing? Something sort of like Mail's sidebar source list? Or do you  
have something else in mind?


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: commitEditing and unrecognized selector

2008-12-09 Thread Sean McBride

On 2008-Dec-9, at 18:53, Chris Idou wrote:

I've got a modal dialog with a couple of NSTextFields. Changes  
weren't getting saved, so I thought I'd better call commitEditing on  
the text field before retrieving its value with stringValue.


But when I call commitEditing on the NSTextField it gives the error:  
-[NSTextField commitEditing]: unrecognized selector sent to instance


I had this same question a while ago:
http://www.cocoabuilder.com/archive/message/cocoa/2008/8/8/215145

My conclusion is that the NSEditor informal protocol docs are wrong.

Sean

___

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

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

2008-12-09 Thread Graham Cox


On 10 Dec 2008, at 11:02 am, Corbin Dunn wrote:





Actually, I think the row does have to be selected to allow it to be  
edited. Is there a reason you can't let it be selected at this point?


In other words, what are you trying to do? I may be able to offer  
another solution.



OK. The outline view represents a list of drawing layers. These can be  
organised hierarchically, hence the use of an outline view. The  
selected row is used to set the active layer, which is the one that  
user input is directed to. Layers and Layer groups have names, which  
the user can freely edit. However, Layer groups should not be selected  
because they can't be made active - that would be ambiguous because  
it implies that multiple layers could be the target of user input,  
thus, I prevent the group items from being selected.


I did also try the idea of using an active marker in a separate  
table column to indicate the active layer and that worked alright, but  
much less obvious and visible than using the selection highlight for  
this. It also added another column to the table which I'd prefer to  
keep to a minimum width so that the user has the largest available  
working space in the window. (The layers table and the content are  
side-by-side in a split view).


No; feel free to log a bug request asking for API to easily do this.  
You want it to become first responder only in certain situations,  
like editing? Something sort of like Mail's sidebar source list? Or  
do you have something else in mind?


Almost exactly like that. In fact I'm using the source list style of  
view. I don't want it to steal focus from the main content view of the  
window unless it really needs it, like when editing, because it's a  
real nuisance for the user to have to keep refocusing the main content  
view when they just wanted to quickly activate a different layer.


Subclassing is OK - I'm currently doing that anyway to hack around the  
row selection change on a checkbox click (When testing the suggested  
code I wasn't subclassing, just using a plain NSOutlineView) but if I  
can get the behaviour I want without subclassing I would obviously  
prefer that.



thanks,

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]


Symbol not found error

2008-12-09 Thread Daniel Luis dos Santos

Hello,

I am getting this error  over and over again, whenever I do a new  
target in some place and then try to use it somewhere else.
I have a dynamic library in a project that is used in another project.  
Then I added another dynamic library to the first one which is also  
used by the second project.


The first lib links and the last won't link. The symbols are not  
found. From the gcc command line the -L option is the same because the  
dylib is in the same directory, a new -llibname flag is added for  
the new dylib (I dragged the lib file from the finder to the xcode  
tree).

When I do an nm on the lib file, the symbols are there.
I changed the install name to have the rpath, but is only relevant at  
run-time, right?


Can't find out why this happens
___

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

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

2008-12-09 Thread Brad Justice
First, I would like to thank all those who took the time to assist me 
with this issue.


I have begun implementing the suggestions I received with good results. 
Modifying the code to use IORegistryEntryCreateCFProperty() rather than 
IORegistryEntryCreateCFProperties() resulted in CPU usage dropping from 
around 5% to .25%. I am sure that implementing the other suggestions 
will result in additional improvements.


Why was the code implemented as it was? This is my first experience with 
OS X and I was mining working code. I took the approach that if it isn't 
broke don't fix it. But it was, so I will. Still, I am astonished as to 
the CPU overhead from calling  IORegistryEntryCreateCFProperties() 3.5 
times per second.


As an Apple newbie, I am pleasantly surprised by the high quality of 
advice available in the developer forums... and no trolls! Thanks again.


Brad
___

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

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

2008-12-09 Thread Ricky Sharp


On Dec 9, 2008, at 5:31 PM, I. Savant wrote:




Even if it were slower, contorting the code like this without
having profiled the code and demonstrated that this is in fact a
significant slowdown is bad practice.


 I disagree. Certainly it's profile first, but to have a view that  
reads a simple property from user defaults every time it draws  
requires more overhead than using an instance variable. Especially  
when you're using an NSColor object which must be properly archived  
and unarchived.


 Imagine adding complexity to this view and using multiple values  
like this per draw cycle, and having to draw a whole bunch of stuff.  
Directly reading colors from user defaults is suddenly a whole lot  
more expensive.


 It doesn't matter much for the simple case the OP presented, but it  
certainly does for a custom view that does heavy drawing, especially  
if it's involved in an animation.



Completely agree.  For all my custom views, I always create and cache  
various drawing objects.  These are often build-once objects.  I  
usually build them lazily as well.


e.g. I have an attribute named 'needsCreateColors'.  When drawRect is  
called, it checks that flag and calls 'createColors' if needed.


In some cases, other attributes, when set, will 'dirty' that flag  
followed by a setNeedsDisplay.  Colors will then be re-fetched/created  
and then reused until the next change comes along.


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


Custom NSTableView cells

2008-12-09 Thread Randall Meadows
I could use a little guidance, please, on customizing cells for  
display in an NSTableView.  (My app is Leopard-only.)  I looked around  
the Apple docs and cocoadev, but didn't really find anything useful.   
Other pointers would be appreciated.


My table has but one column, but each cell in that column is made up  
of 2 or more views.  I think I have what I need as far as the cells  
go, but it's feeding them to the table view that's giving me problems.


I know the required datasource methods are -numberOfRowsInTableView:  
and -tableView:objectValueForTableColumn:row:; the first is a no- 
brainer, the 2nd one stumps me.


I assume I must implement -tableView:dataCellForTableColumn:row: to  
feed the table my custom cells for each row, right?  What purpose then  
does the -tableView:objectValueForTableColumn:row: method serve?  What  
should be returned from that if I'm already feeding ready-made cells  
from the other one?  (This table is not editable, so I do not need to  
worry about -tableView:setObjectValue)



The docs also say that my cells must properly implement - 
copyWithZone:, but I don't know what properly means in that context.


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: How Can I Notify DrawRect Method?

2008-12-09 Thread I. Savant

On Dec 9, 2008, at 8:09 PM, Ricky Sharp wrote:

In some cases, other attributes, when set, will 'dirty' that flag  
followed by a setNeedsDisplay.  Colors will then be re-fetched/ 
created and then reused until the next change comes along.


  Perfectly good example of timely optimization.

  The main reason (which I may not have communicated clearly) is  
because any unnecessary work at all is wasteful. Especially for mobile  
platforms (laptop and iPhone users will thank you for sparing their  
battery life ... or curse you for not caring).


  Asking for the shared user defaults instance, then asking it for a  
value, then unarchiving a more useful object from it, *then* using it  
to draw is certainly more work than caching the value only when it  
changes. It's not like it's performance tuning - it's *basic 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: The thread that starts by NSTask didn't clear up

2008-12-09 Thread Xianyu_Ge
thanks for your reply. I means in my project, I want to use NSTask to  
launch an application, and send application some parameters, when use  
NSTask launch application that will add a new thread, right? and then  
send Apple event, when application received Apple event , it will  
quit, usually, the thread starts by NSTask will exit, because the  
application had quit, so I don't understand this, if use NSTask launch  
application more times, thread count will always increased, even if  
application had quit. I appreciate that any reply, thank you very much.



---
Best Regards,
Xianyu





On Dec 10, 2008, at 12:44 AM, Etienne Guérard wrote:

	I started an AP use NSTask in my project ,when I loaded this AP,  
thread count will be increased ,after sending apple event to AP ,  
and AP will exit, but thread count can't decrease. If I used this  
method load AP more times, thread count will increased, but there  
was no problem on tiger, just  present leopard. Sorry for my poor  
english.


I assume that AP acually means application.
I understand that you send some Apple event to your application like  
a quit' event, right?
You say that your application exit. OK. So what process the threads  
you're talking about belong to?

Where does NSTask come into this?

You have to be more precise to get an answer...

EG

This message and any attachments (the message) are confidential  
and intended solely for the addressee(s). Any unauthorised use or  
dissemination is prohibited. E-mails are susceptible to alteration.  
Neither DxO Labs nor any of its subsidiaries or affiliates shall be  
liable for the message if altered, changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le message) sont  
confidentiels et etablis a l'intention exclusive de ses  
destinataires. Toute utilisation ou diffusion non autorisee est  
interdite. Tout message electronique est susceptible d'alteration.  
DxO Labs et ses filiales declinent toute responsabilite au titre de  
ce message s'il a ete altere, modifie ou falsifie.




___

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

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

2008-12-09 Thread Ricky Sharp


On Dec 9, 2008, at 7:25 PM, I. Savant wrote:


On Dec 9, 2008, at 8:09 PM, Ricky Sharp wrote:

In some cases, other attributes, when set, will 'dirty' that flag  
followed by a setNeedsDisplay.  Colors will then be re-fetched/ 
created and then reused until the next change comes along.


 Perfectly good example of timely optimization.

 The main reason (which I may not have communicated clearly) is  
because any unnecessary work at all is wasteful. Especially for  
mobile platforms (laptop and iPhone users will thank you for sparing  
their battery life ... or curse you for not caring).


 Asking for the shared user defaults instance, then asking it for a  
value, then unarchiving a more useful object from it, *then* using  
it to draw is certainly more work than caching the value only when  
it changes. It's not like it's performance tuning - it's *basic  
design*.



I suppose I'm from the camp of developers that started in the days of  
8-bit CPUs with limited memory.  My coding style tends to be very  
conscious of resources.  I also have quite a bit of embedded  
experience, so that further reinforces that style.


I've never seen situations where one wastes resources and doesn't at  
some point later have to refactor lots of code.  This typically comes  
into play not only when going embedded, but when massively scaling  
your app upwards.


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


-[NSManagedObject reallyIsDeleted]?

2008-12-09 Thread Nick Zitzmann

I searched the archives and didn't see anything relevant...

The -[NSManagedObject isDeleted] method incorrectly returns false if  
the object has been deleted. This is in the documentation, despite the  
misleading name, but how do I find out if an NSManagedObject has  
really been deleted? Right now I'm putting exception handlers around - 
valueForKey:  then calling it, since the method raises an exception  
if the object truly has been deleted, but this seems really, really  
wrong.


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: Custom NSTableView cells

2008-12-09 Thread Graham Cox


On 10 Dec 2008, at 12:21 pm, Randall Meadows wrote:

I could use a little guidance, please, on customizing cells for  
display in an NSTableView.  (My app is Leopard-only.)  I looked  
around the Apple docs and cocoadev, but didn't really find anything  
useful.  Other pointers would be appreciated.


My table has but one column, but each cell in that column is made up  
of 2 or more views.  I think I have what I need as far as the cells  
go, but it's feeding them to the table view that's giving me problems.



The first thing to realise is that there is not one cell per row.  
There is only one cell per column. The single cell is moved from row  
to row as the table draws the rows. Once you realise that there is  
only one cell, things become a bit clearer.


I'm not sure what you mean by each cell having two views. Do you  
literally mean NSViews, or are you using the term more loosely? AFAIK,  
it's really not feasible to embed actual NSViews in a cell.


I know the required datasource methods are - 
numberOfRowsInTableView: and - 
tableView:objectValueForTableColumn:row:; the first is a no-brainer,  
the 2nd one stumps me.


The second one gets the actual value for the row/column in question.  
Without this your table wouldn't draw anything because it doesn't know  
what to draw - the table is entirely generic and makes no assumptions  
about what the data content is.


Because there is only one cell per column, this method is used  
whenever needed to give the data to the cell at the right time.


I assume I must implement -tableView:dataCellForTableColumn:row: to  
feed the table my custom cells for each row, right?


Not normally. This method is used when you have different cell types  
for each row, which is fairly uncommon. Typically you set the cell for  
the entire column in one go. You can do this in IB, or else  
programatically using [NSTableColumn setDataCell:]


What purpose then does the -tableView:objectValueForTableColumn:row:  
method serve?  What should be returned from that if I'm already  
feeding ready-made cells from the other one?  (This table is not  
editable, so I do not need to worry about - 
tableView:setObjectValue)


Don't feed cells per row unless you have to. Set the cell once for the  
column, then let the dataSource supply it on demand with its data.


The docs also say that my cells must properly implement - 
copyWithZone:, but I don't know what properly means in that context.


I guess it means that your copy method must return a real copy, not  
just retain and return self, since cells are considered always mutable  
- the table must be allowed to mutate the cell as needed with no side  
effects.


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 Can I Notify DrawRect Method?

2008-12-09 Thread Graham Cox


On 10 Dec 2008, at 12:25 pm, I. Savant wrote:

Asking for the shared user defaults instance, then asking it for a  
value, then unarchiving a more useful object from it, *then* using  
it to draw is certainly more work than caching the value only when  
it changes. It's not like it's performance tuning - it's *basic  
design*.



Just to clear something up for myself, doesn't NSUserDefaults cache  
everything internally in memory anyway? So really you're not  
unarchiving every time but just fetching an object from a dictionary,  
with no excessive performance overhead. I realise this is an  
implementation detail, but there's nothing in the docs that implies  
that the defaults values are unarchived from disk every time; why  
would they be? Surely that's why there is a required -synchronize  
method to force the contents on disk to be updated?


--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: Creating a window when pressing a button

2008-12-09 Thread Damien Cooke

Jushin,

What I have done in the past with these sort of issues is either load  
the nib in the button pushed action or depending on how complicated  
your secondary window is, you could programatically create it like this.


myWindow = [[NSWindow alloc] initWithContentRect:myRect  
styleMask:NSTitledWindowMask|NSResizableWindowMask  
backing:NSBackingStoreBuffered defer:YES];


Hope that gives you some ideas?

Damien



On 10/12/2008, at 7:54 AM, Jushin wrote:

In my application, I have to open a form window when a user press a  
button.

It is somewhat similar to Apple Mail. In Apple Mail, if you click New
Message button from the toolbar, a New Message window is appeared.

For now, what I did was something like this:
In IB, I added a window (or a panel), and the associated button shows
the window by using makeKeyAndOrderFront method when pressed.
However, I realized it is not what I want.
In this case, a window is already created, and the button only shows
or hides the window.
What I want is really creating a window when a user presses the
button, so that the user can creates multiple windows by pressing the
button.
I wonder how can I do this.
The window will contain form fields to get values for Core Data  
models.


Thanks,
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/damien.cooke%40internode.on.net

This email sent to [EMAIL PROTECTED]


I Remenber When Synthesizers were Analogue
Programs were somthing you watched on T.V
and a hard drive was from Sydney to Adelaide!





___

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

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

2008-12-09 Thread xiaobin
Thanks for your reply, Rob

I found the following site had the same problem (using an Apple
Script) to mine.
http://lists.apple.com/archives/cocoa-dev/2003/Dec/msg00563.html


In my App A I also use the Security Framework to authenticate the user
to elevate privilege because my App B must be run by admin user.

But I found the question is that even if I elevate privilege from A
user(administrator) to the same A user, the Apple Script is still
failed. Of course, when I modified my app A to make it unauthenticate
user, the Apple Script works fine.

so I'm not sure whether the Security Framework refuse to run an
AppleScript or not. I don't know.



2008/12/9 Rob Keniger [EMAIL PROTECTED]:

 On 09/12/2008, at 4:55 PM, xiaobin wrote:

 But I only want to know why it doesn't work by using the apple script.
 My old applications writing in pure object-c works well in the apple
 script.
 I'm afraid that if something is damaged or others in my os, the error
 may be have influence on my other Apps.
 So anyone can give me a hit about the error.


 Good question, I don't know. Your code works perfectly for me here.

 --
 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/leptonw%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: Custom NSTableView cells

2008-12-09 Thread j o a r


On Dec 9, 2008, at 6:21 PM, Randall Meadows wrote:

I could use a little guidance, please, on customizing cells for  
display in an NSTableView.  (My app is Leopard-only.)  I looked  
around the Apple docs and cocoadev, but didn't really find anything  
useful.  Other pointers would be appreciated.



Take a look at this sample project:

http://developer.apple.com/samplecode/PhotoSearch/

j o a r


___

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

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

2008-12-09 Thread Damien Cooke

Jushin,
Here is an example loading from nib within an action method

- (IBAction)showMyNewWindow:(id)sender
{
NSLog(@Loading Nib);
if(!myNewWindow)
{
[NSBundle loadNibNamed:@MyNewWindow owner:self];
}
[myNewWindow makeKeyAndOrderFront:nil];
}

On 10/12/2008, at 12:16 PM, Damien Cooke wrote:


Jushin,

What I have done in the past with these sort of issues is either  
load the nib in the button pushed action or depending on how  
complicated your secondary window is, you could programatically  
create it like this.


myWindow = [[NSWindow alloc] initWithContentRect:myRect  
styleMask:NSTitledWindowMask|NSResizableWindowMask  
backing:NSBackingStoreBuffered defer:YES];


Hope that gives you some ideas?

Damien



On 10/12/2008, at 7:54 AM, Jushin wrote:

In my application, I have to open a form window when a user press a  
button.
It is somewhat similar to Apple Mail. In Apple Mail, if you click  
New

Message button from the toolbar, a New Message window is appeared.

For now, what I did was something like this:
In IB, I added a window (or a panel), and the associated button shows
the window by using makeKeyAndOrderFront method when pressed.
However, I realized it is not what I want.
In this case, a window is already created, and the button only shows
or hides the window.
What I want is really creating a window when a user presses the
button, so that the user can creates multiple windows by pressing the
button.
I wonder how can I do this.
The window will contain form fields to get values for Core Data  
models.


Thanks,
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/damien.cooke%40internode.on.net

This email sent to [EMAIL PROTECTED]


I Remenber When Synthesizers were Analogue
Programs were somthing you watched on T.V
and a hard drive was from Sydney to Adelaide!





___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/damien.cooke%40internode.on.net

This email sent to [EMAIL PROTECTED]


I Remenber When Synthesizers were Analogue
Programs were somthing you watched on T.V
and a hard drive was from Sydney to Adelaide!





___

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

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

2008-12-09 Thread Rob Rix
I’m doing something vaguely similar to this using a subclass of  
NSCollectionView, which sets up the collection view item differently  
depending on some attribute of the represented object it’s operating  
on. In this case, the class is just another attribute.


NSArrayController being in the controller layer of MVC, it doesn’t  
care about the view, so it won’t be a problem for you.


Rob

On 9-Dec-08, at 2:24 PM, Todd Heberlein wrote:


Hi all,

I'm looking for documentation/tutorial/pointers on how to handle the  
situation when an NSArrayController is managing an NSMutableArray  
which will contain multiple types of objects but all of which have  
the same base class. So the NSArrayController's Object Controller  
Class Name is actually a base class.


Then when a user selects an item in the list, depending on the  
subclass type a different view will be displayed, each with  
different fields that will be views for the data in the subclass  
instance.


Is this possible with controllers? Is it recommended/discouraged?  
Any pointers?


Thanks,

Todd

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/rix.rob%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: Creating a window when pressing a button

2008-12-09 Thread Rob Rix
It sounds like you might want to set up the window in a new nib file,  
which you load and unload with NSWindowController by creating a new  
NSWindowController instance and then calling -showWindow: on it.


This also gives you a convenient location to start adding controller  
code for the contents of the new windows; you can subclass  
NSWindowController and add them to that object, which will be the  
File’s Owner of the new nib.


Rob

On 9-Dec-08, at 4:24 PM, Jushin wrote:

In my application, I have to open a form window when a user press a  
button.

It is somewhat similar to Apple Mail. In Apple Mail, if you click New
Message button from the toolbar, a New Message window is appeared.

For now, what I did was something like this:
In IB, I added a window (or a panel), and the associated button shows
the window by using makeKeyAndOrderFront method when pressed.
However, I realized it is not what I want.
In this case, a window is already created, and the button only shows
or hides the window.
What I want is really creating a window when a user presses the
button, so that the user can creates multiple windows by pressing the
button.
I wonder how can I do this.
The window will contain form fields to get values for Core Data  
models.


Thanks,
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/rix.rob%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: How Can I Notify DrawRect Method?

2008-12-09 Thread Michael Ash
On Tue, Dec 9, 2008 at 6:31 PM, I. Savant [EMAIL PROTECTED] wrote:

 Even if it were slower, contorting the code like this without
 having profiled the code and demonstrated that this is in fact a
 significant slowdown is bad practice.

  I disagree. Certainly it's profile first, but to have a view that reads a
 simple property from user defaults every time it draws requires more
 overhead than using an instance variable. Especially when you're using an
 NSColor object which must be properly archived and unarchived.

Of course it uses more overhead. But the point is that in the big
picture, the increased vs decreased overhead is unimportant. It
doesn't matter whether you spend 1ns fetching a color from an ivar vs
1us fetching a color from user defaults when you're going to
subsequently spend 1ms drawing with that color.

  Imagine adding complexity to this view and using multiple values like this
 per draw cycle, and having to draw a whole bunch of stuff. Directly reading
 colors from user defaults is suddenly a whole lot more expensive.

  It doesn't matter much for the simple case the OP presented, but it
 certainly does for a custom view that does heavy drawing, especially if it's
 involved in an animation.

Doing something repeatedly doesn't suddenly catapult marginal overhead
into being important. If it takes a fraction of a percent in the
simple case it'll take a fraction of a percent in the high-demand
animated case too.

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: Symbol not found error

2008-12-09 Thread Sean McBride
Daniel Luis dos Santos ([EMAIL PROTECTED]) on 2008-12-10 7:38 PM said:

I am getting this error  over and over again, whenever I do a new
target in some place and then try to use it somewhere else.
I have a dynamic library in a project that is used in another project.
Then I added another dynamic library to the first one which is also
used by the second project.

The first lib links and the last won't link. The symbols are not
found. From the gcc command line the -L option is the same because the
dylib is in the same directory, a new -llibname flag is added for
the new dylib (I dragged the lib file from the finder to the xcode
tree).
When I do an nm on the lib file, the symbols are there.
I changed the install name to have the rpath, but is only relevant at
run-time, right?

Where's the Cocoa?  Sounds like a question for the Xcode list

Sean


___

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

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

2008-12-09 Thread Michael Ash
On Tue, Dec 9, 2008 at 8:25 PM, I. Savant [EMAIL PROTECTED] wrote:
 On Dec 9, 2008, at 8:09 PM, Ricky Sharp wrote:

 In some cases, other attributes, when set, will 'dirty' that flag followed
 by a setNeedsDisplay.  Colors will then be re-fetched/created and then
 reused until the next change comes along.

  Perfectly good example of timely optimization.

  The main reason (which I may not have communicated clearly) is because any
 unnecessary work at all is wasteful. Especially for mobile platforms (laptop
 and iPhone users will thank you for sparing their battery life ... or curse
 you for not caring).

This is a common response whenever I talk about not optimizing where
it's not useful. But the thing is, trying to optimize every little
thing makes your app *slower*.

Imagine building a bridge to be as lightweight as possible. You
*could* start by putting together plans for a bridge, then going over
every bolt in the thing and shaving a bit of metal from each one. Of
course you'll have gone through only a miniscule fraction of the bolts
in the bridge before the people who hired you to build it get fed up
and tell you to open it for traffic or get lost. Result: a very heavy
bridge.

Or you could forget about shaving the weight of the bolts, let them be
heavier than needed, and concentrate on saving weight in the parts of
the structure where it really counts. Use half the number of bolts and
you've already done more than you ever could have before. Lighter
materials, better supports, less redundancy, all will save you big.
But you won't have time to find any of that if you spend your days
shaving the unimportant parts off your bolts.

So it is with programming: you build the fastest code by concentrating
your optimization effort in the places where it can do the most good.

  Asking for the shared user defaults instance, then asking it for a value,
 then unarchiving a more useful object from it, *then* using it to draw is
 certainly more work than caching the value only when it changes. It's not
 like it's performance tuning - it's *basic design*.

This is far from basic design. It's a pure implementation detail. It's
the sort of thing you could come back and switch easily if you decided
that it really was too slow when put up against the real world. It's
just simple caching, which never needs to be designed in advance.
Basic design would be things like using appropriate data structures,
threading vs multiplexing, good data stores, and other such
big-picture things.

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: How Can I Notify DrawRect Method?

2008-12-09 Thread Sean McBride
I. Savant ([EMAIL PROTECTED]) on 2008-12-09 8:25 PM said:

   Asking for the shared user defaults instance, then asking it for a
value, then unarchiving a more useful object from it, *then* using it
to draw is certainly more work than caching the value only when it
changes. It's not like it's performance tuning - it's *basic design*.

Well, such things are never black and white, of course... but I just
wanted to add that caching the value increases your application's memory
use (admittedly only slightly in the case being discussed).  But in the
general case, by increasing memory use you:
 - can fit less in the CPU's cache
 - increase paging
 - etc.

So it could actually lead to making your app slower!

IMNSHO, best to write the least code possible, profile, and change as needed.

Sean


___

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

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

2008-12-09 Thread Graham Cox


On 10 Dec 2008, at 11:21 am, Graham Cox wrote:

I did also try the idea of using an active marker in a separate  
table column to indicate the active layer and that worked alright,  
but much less obvious and visible than using the selection highlight  
for this. It also added another column to the table which I'd prefer  
to keep to a minimum width so that the user has the largest  
available working space in the window. (The layers table and the  
content are side-by-side in a split view).



I've decided to go back to this approach, which avoids the problem  
altogether. I realised that using the highlight of the table to  
represent some state in my model is probably not such a great idea -  
it creates further problems like not being able to drag-reorder group  
items or pick up several items at once and dragging them into a group.


The extra space needed is a slight downside but i can live with it...

I suspect you were simply waiting for me to realise this ;-)

cheers, 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-09 Thread Nathan Day
You probable do not have AppKit include into you command line tool  
(under the 'External Frameworks and Libraries' folder) either add it  
to your project or look at LaunchServices which is easy to use, I have  
an example/wrapper on my web site.


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



I'm missing something obvious, but I don't know what.

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

When I try to build the simplest thing, I get

--

Undefined symbols:
 .objc_class_name_NSWorkspace, referenced from:
 [EMAIL PROTECTED]@[EMAIL PROTECTED] in LaunchMyMail.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
  .objc_class_name_NSWorkspace, referenced from:
  [EMAIL PROTECTED]@[EMAIL PROTECTED] in LaunchMyMail.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

---

This happens whatever combination of the following imports I use:
#import Foundation/Foundation.h
#import ApplicationServices/ApplicationServices.h
#import cocoa/Cocoa.h
#import AppKit/AppKit.h

This also happens for
 [[NSWorkspace sharedWorkspace] openFile:@SomeFile  
withApplication:@someApp];



Examples I find, don't seem to have any problem, but when I copy  
them onto

my machine, they don't work.


Thanks,

John V.
___

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

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

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

This email sent to [EMAIL PROTECTED]




Nathan Day
Software Engineer
home:   +61 (0)2 9356 4874
work:   +61 (0)2 8207 8241
mobile: +61 (0)4 3863 2407



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 launch window of the application on clicking of dock icon?

2008-12-09 Thread Arun
Thanks for the reply.

My app is not a document based.
I tried using the applicationDidBecomeActive to bring up my main window. It
works only when my application is not active. i.e., when the  MenuBar is
occupied by other application. If i launch my app and close the window, the
menu bar is still occupied with My App's menu bar. If noe i click on the
dock icon, the window will not come up. I need the window to come up.

-Arun KA



On Wed, Dec 10, 2008 at 12:21 AM, Raleigh Ledet [EMAIL PROTECTED] wrote:

 This depends on your application.

 A document based application will automatically create a new untitled
 document for you. Which is generally what you want. If you app is really
 document based, its best to use the document based project template.

 If you app is not document based (say Mail or System preferences) then you
 have to consider what the expected / correct behavior is. Mail stays active
 when you close all of it's windows (checking email in the background). For
 this behavior use -applicationDidBecomeActive: to check if any widows are
 shown. If not, then show the expected window.

 For some (rare) apps on OS X, staying open is not expected / wanted. For
 example, System Preferences quits when you close its one and only window.
 This can be done via -applicationShouldTerminateAfterLastWindowClosed.

 If this is just a test app, you might want to try them all to get a feel
 for it. But for a real app, consider very carefully which behavior you want.

 -raleigh


 On 09 Dec,2008, at 9:02 AM, Arun wrote:

  Hi,

 I have created a simple application in cocoa.
 when it is ran, the main window appears and a default dock icon in the
 Dock.
 If i close the window, the dock icon still stays. But if i click on the
 dock
 icon then also the main window is visible.
 The only way i can see the main window is by quitting the app and
 launching
 it again. Is there any way in which upon clicking on the dock,
 the application window becomes visible.

 Thanks
 Arun KA
 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/ledet%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: Fix for Core Data + NSTreeController + NSOutlineView Crashes?

2008-12-09 Thread Bill Monk

Has anyone ever found a way to use Core Data + NSTreeController +
NSOutlineView without getting crashes during undo?


Try setting an isLeaf leaf keypath on the tree controller in IB and  
add a Boolean isLeaf attribute in the data model. When I do that  
here, AbstractTree and similar examples no longer crash.


The docs claim the leaf keypath is optional, and presumably that's  
the intended behavior - if you run some of these samples under 10.4,  
they seem to work fine. Under 10.5, though, it's a different story.


Anyway, I've been working for a few months on a Core Data +  
NSTreeController (with a leaf keypath) + NSOutlineView project and  
never see this problem. When first working through the examples it  
was pretty disconcerting to see some of them crashing on Undo, but  
no leaf keypath seems to be the common denominator.

___

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

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

2008-12-09 Thread Nathan Day


On 10/12/2008, at 07:36 , John Love wrote:


Reference:

http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/chapter_6_section_5.html#/ 
/apple_ref/doc/uid/1057i-CH16-SW7


I've got several questions since I'm just starting to investigate  
Mach Ports.


1) Why is +LaunchThreadWithPort: so designated, ie, a class method.   
It seems to me that as far as the specific code listings presented,  
a class method is not required?  For example, [workerObj  
sendCheckinMessage:distantPort] could be replaced with [self  
sendCheckinMessage:distantPort] if LaunchThreadWithPort would be  
changed to an instance method.




2) Maybe the real question #1 is:  What exactly is the object in the  
background thread, named workerObj ??


Class object can be used as any other object, it means they don't have  
to create an instance.
It is the Class/Factory object MyWorkerClass you can treat them the  
same as any other object they are just created automatically for you.
When you send a message you do not disquish between class objects and  
instance objects it is only when defining the class you use the +/-  
syntax to say which object(s) the method is for, the single class  
object or the multiple instance objects.


I don't know if this helps but if you where to implement this kind of  
thing in C, then each class would have two struct definitions one for  
the class object and one for the instances that would contain a  
pointer to the class object.





3) I've saved my most general question to last, at least for this  
trip:  currently when I enter my method to start up my background  
thread or threads, I simply call (several times if I have multiple  
threads:


[NSThread detachNewThreadSelector:@selector(bgCalcThread:)  
toTarget:self withObject:nil]


If I have multiple background threads, I can use a  
NSMutableDictionary with multiple keys for inter-thread communication


As long as you use a lock yes, the point of this example is NSRunLoop  
and using NSPort, doing it this way mean you can have a thread wait  
for to be triggered on mutliple inputs source one of which is data  
through your port you could not do this with just passing data  
directly between two threads and using locks.


One use for this prior to 10.4? is that you could use this to invoke  
methods in the main thread, my NDRunLoopMessager class did this and  
there was another on the net somewhere, there is now an NSObject  
method to do this for you, it probable uses this technique. You could  
not do this with a straight locks very well because you either have to  
use I timer so the runloop can keep polling until there is data for it  
to handle or it waits on a lock until the data is ready, holding up  
the GUI thread.



So, what do Mach Ports give me that the above doesn't?


John Love
Touch the Future! Teach!



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.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]


Get Info via OS X UI on app with changed version data still shows old value, unless copied, then it works

2008-12-09 Thread Chris Markle
Confused here about where Get Info on an app bundle gets its info...
I'm sure this is basic stuff for you guys, but I'm relatively new at
this.

I have a directory called say AppDir with an application bundle in
it called App1. I altered the various version strings and what-not
in App1/Info.plist and App1/Resources/English.lproj/InfoPlist.strings
to newer values (just edited and saved them as appropriate). I then
did a Get Info on the App1 bundle and the General  Version data still
shows the _old_ data. Scratching my head as to why... Then I
duplicated App1 to App1 copy and tried a Get Info on the App1 bundle
in the duplicated directory. It shows the proper changed value in the
General  Version data.

So the original I manipulated always seems to show the old version
string data via Get Info but copies of the directory/app show the
changed value. Anyone know what's going on here?

Thanks in advance...

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: Design patterns: MVC, MVP, Passive View... where is Apple heading???

2008-12-09 Thread Nathan Day
I have seen that version of the MVC pattern a lot where the View and  
Model are directly connected sometimes only one way, never really  
understood how it was supposed to work, my understanding is that with  
cocoa the model and view where never directly connected to each and it  
was the purpose of the controller classes act as an interface between  
the two, I guess the controller acts as a presenter and a controller.


On 10/12/2008, at 00:36 , Karan, Cem (Civ, ARL/CISD) wrote:

To lay the groundwork for this question, I'm going to state that I'm  
getting my definitions for MVC, MVP, and Passive View from the  
following:


http://en.wikipedia.org/wiki/Model-view-controller
http://en.wikipedia.org/wiki/Model_View_Presenter
http://www.martinfowler.com/eaaDev/PassiveScreen.html

Apple has always stated that it uses the MVC design pattern, but I  
noticed in OS X 10.5 we've gotten NSViewController, KVO, bindings,  
etc.,  objects that seem to behave more like the Passive View design  
pattern.  Is this where Apple wants us to head?  I want to plan out  
my code in a manner that plays as well as possible with Apple's  
chosen design patterns, which is why I want to know where Apple is  
headed.


Thanks,
Cem Karan
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/nathan_day%40mac.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]