Re: Drop dowm status menubar item while hovering cursor over it

2009-06-11 Thread Arjun SM
Pardon me for i din't understand (still a novice). I did try adding a
tooltip for the menu item, but when i clicked on the menu bar and hovered
the mouse over my Menulet drop down didn't appear even though menuitem of
Time Machine, Bluetooth and other applications did drop down. any help is
much appreciated.

thanks,
Arjun

On Thu, Jun 11, 2009 at 10:49 AM, Graham Cox graham@bigpond.com wrote:


 On 11/06/2009, at 3:10 PM, Gami Ravi wrote:

  In Mac, When menubar is in focus, at that time hovering cursor on any of
 menu item will drop down status menu for that item. I want to implement same
 functionality.



 Just add a tooltip in IB to the menu item.

 --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/arjun.sm%40gmail.com

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

___

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

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

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

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


Re: Drop dowm status menubar item while hovering cursor over it

2009-06-11 Thread Gami Ravi
Hi,
I am also facing same problem that on adding tooltip for menuitem ,still 
dropdown list didn't come up while hovering mouse cursor over it.

Thanks  Regards,
Ravi Gami.
  - Original Message - 
  From: Arjun SM 
  To: Graham Cox 
  Cc: Gami Ravi ; Cocoa-dev Mailinglist 
  Sent: Thursday, June 11, 2009 11:32 AM
  Subject: Re: Drop dowm status menubar item while hovering cursor over it


  Pardon me for i din't understand (still a novice). I did try adding a tooltip 
for the menu item, but when i clicked on the menu bar and hovered the mouse 
over my Menulet drop down didn't appear even though menuitem of Time Machine, 
Bluetooth and other applications did drop down. any help is much appreciated.

  thanks,
  Arjun
   

  On Thu, Jun 11, 2009 at 10:49 AM, Graham Cox graham@bigpond.com wrote:


On 11/06/2009, at 3:10 PM, Gami Ravi wrote:


  In Mac, When menubar is in focus, at that time hovering cursor on any of 
menu item will drop down status menu for that item. I want to implement same 
functionality.




Just add a tooltip in IB to the menu item.

--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/arjun.sm%40gmail.com

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




Email Scanned for Virus  Dangerous Content by : 
www.CleanMailGateway.com 
___

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

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

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

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


Re: Drop dowm status menubar item while hovering cursor over it

2009-06-11 Thread Andrew Farmer

On 10 Jun 2009, at 23:02, Arjun SM wrote:

Pardon me for i din't understand (still a novice). I did try adding a
tooltip for the menu item, but when i clicked on the menu bar and  
hovered
the mouse over my Menulet drop down didn't appear even though  
menuitem of
Time Machine, Bluetooth and other applications did drop down. any  
help is

much appreciated.


Oh, what he's asking is why you can't single-click to drop down one  
menu, then switch over to a statusbar item's menu without clicking  
again.


This behavior is common to all status bar items, and is arguably a  
bug. You can try reporting it to Apple, but it's unlikely to be fixed  
for a while yet.

___

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

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

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

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


Re: Custom NSView/NSWindow First Responders

2009-06-11 Thread Michael Ash
On Wed, Jun 10, 2009 at 9:34 PM, John Kujohn.c...@gmail.com wrote:
 Good afternoon all,
 Im having trouble setting the correct first responder / key window in my
 app.

 I have a subclass NSWindow with NSBorderlessWindowMask and a custom drawing
 NSView inside the window. So the window is transparent showing the NSView's
 drawing. The NSView image is drawn with NSDrawThreePartImage to create a
 resizable window.

 The problem is this: if i have an instance of NSTextField created within the
 NSView or NSWindow, the text field is selectable with mouse but does not
 accept keyboard events.

 I have my NSView set acceptsFirstResponder  becomeFirstResponder to return
 YES but still no dice.

By default, an NSWindow created with NSBorderlessWindowMask cannot
become the key window and thus cannot accept keyboard events. Subclass
NSWindow and override -canBecomeKeyWindow and it should work better
for you.

Mike
___

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

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

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

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


Re: Drop dowm status menubar item while hovering cursor over it

2009-06-11 Thread Gami Ravi
Oh, what he's asking is why you can't single-click to drop down one  menu, 
then switch over to a statusbar item's menu without clicking  again.


This behavior is common to all status bar items, and is arguably a  bug. 
You can try reporting it to Apple, but it's unlikely to be fixed  for a 
while yet.


If this is the case, then it should also work with statusbar item that i 
created. i.e. If click on time machine icon then status menu will be 
displayed. now i move mouse over my application statusbar item then it 
should display status menu. Am i right?


because this was not the case with my application statusbar item.Status menu 
is not display when i move from other items to my statusbar item.


Please suggest.


Thanks  Regards,
Ravi.

___

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

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

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

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


Re: Drop dowm status menubar item while hovering cursor over it

2009-06-11 Thread Michael Vannorsdel
What Mr. Farmer was saying is this problem is a known bug with no  
workaround or quick fix.  You will have to wait for Apple to fix this  
in a future system update.  There is nothing you can do to your  
application to make this work properly.


If you make a separate status item plugin, that will work properly  
because it is loaded and handled by the same process as all the system  
status items.  But a status item from an application won't work the  
same.



On Jun 11, 2009, at 1:51 AM, Gami Ravi wrote:

Oh, what he's asking is why you can't single-click to drop down  
one  menu, then switch over to a statusbar item's menu without  
clicking  again.


This behavior is common to all status bar items, and is arguably a   
bug. You can try reporting it to Apple, but it's unlikely to be  
fixed  for a while yet.


If this is the case, then it should also work with statusbar item  
that i created. i.e. If click on time machine icon then status menu  
will be displayed. now i move mouse over my application statusbar  
item then it should display status menu. Am i right?


because this was not the case with my application statusbar  
item.Status menu is not display when i move from other items to my  
statusbar item.

___

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

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

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

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


How to Access NSArrayController Contents in NSCollectionView Views?

2009-06-11 Thread Bryan Marty
I am currently have trouble trying to understand how to access objects  
in an NSArrayController in conjunction with a NSCollectionView.


I have a class entitled: VCMovieObjects, which contains information  
on a specific video clip. These objects are loaded into an  
NSArrayController, which is bound to a NSCollectionView. The  
NSCollectionView loads up my own subclassed NSViews (VCMovieContainer)  
into its contents for each object in the NSArrayController. I know I  
can bind various labels on my subclassed NSView to show the properties  
stored in my VCMovieObjects, but I want my VCMovieContainer to be able  
to access the appropriate VCMovieObject itself in the code, that way I  
can access all the data I need from it and use it appropriately when  
drawing the contents of the VCMovieContainer that correlates to that  
specific VCMovieObject.


I am not sure about how to go about doing this in the correct way. I  
consider trying to bind an Object to the NSArrayController, and then  
creating an Outlet to that object from my custom NSView, but I don't  
know if it will maintain the correct reference to the right object  
that coressponds with the particular view. When I tried it, I just got  
a null when trying to access data. I want to avoid subclassing  
NSArrayController if possible. Any pointers would be appreciated.  
Thank you.

___

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

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

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

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


SQLite -- same DB, different machines - different results

2009-06-11 Thread Тимофей Даньшин

Hello.
I've written the alfa of my first app on the Mac which works in an  
acceptable manner on my macbook. But when i run it on my iMac, it  
returns different results for the in seemingly the same conditions.


The application is a dictionary. As the user types a word into the  
searchfield, he/she gets a completion suggestion (much like in Xcode  
for class or variable or method names or like in Safari for web- 
addresses). In my case it is the first word in the database with the  
prefix the user has already typed. So, for example, if a the user  
types te, the first suggestion (s)he gets is tea. But on the iMac,  
the user does not get that completion...
Again, the application is completely the same. It is the release  
build. It has the same database. Now that I think about it, the  
versions if SQLite may be different, but that shouldn't really matter,  
for SQL syntax is pretty standard. And the tables in the database do  
have an autoincremental id (besides the 'rowid').


What could be the reasons for that?

Thank you in advance,
Timofey.

By the way, if you are willing to try it, I think i could upload it  
somewhere... It is a russian-english-russian dictionary.

___

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

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

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

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


Get|SetControlProperty() equivalent

2009-06-11 Thread Jo Meder

Hi,

I'm pretty sure I know the answer to this question, but I'll ask it  
anyway :-)...


Is there a Cocoa equivalent to Carbon's Get|SetControlProperty()  
family of functions? For those not familiar these functions let you  
associate user data with controls. I've never really used this for  
much, but it is very useful for storing a pointer to a C++ object  
representing the control in a UI framework, for example.


It would be great to be able to do this for NSViews but I haven't  
been able to find any equivalent. Are there any ingenious ways that  
you might be aware of so I could bolt this on to NSView?


I'm trying to avoid setting up a map from NSViews to UI framework  
objects, but I suspect it will be inevitable. Not really a big deal,  
but less hassle to be able to associate the data directly so that  
would be a preferable solution.


Regards,

Jo Meder
___

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

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

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

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


Re: Get|SetControlProperty() equivalent

2009-06-11 Thread Michael Vannorsdel
Generally you subclass the control and implement whatever data  
association you want.



On Jun 11, 2009, at 4:41 AM, Jo Meder wrote:

I'm pretty sure I know the answer to this question, but I'll ask it  
anyway :-)...


Is there a Cocoa equivalent to Carbon's Get|SetControlProperty()  
family of functions? For those not familiar these functions let you  
associate user data with controls. I've never really used this for  
much, but it is very useful for storing a pointer to a C++ object  
representing the control in a UI framework, for example.


It would be great to be able to do this for NSViews but I haven't  
been able to find any equivalent. Are there any ingenious ways that  
you might be aware of so I could bolt this on to NSView?


I'm trying to avoid setting up a map from NSViews to UI framework  
objects, but I suspect it will be inevitable. Not really a big deal,  
but less hassle to be able to associate the data directly so that  
would be a preferable solution.


___

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

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

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

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


Stepping the event loop?

2009-06-11 Thread Jo Meder

Hi,

Although I'm ashamed to admit it, there are certain parts of our  
application that rely on stepping the event loop manually to  
maintain interactivity during intensive processing. It actually  
worked pretty well. Eventually I would hope that all such processing  
can be moved off onto secondary threads but unfortunately that isn't  
practical right now, so I need to reproduce this cringeworthy  
behaviour in Cocoa.


One way which occurs to me is create a custom event loop in Cocoa but  
from the few examples I've seen of that it looks like it could be a  
bit more involved than with Carbon, or at the very least people are  
far more hesitant about doing it. Our app did have a custom Carbon  
event loop so it could do various things, but happily I've been able  
to avoid that so far with Cocoa. I have seen this as an example of  
the inner loop of a custom Cocoa event loop ( from http:// 
cocoawithlove.com/2009/01/demystifying-nsapplication-by.html ):


[pool release];
pool = [[NSAutoreleasePool alloc] init];

NSEvent *event = [self
nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantFuture]
inMode:NSDefaultRunLoopMode
dequeue:YES];

[self sendEvent:event];
[self updateWindows];

which looks straightforward enough, but at this stage I don't have  
the experience with Cocoa to know whether this is really sufficient.


Are there any other ways to step the event loop manually in Cocoa?

I need to support 10.4 and up.

Regards,

Jo Meder
___

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

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

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

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


Foundation tool NSUserDefault

2009-06-11 Thread KK
Hello,
I am writing a Foundation tool - a command-line utility that uses
Objective-C and the Foundation framework, and I'm trying to save preferences
under the application domain.. My understanding is that you would need a
bundle identifier to do this, but if it's just a tool, can it have a bundle
identifier?

Or, do I have to use CFPreferences?

Any help would be greatly appreciated,
Keita
___

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

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

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

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


Re: Get|SetControlProperty() equivalent

2009-06-11 Thread Graham Cox


On 11/06/2009, at 8:41 PM, Jo Meder wrote:

I'm pretty sure I know the answer to this question, but I'll ask it  
anyway :-)...


Is there a Cocoa equivalent to Carbon's Get|SetControlProperty()  
family of functions? For those not familiar these functions let you  
associate user data with controls. I've never really used this for  
much, but it is very useful for storing a pointer to a C++ object  
representing the control in a UI framework, for example.


It would be great to be able to do this for NSViews but I haven't  
been able to find any equivalent. Are there any ingenious ways that  
you might be aware of so I could bolt this on to NSView?


I'm trying to avoid setting up a map from NSViews to UI framework  
objects, but I suspect it will be inevitable. Not really a big deal,  
but less hassle to be able to associate the data directly so that  
would be a preferable solution.



The carbon mechanism exists because in classical procedural code, you  
can't subclass an object because there is no formal object to  
subclass. Therefore storage mechanisms have to be provided to hang  
extra stuff on.


In Cocoa, we have proper objects, so you can simply (ingeniously!)  
subclass the NSControl or NSView as you wish and add any extra data  
members you want for any purpose you wish. For example you could  
subclass NSView and add a reference to your C++ object directly as a  
data member along with suitable accessors for it. If the view needs to  
be aware of the C++ code itself you can compile it as Objective-C++  
using a .mm extension on the source file.


--Graham


___

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

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

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

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


Re: SQLite -- same DB, different machines - different results

2009-06-11 Thread Andy Lee
I guess I would ask the same question I asked another recent poster:  
is there some reason you can't install the dev tools on the iMac and  
use them to debug the problem?  It's *your* iMac, right?  Not some  
customer's machine that you don't have access to?


If installing the dev tools is not an option, you could also, as  
someone suggested, add NSLog statements to your program at key points.


Either way, the objective is to figure out which line of code is  
behaving differently on the two machines.  Find that line of code and  
tell us what it is.


--Andy

On Jun 10, 2009, at 7:36 PM, Тимофей Даньшин wrote:


Hello.
I've written the alfa of my first app on the Mac which works in an  
acceptable manner on my macbook. But when i run it on my iMac, it  
returns different results for the in seemingly the same conditions.


The application is a dictionary. As the user types a word into the  
searchfield, he/she gets a completion suggestion (much like in Xcode  
for class or variable or method names or like in Safari for web- 
addresses). In my case it is the first word in the database with the  
prefix the user has already typed. So, for example, if a the user  
types te, the first suggestion (s)he gets is tea. But on the  
iMac, the user does not get that completion...
Again, the application is completely the same. It is the release  
build. It has the same database. Now that I think about it, the  
versions if SQLite may be different, but that shouldn't really  
matter, for SQL syntax is pretty standard. And the tables in the  
database do have an autoincremental id (besides the 'rowid').


What could be the reasons for that?

Thank you in advance,
Timofey.

By the way, if you are willing to try it, I think i could upload it  
somewhere... It is a russian-english-russian dictionary.

___

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

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

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

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


___

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

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

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

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


Re: Get|SetControlProperty() equivalent

2009-06-11 Thread Jo Meder

Hi Graham,

On 11/06/2009, at 11:50 PM, Graham Cox wrote:

The carbon mechanism exists because in classical procedural code,  
you can't subclass an object because there is no formal object  
to subclass. Therefore storage mechanisms have to be provided to  
hang extra stuff on.


It's still just a convenience rather than a necessity, there are  
other ways of doing it. It's a useful convenience though, in this  
case at least.


In Cocoa, we have proper objects, so you can simply (ingeniously!)  
subclass the NSControl or NSView as you wish and add any extra data  
members you want for any purpose you wish. For example you could  
subclass NSView and add a reference to your C++ object directly as  
a data member along with suitable accessors for it. If the view  
needs to be aware of the C++ code itself you can compile it as  
Objective-C++ using a .mm extension on the source file.


It's not really so simple, because I'd have to subclass all the views/ 
controls I use, which is many of the UI elements available, and that  
means I have many disparate classes implementing the same  
functionality. Of course I then need to repeat that for any new  
controls I support. Less work and maintenance to maintain a map from  
NSViews to my C++ framework objects. I should have mentioned I had  
considered and rejected subclassing I guess.


As an aside, I'm using Objective-C++ extensively in my framework.  
It's quite the godsend really and has made things a lot quicker and  
easier.


Thanks anyway. I was a long time MacZoop user BTW. Well, some of  
MacZoop, I used all my own control classes. I use a messaging and  
commander system inspired by my experience with MacZoop in my own  
framework.


Regards,

Jo Meder

___

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

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

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

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


Re: Get|SetControlProperty() equivalent

2009-06-11 Thread Graham Cox


On 11/06/2009, at 11:25 PM, Jo Meder wrote:

It's not really so simple, because I'd have to subclass all the  
views/controls I use, which is many of the UI elements available,  
and that means I have many disparate classes implementing the same  
functionality. Of course I then need to repeat that for any new  
controls I support. Less work and maintenance to maintain a map from  
NSViews to my C++ framework objects. I should have mentioned I had  
considered and rejected subclassing I guess.


Yes, this situation can be painful, as we don't have multiple  
inheritance. I ran into the same problem last week where I wanted to  
add a data member to an ancestor class for a whole family of objects.


Adding methods of course is easy using categories, but adding storage  
to a common ancestor class isn't. In this case you might have to  
resort to tables.


Thanks anyway. I was a long time MacZoop user BTW. Well, some of  
MacZoop, I used all my own control classes. I use a messaging and  
commander system inspired by my experience with MacZoop in my own  
framework.


Yes, I remember your name. I would say that Cocoa's messaging and  
commander classes are generally better thought out than MacZoop's,  
which was somewhat based on my earlier experiences with TCL - anyone  
remember that? ;-)


--Graham


___

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

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

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

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


program crashes because of a variable declaration

2009-06-11 Thread Martin Batholdy

Hi,

my program crashes if I add a variable declaration to a header file.
I really don't understand what the hell is wrong with it;


The programm works fine with this lines;

@interface AppleScriptHandler : NSObject {
NSDictionary *errorInfo;
NSString *appFolder, *filePathFinderFiles;  
}



But it crashes on startup when I add something like;

@interface AppleScriptHandler : NSObject {
NSDictionary *errorInfo;
NSArray *test;
NSString *appFolder, *filePathFinderFiles;  
}



... or this;

@interface AppleScriptHandler : NSObject {
NSString *xxx;
NSDictionary *errorInfo;
NSString *appFolder, *filePathFinderFiles;  
}




I don't change anything but this line ...

___

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

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

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

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


Re: Get|SetControlProperty() equivalent

2009-06-11 Thread Michael Vannorsdel
Subclass NSView and use poseAsClass to replace the default  
implementation.  You'll need to do the posing before running  
NSApplicationMain.  You'll have to use a different approach if you're  
building for 64-bit.



On Jun 11, 2009, at 7:25 AM, Jo Meder wrote:


Hi Graham,

On 11/06/2009, at 11:50 PM, Graham Cox wrote:

The carbon mechanism exists because in classical procedural code,  
you can't subclass an object because there is no formal object  
to subclass. Therefore storage mechanisms have to be provided to  
hang extra stuff on.


It's still just a convenience rather than a necessity, there are  
other ways of doing it. It's a useful convenience though, in this  
case at least.


In Cocoa, we have proper objects, so you can simply (ingeniously!)  
subclass the NSControl or NSView as you wish and add any extra data  
members you want for any purpose you wish. For example you could  
subclass NSView and add a reference to your C++ object directly as  
a data member along with suitable accessors for it. If the view  
needs to be aware of the C++ code itself you can compile it as  
Objective-C++ using a .mm extension on the source file.


It's not really so simple, because I'd have to subclass all the  
views/controls I use, which is many of the UI elements available,  
and that means I have many disparate classes implementing the same  
functionality. Of course I then need to repeat that for any new  
controls I support. Less work and maintenance to maintain a map from  
NSViews to my C++ framework objects. I should have mentioned I had  
considered and rejected subclassing I guess.


As an aside, I'm using Objective-C++ extensively in my framework.  
It's quite the godsend really and has made things a lot quicker and  
easier.


Thanks anyway. I was a long time MacZoop user BTW. Well, some of  
MacZoop, I used all my own control classes. I use a messaging and  
commander system inspired by my experience with MacZoop in my own  
framework.


Regards,

Jo Meder

___

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

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

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

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


___

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

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

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

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


Re: program crashes because of a variable declaration

2009-06-11 Thread Clint Shryock
can you post the error message?  I can't reproduce this

On Thu, Jun 11, 2009 at 8:38 AM, Martin Batholdy batho...@googlemail.comwrote:

 Hi,

 my program crashes if I add a variable declaration to a header file.
 I really don't understand what the hell is wrong with it;


 The programm works fine with this lines;

 @interface AppleScriptHandler : NSObject {
NSDictionary *errorInfo;
NSString *appFolder, *filePathFinderFiles;
 }



 But it crashes on startup when I add something like;

 @interface AppleScriptHandler : NSObject {
NSDictionary *errorInfo;
NSArray *test;
NSString *appFolder, *filePathFinderFiles;
 }



 ... or this;

 @interface AppleScriptHandler : NSObject {
NSString *xxx;
NSDictionary *errorInfo;
NSString *appFolder, *filePathFinderFiles;
 }




 I don't change anything but this line ...

 ___

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

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

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

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

___

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

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

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

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


Re: program crashes because of a variable declaration

2009-06-11 Thread Graham Cox


On 11/06/2009, at 11:38 PM, Martin Batholdy wrote:


my program crashes if I add a variable declaration to a header file.
I really don't understand what the hell is wrong with it;



Is this the same problem as your earlier post? It seems like maybe  
you're trying to do stuff with NSObjects before the runtime is  
initialised properly. Obviously it's not adding the extra ivar that's  
causing the problem, but some other problem that this exposes. What  
objects are you creating when? Are you doing anything in main()?  
Generally your app shouldn't start to do any processing until the app  
delegate gets the green light in the form of - 
applicationWillFinishLaunching: or similar.


Try also enabling NSZombieEnabled, as it sounds like you may have a  
memory management problem (over-release most likely).


--Graham


___

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

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

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

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


Re: program crashes because of a variable declaration

2009-06-11 Thread Andy Lee

On Jun 11, 2009, at 9:38 AM, Martin Batholdy wrote:

But it crashes on startup when I add something like;

@interface AppleScriptHandler : NSObject {
NSDictionary *errorInfo;
NSArray *test;
NSString *appFolder, *filePathFinderFiles;  
}


It's rare that an app crashes silently.  Is anything printed to the  
console?  Do you have a crash log?  If you run the app in the  
debugger, what line of code does it crash on?


Also, are there any compiler warnings that you are ignoring?

These are the very first things you should look at when you're  
debugging, and if you're still stumped, this is the kind of  
information that would help us help you.  When you post a question,  
try to include relevant information.


--Andy

___

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

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

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

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


Doc kind from extension

2009-06-11 Thread Micha Fuhrmann
Anyone knows how to get the system doc kind from a given extension.  
Not from a file, or a file path for that matter, but just from an  
extension. Like giving pdf and receiving Portable Document Format  
(PDF). I've tried


NSString * theTest = [[NSDocumentController sharedDocumentController]  
typeFromFileExtension:@pdf];


But I get nil.

Any idea?
___

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

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

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

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


NSString becoming invalid

2009-06-11 Thread McLaughlin, Michael P.
In an Xcode (3.1.2) Cocoa document app targeting 10.5, I read an NSString
from an XML file and store it, eventually, in a C++ struct as

NSString *fname;

This works most of the time but, sporadically, I get a BAD_ACCESS crash with
an indication that fname has become invalid.  The only explanation I have
found for this is that fname was not sufficiently retained and has been
garbage-collected.

Note: All my C++ files have a .mm extension and garbage collection is
*required*.  Thus, I have no retain/release calls at all.

Is there something more I need to do or is there some other reason why this
might be happening?

TIA.

-- 
Mike McLaughlin

___

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

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

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

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


Re: SQLite -- same DB, different machines - different results

2009-06-11 Thread Gregory Weston

Timofey wrote:


I've written the alfa of my first app on the Mac which works in an
acceptable manner on my macbook. But when i run it on my iMac, it
returns different results for the in seemingly the same conditions.

The application is a dictionary. As the user types a word into the
searchfield, he/she gets a completion suggestion (much like in Xcode
for class or variable or method names or like in Safari for web-
addresses). In my case it is the first word in the database with the
prefix the user has already typed. So, for example, if a the user
types te, the first suggestion (s)he gets is tea. But on the iMac,
the user does not get that completion...


As a recovering Oracle DBA, to me the most obvious question is: Are  
you assuming that the result set will have any given ordering  
automatically imposed, or are you including an explicit order clause  
in your query?


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 arch...@mail-archive.com


Re: program crashes because of a variable declaration

2009-06-11 Thread Graham Cox


On 12/06/2009, at 12:28 AM, Martin Batholdy wrote:


It is pretty strange to me.
I changed something in another file that has nothing to do with the  
file that I am having problems with and now it works ...


Does anyone know how this could be?


Of course not, since we haven't seen one shred of your code.

Try also enabling NSZombieEnabled, as it sounds like you may have a  
memory management problem (over-release most likely).



So I release more stuff than I should be?
But wouldn't that lead to more obvious wrong behavior, as the app  
don't have the information it needs at some point ..?



Who knows? We haven't seen the code. Over-release very often leads to  
weird behaviour because the place in memory where the object used to  
reside is now occupied by another object. Or not... sometimes the  
second release will provoke a crash but very often it won't, being  
handled as a legitimate message on the new object. How this manifests  
itself in your app will vary and is highly unpredictable.  
NSZombieEnabled makes the situation more predictable by reserving the  
released memory and trapping any further messages to it.




The Debugger Debugger is attaching to process


And then what? It should tell you why it stopped and where.

--Graham


___

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

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

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

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


Re: NSString becoming invalid

2009-06-11 Thread Michael Ash
On Thu, Jun 11, 2009 at 9:53 AM, McLaughlin, Michael P.mp...@mitre.org wrote:
 In an Xcode (3.1.2) Cocoa document app targeting 10.5, I read an NSString
 from an XML file and store it, eventually, in a C++ struct as

 NSString *fname;

 This works most of the time but, sporadically, I get a BAD_ACCESS crash with
 an indication that fname has become invalid.  The only explanation I have
 found for this is that fname was not sufficiently retained and has been
 garbage-collected.

 Note: All my C++ files have a .mm extension and garbage collection is
 *required*.  Thus, I have no retain/release calls at all.

 Is there something more I need to do or is there some other reason why this
 might be happening?

The collector does not watch all memory, but only the bits that it has
been informed will hold object pointers. This includes the stack,
global variables, and parts of the heap that were allocated from the
collector's pool. Heap memory also needs a write barrier when
assigning.

Thus, you must allocate this struct using NSAllocateCollectable and
pass the appropriate options to get scanned memory if you are going to
store an ObjC object pointer in that struct. If you store a pointer to
this struct in the heap, that memory must ALSO come from a collectable
area and the pointer must be declared as __strong.

As an alternative, you can CFRetain the NSString, which will remove it
from being eligible for collection. You will have to balance this with
a CFRelease when you're finished with it, of course.

As another alternative, make this struct an ObjC object instead, and
all the details will be handled for you.

Mike
___

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

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

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

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


Re: Doc kind from extension

2009-06-11 Thread Micha Fuhrmann

Unfortunately all I can feed it with is the file extension

Any other idea? Isn't there a mapping plist between extension and Kind  
that exists somewhere?


Michael


On 11 juin 09, at 16:09, Graham Cox wrote:



On 11/06/2009, at 11:50 PM, Micha Fuhrmann wrote:

Anyone knows how to get the system doc kind from a given extension.  
Not from a file, or a file path for that matter, but just from an  
extension. Like giving pdf and receiving Portable Document  
Format (PDF). I've tried


NSString * theTest = [[NSDocumentController  
sharedDocumentController] typeFromFileExtension:@pdf];


But I get nil.

Any idea?



[NSDocumentController displayNameForType:] ?

--Graham


___

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

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

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

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


Re: Doc kind from extension

2009-06-11 Thread Kyle Sluder
On Thu, Jun 11, 2009 at 8:47 AM, Micha Fuhrmannmic...@mac.com wrote:
 Any other idea? Isn't there a mapping plist between extension and Kind that
 exists somewhere?

You might want to read this document:
http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html

--Kyle Sluder
___

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

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

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

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


Re: Doc kind from extension

2009-06-11 Thread Ken Thomases

On Jun 11, 2009, at 10:47 AM, Micha Fuhrmann wrote:


Unfortunately all I can feed it with is the file extension

Any other idea? Isn't there a mapping plist between extension and  
Kind that exists somewhere?


I missed the earlier part of this discussion, but does  
LSCopyKindStringForTypeInfo suit your needs?


Cheers,
Ken



On 11 juin 09, at 16:09, Graham Cox wrote:



On 11/06/2009, at 11:50 PM, Micha Fuhrmann wrote:

Anyone knows how to get the system doc kind from a given  
extension. Not from a file, or a file path for that matter, but  
just from an extension. Like giving pdf and receiving Portable  
Document Format (PDF). I've tried


NSString * theTest = [[NSDocumentController  
sharedDocumentController] typeFromFileExtension:@pdf];


But I get nil.

Any idea?



[NSDocumentController displayNameForType:] ?

--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/ken%40codeweavers.com

This email sent to k...@codeweavers.com


___

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

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

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

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


Re: Stepping the event loop?

2009-06-11 Thread Kyle Sluder
On Thu, Jun 11, 2009 at 4:04 AM, Jo Mederjome...@ihug.co.nz wrote:
 Are there any other ways to step the event loop manually in Cocoa?

-[NSRunLoop runMode:beforeDate:] ?

--Kyle Sluder
___

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

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

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

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


API for fetching the computer name in cocoa

2009-06-11 Thread Arun
Hi All,

Is there any API in cocoa which can be used to fetch computer name which is
getting displayed in Finder?

Thanks
Arun
___

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

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

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

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


Re: Foundation tool NSUserDefault

2009-06-11 Thread Nick Zitzmann


On Jun 11, 2009, at 5:19 AM, KK wrote:


I am writing a Foundation tool - a command-line utility that uses
Objective-C and the Foundation framework, and I'm trying to save  
preferences
under the application domain.. My understanding is that you would  
need a
bundle identifier to do this, but if it's just a tool, can it have a  
bundle

identifier?

Or, do I have to use CFPreferences?



You can use CFPreferences if you wish, but if you use NSUserDefaults,  
the defaults will be written to a plist file with the same name as  
your executable if it has no bundle identifier. That might be good  
enough unless your tool has a very common name or something.


I haven't tried it, but I've read on ADC that there is a way to embed  
an info.plist file in a tool by using this linker flag:

-sectcreate __TEXT __info_plist $(SOURCE_ROOT)/$(INFOPLIST_FILE)

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

___

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

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

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

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


Carbon Boolean

2009-06-11 Thread Matt Neuburg
What is a (Carbon) Boolean and how do I convert it to a Cocoa BOOL
(regardless of architecture)? Thx - m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Customizing Leopard, http://tinyurl.com/2t9629
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com



___

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

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

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

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


Re: Doc kind from extension

2009-06-11 Thread Sidney San Martín
How about this?

CFStringRef UTI =
UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
CFSTR(pdf), NULL);
NSString *name = [(NSString*)UTTypeCopyDescription(UTI) autorelease];
CFRelease(UTI);
// name is now Portable Document Format (PDF)

-Sidney

On Thu, Jun 11, 2009 at 11:47 AM, Micha Fuhrmannmic...@mac.com wrote:
 Unfortunately all I can feed it with is the file extension

 Any other idea? Isn't there a mapping plist between extension and Kind that
 exists somewhere?

 Michael


 On 11 juin 09, at 16:09, Graham Cox wrote:


 On 11/06/2009, at 11:50 PM, Micha Fuhrmann wrote:

 Anyone knows how to get the system doc kind from a given extension. Not
 from a file, or a file path for that matter, but just from an extension.
 Like giving pdf and receiving Portable Document Format (PDF). I've tried

 NSString * theTest = [[NSDocumentController sharedDocumentController]
 typeFromFileExtension:@pdf];

 But I get nil.

 Any idea?


 [NSDocumentController displayNameForType:] ?

 --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/s%40sidneysm.com

 This email sent to s...@sidneysm.com

___

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

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

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

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


Re: API for fetching the computer name in cocoa

2009-06-11 Thread Graham Cox


On 12/06/2009, at 2:08 AM, Arun wrote:


Hi All,

Is there any API in cocoa which can be used to fetch computer name  
which is

getting displayed in Finder?



I'm not sure if there's a better way, but you can use the Gestalt  
function with the gestaltUserVisibleMachineName selector.


--Graham


___

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

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

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

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


Re: program crashes because of a variable declaration

2009-06-11 Thread Andy Lee
On Thursday, June 11, 2009, at 10:28AM, Martin Batholdy 
batho...@googlemail.com wrote:
There are no compiler warnings in the code.


this is printed in the debugger console;

Once again: show us the code that is crashing.  I don't know how to put it any 
more simply.  Most of the time (though not 100%) this is the most important 
clue.  Use the Debug command instead of Run.  Almost always when your 
program crashes the debugger will stop and show you where it crashed.  Go to 
the Run menu and select Debugger to open the debugger window.  If the 
debugger doesn't work, try inserting NSLog statements to find out exactly how 
far your program gets before crashing.

It is pretty strange to me.
I changed something in another file that has nothing to do with the  
file that I am having problems with and now it works ...

Does anyone know how this could be?


Seemingly random crashes that mysteriously fix themselves are often because:

* Your change wasn't as unrelated as you thought.
* You need to do a clean build -- do Clean All and compile again.
* You have a threading problem.
* You have a memory bug.

 Try also enabling NSZombieEnabled, as it sounds like you may have a  
 memory management problem (over-release most likely).


So I release more stuff than I should be?
But wouldn't that lead to more obvious wrong behavior, as the app  
don't have the information it needs at some point ..?

The consequences of over-release are not always obvious or immediate.  Try 
Graham's suggestion.  It's easy to do and it will give you information one way 
or another.  If you don't know how, Google for it.  If what you find is not 
clear, come back with specific questions.

--Andy


___

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

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

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

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


Re: Carbon Boolean

2009-06-11 Thread Graham Cox


On 12/06/2009, at 2:12 AM, Matt Neuburg wrote:


What is a (Carbon) Boolean and how do I convert it to a Cocoa BOOL
(regardless of architecture)? Thx - m.


A Boolean is an unsigned char and a BOOL is a signed char. Since both  
define false as 0 and true as !0, you can simply cast one to the  
other. The ISA doesn't make any difference because it's a single byte.


--Graham


___

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

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

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

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


Re: Carbon Boolean

2009-06-11 Thread Nick Zitzmann


On Jun 11, 2009, at 10:12 AM, Matt Neuburg wrote:


What is a (Carbon) Boolean and how do I convert it to a Cocoa BOOL
(regardless of architecture)?



They're exactly the same size on all architectures; only the signature  
is different (BOOL is signed, Boolean isn't).


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

___

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

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

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

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


Re: Doc kind from extension

2009-06-11 Thread Sidney San Martín
That'll work in most cases, but as discussed in
http://lists.apple.com/archives/carbon-dev/2007/Nov/msg00642.html
anything that Preview can open will just return Preview Document for that call.

On Thu, Jun 11, 2009 at 12:07 PM, Ken Thomasesk...@codeweavers.com wrote:

 I missed the earlier part of this discussion, but does
 LSCopyKindStringForTypeInfo suit your needs?

 Cheers,
 Ken

___

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

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

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

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


Re: Photoshop plugin with Cocoa UI problems

2009-06-11 Thread Frederik Slijkerman

Hi Florian,

I just tried this and oddly enough, when I show the window like this and 
call [NSApp run] to start the event loop, the crash doesn't seem to 
occur. Can't say 100% sure yet, because it doesn't happen all the time, 
but it hasn't happened yet, while I can easily get the crash using a 
modal window. So, it looks like this could be the solution. Thanks!


Best regards,
Frederik Slijkerman


Florian Soenens wrote:

Hi Frederik,

Have you tried wiring your window to an IBOutlet of your Controller and 
displaying it with [window makeKeyAndOrderFront:nil]; ?


This works for me anyway.

HTH,
Florian.

On 10 Jun 2009, at 16:07, Frederik Slijkerman wrote:


Hi all,

I'm trying to make a Photoshop plugin with a Cocoa user interface, but 
I'm running into a persistent problem: after closing the plugin 
window, Photoshop crashes 90% of the time with the following call stack:


#0 0xa04590d8 in _XHNDL_trapback_instruction
#1 0xbf800fac in ??
#2 0x917ea9a2 in __CFRunLoopDoObservers
#3 0x917ebcfc in CFRunLoopRunSpecific
#4 0x917eccd8 in CFRunLoopRunInMode
#5 0x969f42c0 in RunCurrentEventLoopInMode
#6 0x96aa7904 in GetNextEventMatchingMask
#7 0x96aa7766 in WNEInternal
#8 0x96aa76c5 in WaitNextEvent

I've tried every suggestion I could find. The main plugin is a Carbon 
bundle that locates the Cocoa bundle that actually contains the core 
plugin as suggested here:

http://furbo.org/2008/07/08/plug-ins-the-cocoa-way/

The Cocoa bundle exports a plugin entry point as a C function. The 
Carbon bundle calls this from its own entry point using CFBundleCreate 
/ CFBundleGetFunctionPointerForName, but it never releases the Cocoa 
bundle since apparently Cocoa bundles should not be unloaded. The 
whole idea behind this, as far as I can see, is that Photoshop unloads 
the Carbon bundle, but does not unload the core Cocoa bundle.


Next, the Cocoa bundle calls NSApplicationLoad, displays an empty 
window using [NSApp runModalForWindow], then closes the window and 
returns. At this point, I get the aforementioned crash.


What am I doing wrong? Any pointers would be highly appreciated -- 
I've been staring at this for about three days now...


Best regards,
Frederik Slijkerman


___

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

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

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

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


Re: API for fetching the computer name in cocoa

2009-06-11 Thread Sidney San Martín
You can use the System Configuration framework to retrieve the computer name:

NSString *computerName =
[(NSString*)SCDynamicStoreCopyComputerName(NULL, NULL)  autorelease];

-Sidney

On Thu, Jun 11, 2009 at 12:08 PM, Arunarun...@gmail.com wrote:
 Hi All,

 Is there any API in cocoa which can be used to fetch computer name which is
 getting displayed in Finder?

 Thanks
 Arun
___

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

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

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

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


Re: Photoshop plugin with Cocoa UI problems

2009-06-11 Thread Frederik Slijkerman

Hi Scott,

I'm already doing all of that (I studied your earlier post in the 
message archive), but it looks like the modal window was the problem, 
see my other message. Thanks anyway!


Best regards,
Frederik Slijkerman


Scott Andrew wrote:
Make sure your C function calls NSApplicationLoad() this is needed to 
initialize Cocoa (including Cocoa runloops) from Carbon. Also make sure 
you setup your autorelease pool in you plug-in's main entry function.


The plug-in I wrote had all objective C except the startup code.

Scott Andrew

On Jun 10, 2009, at 7:07 AM, Frederik Slijkerman wrote:


Hi all,

I'm trying to make a Photoshop plugin with a Cocoa user interface, but 
I'm running into a persistent problem: after closing the plugin 
window, Photoshop crashes 90% of the time with the following call stack:


#00xa04590d8 in _XHNDL_trapback_instruction
#10xbf800fac in ??
#20x917ea9a2 in __CFRunLoopDoObservers
#30x917ebcfc in CFRunLoopRunSpecific
#40x917eccd8 in CFRunLoopRunInMode
#50x969f42c0 in RunCurrentEventLoopInMode
#60x96aa7904 in GetNextEventMatchingMask
#70x96aa7766 in WNEInternal
#80x96aa76c5 in WaitNextEvent

I've tried every suggestion I could find. The main plugin is a Carbon 
bundle that locates the Cocoa bundle that actually contains the core 
plugin as suggested here:

http://furbo.org/2008/07/08/plug-ins-the-cocoa-way/

The Cocoa bundle exports a plugin entry point as a C function. The 
Carbon bundle calls this from its own entry point using CFBundleCreate 
/ CFBundleGetFunctionPointerForName, but it never releases the Cocoa 
bundle since apparently Cocoa bundles should not be unloaded. The 
whole idea behind this, as far as I can see, is that Photoshop unloads 
the Carbon bundle, but does not unload the core Cocoa bundle.


Next, the Cocoa bundle calls NSApplicationLoad, displays an empty 
window using [NSApp runModalForWindow], then closes the window and 
returns. At this point, I get the aforementioned crash.


What am I doing wrong? Any pointers would be highly appreciated -- 
I've been staring at this for about three days now...


Best regards,
Frederik Slijkerman


___

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

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

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

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


Re: Get|SetControlProperty() equivalent

2009-06-11 Thread Ken Ferry
On Thu, Jun 11, 2009 at 3:41 AM, Jo Meder jome...@ihug.co.nz wrote:

 Hi,

 I'm pretty sure I know the answer to this question, but I'll ask it anyway
 :-)...

 Is there a Cocoa equivalent to Carbon's Get|SetControlProperty() family of
 functions? For those not familiar these functions let you associate user
 data with controls. I've never really used this for much, but it is very
 useful for storing a pointer to a C++ object representing the control in a
 UI framework, for example.


You could look at -[NSCell setRepresentedObject:].

-Ken




 It would be great to be able to do this for NSViews but I haven't been able
 to find any equivalent. Are there any ingenious ways that you might be aware
 of so I could bolt this on to NSView?

 I'm trying to avoid setting up a map from NSViews to UI framework objects,
 but I suspect it will be inevitable. Not really a big deal, but less hassle
 to be able to associate the data directly so that would be a preferable
 solution.

 Regards,

 Jo Meder
 ___

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

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

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

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

___

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

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

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

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


Weird race condition affecting bindings.

2009-06-11 Thread Mac First
I have what looks like an odd race condition surrounding my bindings.   
I have an NSCollectionView that is a list of images.  I believe all of  
the bindings to be hooked up correctly (and code-reviewed by 2 other  
engineers familiar with NSCollectionViews.)


Some code snippets:

---

@implementation AppController

-(void)awakeFromNib {
NSLog(@AppController::awakeFromNib);

[...]

pictureListController = [[PictureListController alloc] init];
[pictureListController showWindow:nil];

---

@implementation PictureListController

@synthesize imagesArray;// @property(nonatomic, retain)

- (id)init {
//self = [super init];
//[self setImagesArray:[NSArray array]];
[self adjustPictureArray];
NSLog(@[DEBUG] about to initWithWindowNibName:@PictureList);
[self initWithWindowNibName:@PictureList];
NSLog(@[DEBUG] AFTER initWithWindowNibName:@PictureList);

return self;
}

[...]

#define KEY_KEY @KEY
#define IMAGE_KEY   @IMAGE
- (void)adjustPictureArray {
NSLog(@[DEBUG] adjustPictureArray -awakeFromNib);
NSMutableArray *mArray = [NSMutableArray arrayWithCapacity:10];
NSDictionary *pictDict = [DataModel picturesDict];
for (NSString *key in [pictDict allKeys])
{
NSImage *image = [DataModel pictureDictWithID:[key intValue]];
NSMutableDictionary *imageDict = [NSMutableDictionary  
dictionaryWithObjectsAndKeys:

key, KEY_KEY,
image, IMAGE_KEY,
nil];
[mArray addObject:imageDict];
}

[self setImagesArray:[NSArray arrayWithArray:mArray]];
}

---

When I run this code, I get:

2009-06-11 07:41:11.092 app[76813:10b] [DEBUG] adjustPictureArray - 
awakeFromNib
2009-06-11 07:41:11.188 app[76813:10b] [DEBUG] about to  
initWithWindowNibName:@PictureList
2009-06-11 07:41:11.214 app[76813:10b] [DEBUG] AFTER  
initWithWindowNibName:@PictureList

2009-06-11 07:41:11.244 app[76813:10b] An uncaught exception was raised
2009-06-11 07:41:11.244 app[76813:10b] [PictureListController  
0x141e10 valueForUndefinedKey:]: this class is not key value coding- 
compliant for the key IMAGE.
2009-06-11 07:41:11.244 app[76813:10b] *** Terminating app due to  
uncaught exception 'NSUnknownKeyException', reason:  
'[PictureListController 0x141e10 valueForUndefinedKey:]: this class  
is not key value coding-compliant for the key IMAGE.'

2009-06-11 07:41:11.245 app[76813:10b] Stack: (
   [etc., snip]

---

I can change things around to do them in a different order and get the  
error to come out for key 'KEY' instead of 'IMAGE', but it's basically  
the same problem.  If I break on the code and examine my array (the  
referencedObject), it's an array of dictionaries, with keys KEY and  
IMAGE, as expected, long before the view displays.


Am I missing some best-practices thing, here?  Is there a special  
ordering in which I need to do this stuff?  I swear this worked a week  
ago and I didn't change anything (other than to install the new SDK  
sigh)


Thanks!

___

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

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

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

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


Growing UITextView in UITableView

2009-06-11 Thread Arie Pieter Cammeraat
I'm trying create a UITableView like the one Apple uses for composing  
an email in its mail app. As far as I know, it is a UITableView with   
UITextView for the mailmessage. There has been  written a lot about  
this topic yet, but I haven't found the solution for my problem. I  
managed to only let the tableView scroll instead of the UITextView as  
well.
But how can I let the textView (and the tableviewcell it's placed in)  
grow with the text? In other words: How can I change the height of  
the textview and the cell at the moment a new line appears?

I tried a lot, but nothing helped so far.

Thanks in advance!

Arie Pieter
___

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

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

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

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


Re: API for fetching the computer name in cocoa

2009-06-11 Thread Greg Guerin

Arun wrote:

Is there any API in cocoa which can be used to fetch computer name  
which is

getting displayed in Finder?



CSCopyMachineName

  -- GG

___

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

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

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

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


Re: Cocoa-dev Digest, Vol 6, Issue 858

2009-06-11 Thread Bill Monk


On Jun 11, 2009, at 10:52 AM, Micha Fuhrmann  wrote:


Unfortunately all I can feed it with is the file extension

Any other idea? Isn't there a mapping plist between extension and Kind
that exists somewhere?


Have you tried LSCopyKindStringForTypeInfo(), LSCopyKindStringForRef 
(), or their brethren in LSInfo.h in ApplicationServices.framework.

___

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

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

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

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


Re: Doc kind from extension

2009-06-11 Thread Kirk Kerekes

UTIs will get you there.

http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html#//apple_ref/doc/uid/TP40001319-CH201-SW1 




___

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

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

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

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


Re: Photoshop plugin with Cocoa UI problems

2009-06-11 Thread Scott Andrew
What doesn't make sense is that the plugin i worked on was modal (it  
was an export plugin). What I noticed in our window does is a call  
abortModal on the windowWIllClose notification. From what i can see,  
from the messages in your original post, it looks like you are still  
in the modal loop. Putting the notification there allows the window to  
handle when [window close] is called.


Scott

On Jun 11, 2009, at 9:34 AM, Frederik Slijkerman wrote:


Hi Scott,

I'm already doing all of that (I studied your earlier post in the  
message archive), but it looks like the modal window was the  
problem, see my other message. Thanks anyway!


Best regards,
Frederik Slijkerman


Scott Andrew wrote:
Make sure your C function calls NSApplicationLoad() this is needed  
to initialize Cocoa (including Cocoa runloops) from Carbon. Also  
make sure you setup your autorelease pool in you plug-in's main  
entry function.

The plug-in I wrote had all objective C except the startup code.
Scott Andrew
On Jun 10, 2009, at 7:07 AM, Frederik Slijkerman wrote:

Hi all,

I'm trying to make a Photoshop plugin with a Cocoa user interface,  
but I'm running into a persistent problem: after closing the  
plugin window, Photoshop crashes 90% of the time with the  
following call stack:


#00xa04590d8 in _XHNDL_trapback_instruction
#10xbf800fac in ??
#20x917ea9a2 in __CFRunLoopDoObservers
#30x917ebcfc in CFRunLoopRunSpecific
#40x917eccd8 in CFRunLoopRunInMode
#50x969f42c0 in RunCurrentEventLoopInMode
#60x96aa7904 in GetNextEventMatchingMask
#70x96aa7766 in WNEInternal
#80x96aa76c5 in WaitNextEvent

I've tried every suggestion I could find. The main plugin is a  
Carbon bundle that locates the Cocoa bundle that actually contains  
the core plugin as suggested here:

http://furbo.org/2008/07/08/plug-ins-the-cocoa-way/

The Cocoa bundle exports a plugin entry point as a C function. The  
Carbon bundle calls this from its own entry point using  
CFBundleCreate / CFBundleGetFunctionPointerForName, but it never  
releases the Cocoa bundle since apparently Cocoa bundles should  
not be unloaded. The whole idea behind this, as far as I can see,  
is that Photoshop unloads the Carbon bundle, but does not unload  
the core Cocoa bundle.


Next, the Cocoa bundle calls NSApplicationLoad, displays an empty  
window using [NSApp runModalForWindow], then closes the window and  
returns. At this point, I get the aforementioned crash.


What am I doing wrong? Any pointers would be highly appreciated --  
I've been staring at this for about three days now...


Best regards,
Frederik Slijkerman


___

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

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

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

This email sent to scottand...@roadrunner.com


___

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

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

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

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


Re: Weird race condition affecting bindings.

2009-06-11 Thread Quincey Morris

On Jun 11, 2009, at 07:43, Mac First wrote:

I can change things around to do them in a different order and get  
the error to come out for key 'KEY' instead of 'IMAGE', but it's  
basically the same problem.  If I break on the code and examine my  
array (the referencedObject), it's an array of dictionaries, with  
keys KEY and IMAGE, as expected, long before the view displays.


Am I missing some best-practices thing, here?  Is there a special  
ordering in which I need to do this stuff?  I swear this worked a  
week ago and I didn't change anything (other than to install the new  
SDK sigh)


I haven't tried to use NSCollectionView since, maybe, 10.5.4, but it  
used to be horribly flawed and may still be.


The problem (I thought, though it was never confirmed) was that  
bindings from the subview prototype are of course not the actual  
bindings to use -- NSCollectionView has to arrange for the *actual*  
subviews to have bindings patterned on the ones in the prototype. At  
the time, NSCollectionView didn't seem to be doing this properly, and  
the way it failed depended on the order of the objects in the nib  
file, so that simply editing your xib file would cause it to fail in  
different ways.


Now I may be maligning NSCollectionView, but my conclusion at the time  
(based on this and the class's other faults, and its truly  
unenlightening documentation) that NSCollectionView is a class to be  
avoided.


FWIW


___

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

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

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

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


Re: program crashes because of a variable declaration

2009-06-11 Thread Scott Ribe
 Does anyone know how this could be?

Yes, you are corrupting memory somewhere. Depending on the exact layout of
objects ( ivars) in memory, this corruption may go unnoticed, or may cause
a crash.


-- 
Scott Ribe
scott_r...@killerbytes.com
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 arch...@mail-archive.com


Re: Weird race condition affecting bindings.

2009-06-11 Thread Mac First


On Jun 11, 2009, at 10:20 AM, Quincey Morris wrote:


On Jun 11, 2009, at 07:43, Mac First wrote:
I can change things around to do them in a different order and get  
the error to come out for key 'KEY' instead of 'IMAGE', but it's  
basically the same problem.  If I break on the code and examine my  
array (the referencedObject), it's an array of dictionaries, with  
keys KEY and IMAGE, as expected, long before the view displays.


Am I missing some best-practices thing, here?  Is there a special  
ordering in which I need to do this stuff?  I swear this worked a  
week ago and I didn't change anything (other than to install the  
new SDK sigh)


I haven't tried to use NSCollectionView since, maybe, 10.5.4, but it  
used to be horribly flawed and may still be.

[snip]
Now I may be maligning NSCollectionView, but my conclusion at the  
time (based on this and the class's other faults, and its truly  
unenlightening documentation) that NSCollectionView is a class to be  
avoided.



I'm ok with that.

What's the preferred way to show a bunch of images and allow the user  
to select one?  :)


___

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

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

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

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


Re: Weird race condition affecting bindings.

2009-06-11 Thread Quincey Morris

On Jun 11, 2009, at 10:35, Mac First wrote:

What's the preferred way to show a bunch of images and allow the  
user to select one?  :)


Possibly IKImageBrowser? I've only worked through its tutorial, never  
used it for real, so I don't know if it jumps off the same cliff that  
NSCollectionView does.



___

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

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

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

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


Re: Doc kind from extension

2009-06-11 Thread Bill Monk


On Jun 11, 2009, at 11:55 AM, Sidney San Mart?n wrote:


That'll work in most cases, but as discussed in
http://lists.apple.com/archives/carbon-dev/2007/Nov/msg00642.html
anything that Preview can open will just return Preview Document for  
that call.


I just double-checked - I have an app that uses LSCopyKindStringForRef  
extensively and knew I'd never seen this problem under any version of  
Leopard. However the app doesn't use LSCopyKindStringForTypeInfo at all.


Under 10.5.7 here,  LSCopyKindStringForRef does work fine for files  
which can be opened by Preview. LSCopyKindStringForTypeInfo does  
incorrectly return Preview Document for .jpg, .pdf, etc, as noted in  
the post you mentioned.


Since the OP has the file extension, presumably (hopefully) they have  
or can get paths and FSRefs and could work around the issue with  
LSCopyKindStringForRef.

___

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

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

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

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


Get application path by Bundle ID

2009-06-11 Thread Mr. Gecko
Hello, I'm trying to find a way to find an application path by the ID  
of the application. For an example if I wanted to find iTunes I give  
it the id of com.apple.iTunes and it gives me the path.


Thanks for any tips/help,
Mr. Gecko
___

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

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

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

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


Re: Get application path by Bundle ID

2009-06-11 Thread Dave DeLong

-[NSWorkspace absolutePathForAppBundleWithIdentifier:];

Cheers,

Dave

On Jun 11, 2009, at 11:14 AM, Mr. Gecko wrote:

Hello, I'm trying to find a way to find an application path by the  
ID of the application. For an example if I wanted to find iTunes I  
give it the id of com.apple.iTunes and it gives me the path.


Thanks for any tips/help,
Mr. Gecko

___

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

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

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

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


Re: Get application path by Bundle ID

2009-06-11 Thread Mr. Gecko
Thanks, I thought it might be in NSWorkSpace but I kept looking into  
NSBundle.


On Jun 11, 2009, at 1:15 PM, Dave DeLong wrote:


-[NSWorkspace absolutePathForAppBundleWithIdentifier:];

Cheers,

Dave

On Jun 11, 2009, at 11:14 AM, Mr. Gecko wrote:

Hello, I'm trying to find a way to find an application path by the  
ID of the application. For an example if I wanted to find iTunes I  
give it the id of com.apple.iTunes and it gives me the path.


Thanks for any tips/help,
Mr. Gecko


___

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

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

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

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


Re: Photoshop plugin with Cocoa UI problems

2009-06-11 Thread Frederik Slijkerman

Hi Scott,

I was calling [NSApp stopModal] instead of abortModal. I did verify 
though that the modal loop stopped, and the original [NSApp 
runModalForWindow] call returned, finally returning to Photoshop. But 
perhaps there is a difference between stopModal and abortModal here.


Best regards,
Frederik Slijkerman


Scott Andrew wrote:
What doesn't make sense is that the plugin i worked on was modal (it was 
an export plugin). What I noticed in our window does is a call 
abortModal on the windowWIllClose notification. From what i can see, 
from the messages in your original post, it looks like you are still in 
the modal loop. Putting the notification there allows the window to 
handle when [window close] is called.


Scott

___

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

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

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

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


Re: Passing References During Initialization / Nib Loading

2009-06-11 Thread Kyle Sluder
On Thu, Jun 11, 2009 at 11:52 AM, Brad Gibbsbradgi...@mac.com wrote:
 Is there something I'm missing?

It sounds like you're going about it wrong.  Create outlets on your
objects and wire them up to your window controller, which should be
the File's Owner of the nib.  No passing references required.

--Kyle Sluder
___

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

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

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

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


Re: App does not start on a different machine

2009-06-11 Thread Bill Monk
The debugging suggestions made so far in this thread are fine. But  
really, the only debugging tool needed here is your mind. Developing  
that tool is the quickest route to fixing bugs like this.



11.06.09 04:24:30 test[767] *** -[NSCFArray objectAtIndex:]: index  
(0) beyond bounds (0)
11.06.09 04:24:30 test[767] *** Terminating app due to uncaught  
exception 'NSRangeException', reason: '*** -[NSCFArray  
objectAtIndex:]: index (0) beyond bounds (0)'


This is a huge hint as to what the trouble is. You may not see it at  
the moment, but in time you will - if you learn how to think it  
through. Right now, you're not really thinking about it (no offense  
intended), you're just trying stuff, hoping something fixes it, and  
when that doesn't work, posting requests for help without including  
enough detail for anyone to help you. The trouble is not the bug in  
your code (everyone creates bugs, and this one is easy) it's the bug  
in your thinking about the bug.




So how can I find the array call that leads to this?



Cmd-Shift-F, type objectAtIndex, make sure the search options popup  
is set to In Project, hit Return. In the resulting list, look at  
each found occurrence of objectAtIndex. Option-click on  
objectAtIndex to bring up its docs. Re-read them. Re-read your code.  
See see where you might be using objectAtIndex incorrectly.


If you don't see the problem with your usage of objectAtIndex, post  
the code here so others can see it.



You've said your app is pretty simple. Any occurrences of  
objectAtIndex: were likely put there by you. Look at each one and  
examine how you use it. Re-read the documentation for objectAtIndex  
and consider if anything you do might be out of accord with the docs  
you read.


If by chance you don't find any occurrences of objectAtIndex, look at  
all your other usage of NSArray/CFArray and think about what might  
happen if any of them happened to invoke objectAtIndex with the values  
you pass. Could your values trigger any problems?


Failing that, look at every line you've written. Your program is small  
and simple. Work out what will happen on each line as the program runs.



___

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

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

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

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


Re: Passing References During Initialization / Nib Loading

2009-06-11 Thread Brad Gibbs
Well, I've got about 20+ different view controllers  I was trying  
to avoid dropping all of those into the main window controller's nib  
file.  Maybe that's what I need to do, though.


I was taking self.view.window.windowController, which was working  
fine, as long as it was being called after awakeFromNib.



On Jun 11, 2009, at 11:58 AM, Kyle Sluder wrote:


On Thu, Jun 11, 2009 at 11:52 AM, Brad Gibbsbradgi...@mac.com wrote:

Is there something I'm missing?


It sounds like you're going about it wrong.  Create outlets on your
objects and wire them up to your window controller, which should be
the File's Owner of the nib.  No passing references required.

--Kyle Sluder


___

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

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

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

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


Re: Passing References During Initialization / Nib Loading

2009-06-11 Thread Brad Gibbs
Also, if I drop an object into the MainWindowController's nib file and  
that object is also the File's Owner for another nib file, won't the  
awakeFromNib method for that object be called twice?  I'm doing some  
fetching in awakeFromNib methods to fetch information that needs to  
load as the view is loading, so, I'd effectively be performing each  
fetch twice, wouldn't I?



Thanks.


On Jun 11, 2009, at 12:45 PM, Brad Gibbs wrote:

Well, I've got about 20+ different view controllers  I was  
trying to avoid dropping all of those into the main window  
controller's nib file.  Maybe that's what I need to do, though.


I was taking self.view.window.windowController, which was working  
fine, as long as it was being called after awakeFromNib.



On Jun 11, 2009, at 11:58 AM, Kyle Sluder wrote:

On Thu, Jun 11, 2009 at 11:52 AM, Brad Gibbsbradgi...@mac.com  
wrote:

Is there something I'm missing?


It sounds like you're going about it wrong.  Create outlets on your
objects and wire them up to your window controller, which should be
the File's Owner of the nib.  No passing references required.

--Kyle Sluder


___

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

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

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

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


___

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

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

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

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


Re: Passing References During Initialization / Nib Loading

2009-06-11 Thread Quincey Morris

On Jun 11, 2009, at 11:52, Brad Gibbs wrote:

In short, I need a more reliable way to pass references to my  
MainWindowController into objects that are awaking from nib files.   
Trying to set the mMainWindowController variable to  
self.view.window.windowController in the awakeFromNib method seems  
to be happening before the MainWindowController is instantiated, so,  
it sets the variable to NULL.


I need to call a method in the MainWindowController to switch  
views / viewControllers, passing in the new viewController as an  
argument.  I can set the mainWindowController variable in the method  
that actually invokes the view switch, but that seems clunky.  It  
seems like there should be a method I can call to set the variable  
once the view controller has awoken and the app has fully loaded.   
initWithCoder and awakeFromNib happen too soon and  
applicationDidFinishLaunching only gets sent to the app delegate.


You haven't really described how things are arranged, in a way that we  
can understand. You have a window controller, plus a view controller  
for each set of controls/objects in its own nib file? How do the view  
controllers get created?


As Kyle said, to avoid having to manually resolve the timing of when  
instance variable can be set in objects loaded from nib files, you  
should use outlets instead of instance variable in objects coming from  
nib files. I think your mistake is trying to connect directly to the  
window controller across multiple nibs. Probably the correct solution  
involves putting a 'main window controller' property in each view  
controller, and putting a mViewController reference in the nib  
objects. Then you'd refer to the main window controller as  
mViewController.mainWindowController (or whatever).


If your view controllers are being created programmatically, you'd  
pass the window controller as a parameter when creating them. If, for  
some reason, you have the view controllers in your main window nib  
file, then you'd use outlets to connect them to the main window  
controller.


But that's all guesswork, without further information.


___

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

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

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

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


Re: Frame Origin Problem

2009-06-11 Thread Chunk 1978
should this code work?  if there don't appear to be any errors i'm
concerned it may be a bug, but i can't be sure.  :-/

On Thu, Jun 11, 2009 at 7:15 AM, Chunk 1978chunk1...@gmail.com wrote:
 while dragging (touching) a view, i'm trying to anchor the view in the
 center of the screen and resize the view's width and height based on
 the drag, but it's flashes all crazy and i can't figure out why it's
 doing so.  i think it has to do with the resetting of the origin
 because if i set the origin of the view to a static location in the
 (void)touchesMoved method, it works fine, but since the drag resizes
 the view, it also (is suppose to) changes it's origin.  i've been in
 front of this for 4 hours with no luck.  please help.

 -=-=-=-=-=--=-
 - (void)viewDidLoad
        {
        CGRect fullScreenRect = [[UIScreen mainScreen] bounds];

        UIView *aView = [[UIView alloc] initWithFrame:fullScreenRect];
        aView.backgroundColor = [UIColor redColor];
        self.background = aView;
        [aView release];

        CGRect aFrame = CGRectMake(0, 0, 50, 50);
        aFrame.origin = CGPointMake(CGRectGetMidX(fullScreenRect) -
 CGRectGetMidX(aFrame), CGRectGetMidY(fullScreenRect) -
 CGRectGetMidY(aFrame));

        UIView *aBoxView = [[UIView alloc] initWithFrame:aFrame];
        aBoxView.backgroundColor = [UIColor whiteColor];
        self.boxView = aBoxView;
        [aBoxView release];

        [self.view insertSubview:background atIndex:0];
        [self.view insertSubview:boxView atIndex:1];

        [super viewDidLoad];
        }


 - (void)dealloc
        {
        [background release];
        [boxView release];
        [super dealloc];
        }


 #pragma mark Touch Methods

 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
        {
        CGPoint point = [[touches anyObject] locationInView:self.view];
        firstTouchPoint = point;
        }

 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
        {
        CGRect fullScreenRect = [[UIScreen mainScreen] bounds];

        CGPoint point = [[touches anyObject] locationInView:self.view];
        CGRect boxFrame = boxView.frame;

        boxFrame.size.width += point.x - firstTouchPoint.x;
        boxFrame.size.height += point.y - firstTouchPoint.y;
        boxFrame.origin = CGPointMake(CGRectGetMidX(fullScreenRect) -
 CGRectGetMidX(boxFrame), CGRectGetMidY(fullScreenRect) -
 CGRectGetMidY(boxFrame));

        [boxView setFrame:boxFrame];
        firstTouchPoint = point;

        NSString *log = [NSString stringWithFormat:@%f, %f,
 boxFrame.origin.x, boxFrame.origin.y];
        NSLog(log);
        }

 -=-=-=-=-=-=-=-

___

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

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

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

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


Re: App does not start on a different machine

2009-06-11 Thread Andy Lee
On Thursday, June 11, 2009, at 03:01PM, Bill Monk billm...@mac.com wrote:
Cmd-Shift-F, type objectAtIndex, make sure the search options popup  
is set to In Project, hit Return. In the resulting list, look at  
each found occurrence of objectAtIndex. Option-click on  
objectAtIndex to bring up its docs. Re-read them. Re-read your code.  
See see where you might be using objectAtIndex incorrectly.

If you don't see the problem with your usage of objectAtIndex, post  
the code here so others can see it.


You've said your app is pretty simple. Any occurrences of  
objectAtIndex: were likely put there by you.

Well, possibly but not necessarily.  There are all sorts of places where Cocoa 
calls objectAtIndex: internally, and Martin may have directly or indirectly 
caused the array in question to have fewer elements than expected.  It may not 
even be an array he explicitly created.  Furthermore, I would submit that 
eyeballing the code, while a good exercise for other reasons, is less efficient 
than deterministically finding *which* array is being accessed by which line of 
code.  Guesswork (either by Martin or by us) is not required.

Multiple ways to do this have been suggested -- print NSLog messages; install 
Xcode and use the debugger; turn on NSZombieEnabled (which may not lead to the 
line of code that's crashing, but even better might lead to the line of code 
that *causes* the crash).  I don't see any point in offering further advice 
when none of the advice already given (including post the code) has been 
tried AFAWK.

--Andy

___

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

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

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

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


trimbox and bleedbox from PDF

2009-06-11 Thread gMail.com
Hi,
I would need to get the trimbox rect and bleedbox rect from a pdf document.
Is anyone who can point me to the right APIs and procedures? Thanks.


Best Regards
--
LL


___

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

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

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

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


Re: self Changes on Open Panel [solved]

2009-06-11 Thread K. Darcy Otto
I want to thank Fritz, Greg, Quincy and Uli for their help solving  
this problem.  I don't think there is any general solution to this  
problem, but I wanted to make two remarks that might help others who  
run into something similar.


(i) It turned out that i did have two different MyDocument objects.   
The second was being instantiated by MainMenu.xib.  I actually checked  
the other .xib files looking for a MyDocument object, and turned up  
nothing; but I didn't think to look at MainMenu.xib.


(ii) I tracked down the problem by creating a breakpoint at - 
[MyDocument init].  This led me to search every .xib looking for an  
instantiated MyDocument.


I am a bit puzzled about one thing: I did put an NSLog at the  
beginning of the -init method, with a view to determining when the  
second MyDocument object was being instantiated.  But, the NSLog fired  
only once.  As many have pointed out, the object could be created with  
an -initWithCoder, so the NSLog would be skipped (presumably this is  
what happened when the .xib instantiated the object).  But if this  
reasoning is correct, why, then, would -[MyDocument init] as a  
breakpoint stop the code twice?  I mean, it shouldn't stop the code  
when -initWithcoder is called, right?


Anyway, thanks again for all your help.

On 10-Jun-09, at 11:48 AM, Uli Kusterer wrote:


On 09.06.2009, at 17:48, Greg Guerin wrote:

How do you know -init is only run once?

Are you sure no other init method is run?  Like maybe initWithCoder:?



As a general rule, when you wonder where an object is coming from,  
it helps to have a look at any and all -init methods the class has.  
In particular init and initWithCoder:. In addition to that, objects  
can be created by a call to copy or mutableCopy, so you can get very  
interesting behaviour if your base class implements NSCopying and  
you forgot to override that in the subclass and do your own  
additional work.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dotto%40csusb.edu

This email sent to do...@csusb.edu


___

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

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

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

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


Re: How to tell if a Panel is Open [solved]

2009-06-11 Thread K. Darcy Otto
Thanks to those who helped me with this question.  The solution was to  
use NSWindow's -attachedSheet method, and (in my case), check for  
nil.  If nil, there is no attached sheet; if not nil, there is an  
attached sheet.

___

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

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

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

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


UTI not identified correctly for some users.

2009-06-11 Thread Mitchell Livingston
I have created an UTI in my app's Info.plist. For open panels, adding  
files, etc. I use this (or check [[[NSWorkspace sharedWorkspace]  
typeOfFile: file error: NULL] isEqualToString: ...]). This works fine  
for me, but this is failing for the proper file type for some users.  
Perhaps the system doesn't properly register the UTI for these users,  
or perhaps another app registers a different UTI name for the same  
file extension. Is there something I can do to get around this,  
besides not using UTI's?


Cheers,
Mitch
___

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

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

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

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


Re: Passing References During Initialization / Nib Loading

2009-06-11 Thread Brad Gibbs

Hi,

Thanks for the response.  I was trying to make the post short, hoping  
to up my chances of getting someone to read through the entire thing  
and take the time to respond.  I guess I just made it confusing.


So, now for the long(er) version.

I have a single window application.  It's a Core Data, non-document- 
based app.  At launch, the appDelegate loads the mainWindowController,  
which controls the app's only window.  In the main window, there are  
three views -- a status bar across the top, a menu view down the left  
side (Jonathan Dann's Animating Outline View embedded in a view,  
rather than a window) and a content view, which takes up the rest of  
the main window. The mainWindowController loads initial views for  
these containers.


In each section of the menu (the outline view) is a table view with a  
single column, which lists the titles for the view controllers.  For  
the most part, a single view controller controls a single view, which  
is displayed in the content view portion of the main window.  These  
view controllers are subclasses of a custom subclass of  
NSViewController with variables for the main managedObjectContext and  
the mainWindowController.


The method call to remove the view currently in the content view  
portion of the main window and replace it with the new view  
controller's view is in the main window controller.


I had been manually instantiating the view controllers and passing  
references to the main window controller and the main managed object  
context with a custom init method ( initWithMoc: andWindowController:)  
and using these arguments to set variables in the view controllers.   
Today, I decided to try to refactor and clean up some code by  
instantiating the view controllers in nibs, but I ran into the problem  
I'm trying to describe.


Yes, I'm using 10.6, but I think the problem can be abstracted enough  
to be discussed without breaking the NDA.




On Jun 11, 2009, at 1:59 PM, Quincey Morris wrote:


On Jun 11, 2009, at 11:52, Brad Gibbs wrote:

In short, I need a more reliable way to pass references to my  
MainWindowController into objects that are awaking from nib files.   
Trying to set the mMainWindowController variable to  
self.view.window.windowController in the awakeFromNib method seems  
to be happening before the MainWindowController is instantiated,  
so, it sets the variable to NULL.


I need to call a method in the MainWindowController to switch  
views / viewControllers, passing in the new viewController as an  
argument.  I can set the mainWindowController variable in the  
method that actually invokes the view switch, but that seems  
clunky.  It seems like there should be a method I can call to set  
the variable once the view controller has awoken and the app has  
fully loaded.  initWithCoder and awakeFromNib happen too soon and  
applicationDidFinishLaunching only gets sent to the app delegate.


You haven't really described how things are arranged, in a way that  
we can understand. You have a window controller, plus a view  
controller for each set of controls/objects in its own nib file? How  
do the view controllers get created?


As Kyle said, to avoid having to manually resolve the timing of  
when instance variable can be set in objects loaded from nib files,  
you should use outlets instead of instance variable in objects  
coming from nib files. I think your mistake is trying to connect  
directly to the window controller across multiple nibs. Probably the  
correct solution involves putting a 'main window controller'  
property in each view controller, and putting a mViewController  
reference in the nib objects. Then you'd refer to the main window  
controller as mViewController.mainWindowController (or whatever).


If your view controllers are being created programmatically, you'd  
pass the window controller as a parameter when creating them. If,  
for some reason, you have the view controllers in your main window  
nib file, then you'd use outlets to connect them to the main window  
controller.


But that's all guesswork, without further information.


___

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

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

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

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


___

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

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

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

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


Re: UTI not identified correctly for some users.

2009-06-11 Thread Mitchell Livingston
As a followup to this, it appears that the users having problems do  
have a different app set for this file type, so it's not recognizing  
my UTI name for NSOpenPanel's setRequiredType: and NSWorkspace's  
typeOfFile:... Is there a way around this besides specifying the file  
extension explicitly? Should this be reported to Apple?


Cheers,
Mitch

On Jun 11, 2009, at 6:46 PM, Mitchell Livingston wrote:

I have created an UTI in my app's Info.plist. For open panels,  
adding files, etc. I use this (or check [[[NSWorkspace  
sharedWorkspace] typeOfFile: file error: NULL]  
isEqualToString: ...]). This works fine for me, but this is failing  
for the proper file type for some users. Perhaps the system doesn't  
properly register the UTI for these users, or perhaps another app  
registers a different UTI name for the same file extension. Is there  
something I can do to get around this, besides not using UTI's?


Cheers,
Mitch


___

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

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

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

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


Re: Passing References During Initialization / Nib Loading

2009-06-11 Thread Quincey Morris

On Jun 11, 2009, at 15:53, Brad Gibbs wrote:

I had been manually instantiating the view controllers and passing  
references to the main window controller and the main managed object  
context with a custom init method ( initWithMoc:  
andWindowController:) and using these arguments to set variables in  
the view controllers.  Today, I decided to try to refactor and clean  
up some code by instantiating the view controllers in nibs, but I  
ran into the problem I'm trying to describe.


It may just be prejudice, but I'm not a fan of putting window  
controllers or view controllers in nib files. And if your view  
controllers are all in the same nib, you lose the benefit of only  
instantiating the view controllers you need at any given time.  
Nevertheless ...


So you have a single window nib file? And a separate nib file for each  
view that can be displayed in the window content area? Are the view  
controllers in the window nib file? Somewhere else?


I still think the answer is likely to be that the objects in your view  
nib need to use mViewController.mainWindowController instead of  
mMainWindowController, and that your in-nib view controllers need an  
outlet connected to the main window controller (supplying the value of  
the view controller's mainWindowController property) instead of a  
plain instance variable.



___

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

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

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

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


Re: Passing References During Initialization / Nib Loading

2009-06-11 Thread Kyle Sluder
On Thu, Jun 11, 2009 at 3:53 PM, Brad Gibbsbradgi...@mac.com wrote:
 I have a single window application.  It's a Core Data, non-document-based
 app.  At launch, the appDelegate loads the mainWindowController, which
 controls the app's only window.  In the main window, there are three views
 -- a status bar across the top, a menu view down the left side (Jonathan
 Dann's Animating Outline View embedded in a view, rather than a window) and
 a content view, which takes up the rest of the main window. The
 mainWindowController loads initial views for these containers.

It sounds like you've got a standard master-detail interface going on
here.  In this case, the master view typically doesn't change, and so
does not need to exist in a separate nib.  Since your window can't
really exist without that view, you gain nothing by lazily loading it.
 Same with the status bar.

 In each section of the menu (the outline view) is a table view with a single
 column, which lists the titles for the view controllers.  For the most part,
 a single view controller controls a single view, which is displayed in the
 content view portion of the main window.  These view controllers are
 subclasses of a custom subclass of NSViewController with variables for the
 main managedObjectContext and the mainWindowController.

NSViewController has a representedObject binding.  You should add a
property to your window controller called managedObjectContext and set
up your view controllers such that their represented object is the
window controller.  This is what we do in document-based applications,
except we have the extra step of going through the window controller
to get to the persistent document's managedObjectContext property.

 The method call to remove the view currently in the content view portion of
 the main window and replace it with the new view controller's view is in the
 main window controller.

Method Call means?  Are you saying your window controller subclass
has a method that looks something like -switchToContentViewController:
?  Because that's exactly what you should be doing.

 I had been manually instantiating the view controllers and passing
 references to the main window controller and the main managed object context
 with a custom init method ( initWithMoc: andWindowController:) and using
 these arguments to set variables in the view controllers.  Today, I decided
 to try to refactor and clean up some code by instantiating the view
 controllers in nibs, but I ran into the problem I'm trying to describe.

The view controllers are very similar to window controllers.  They
should be the File's Owner of the nibs.  You instantiate the view
controllers in your window controller's initializer (the view
controller takes care of lazily loading its nib).

Put all this together and your view controller subclasses (if you even
need to subclass them) don't need to have a reference the view
controller.  The standard -[NSViewController representedObject]
property will be more than sufficient to get from your view controller
or view objects back at both your window controller and its MOC.

 Yes, I'm using 10.6, but I think the problem can be abstracted enough to be
 discussed without breaking the NDA.

There's nothing substantively different about this on 10.6 than on
10.5.  If you're at WWDC, hit me up and I'll explain in person.  Ask
anyone in an Omni jacket if they've seen me.

--Kyle Sluder
___

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

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

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

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


Re: Passing References During Initialization / Nib Loading

2009-06-11 Thread Brad Gibbs

hmm...  Sounds like a clever solution.


On Jun 11, 2009, at 4:30 PM, Kyle Sluder wrote:


On Thu, Jun 11, 2009 at 3:53 PM, Brad Gibbsbradgi...@mac.com wrote:
I have a single window application.  It's a Core Data, non-document- 
based
app.  At launch, the appDelegate loads the mainWindowController,  
which
controls the app's only window.  In the main window, there are  
three views
-- a status bar across the top, a menu view down the left side  
(Jonathan
Dann's Animating Outline View embedded in a view, rather than a  
window) and

a content view, which takes up the rest of the main window. The
mainWindowController loads initial views for these containers.


It sounds like you've got a standard master-detail interface going on
here.  In this case, the master view typically doesn't change, and so
does not need to exist in a separate nib.  Since your window can't
really exist without that view, you gain nothing by lazily loading it.
Same with the status bar.


It does sound like a fairly standard master-detail view, although the  
menu items in each view of the animating outline view (the number of  
view controllers and views) will change at runtime.  Is your  
suggestion predicated upon having the menu view in the main window  
controller's nib?  If so, I'll have to look at this more closely to  
figure out how to make it happen.  The animating outline view code  
loads the viewControllers in code, rather than using nib files.




In each section of the menu (the outline view) is a table view with  
a single
column, which lists the titles for the view controllers.  For the  
most part,
a single view controller controls a single view, which is displayed  
in the

content view portion of the main window.  These view controllers are
subclasses of a custom subclass of NSViewController with variables  
for the

main managedObjectContext and the mainWindowController.


NSViewController has a representedObject binding.  You should add a
property to your window controller called managedObjectContext and set
up your view controllers such that their represented object is the
window controller.  This is what we do in document-based applications,
except we have the extra step of going through the window controller
to get to the persistent document's managedObjectContext property.


When / where do I set the representedObject?  I don't see an exposed  
binding for representedObject in IB and if I don't set it in IB, it  
seems as though I'm back to the chicken-or-egg problem I'm try to work  
my way out of...




The method call to remove the view currently in the content view  
portion of
the main window and replace it with the new view controller's view  
is in the

main window controller.


Method Call means?  Are you saying your window controller subclass
has a method that looks something like -switchToContentViewController:
?  Because that's exactly what you should be doing.


Yes, that's what I meant.




I had been manually instantiating the view controllers and passing
references to the main window controller and the main managed  
object context
with a custom init method ( initWithMoc: andWindowController:) and  
using
these arguments to set variables in the view controllers.  Today, I  
decided

to try to refactor and clean up some code by instantiating the view
controllers in nibs, but I ran into the problem I'm trying to  
describe.


The view controllers are very similar to window controllers.  They
should be the File's Owner of the nibs.  You instantiate the view
controllers in your window controller's initializer (the view
controller takes care of lazily loading its nib).

Put all this together and your view controller subclasses (if you even
need to subclass them) don't need to have a reference the view
controller.  The standard -[NSViewController representedObject]
property will be more than sufficient to get from your view controller
or view objects back at both your window controller and its MOC.



Don't need a reference to the view controller?  or the main window  
controller?




Yes, I'm using 10.6, but I think the problem can be abstracted  
enough to be

discussed without breaking the NDA.


There's nothing substantively different about this on 10.6 than on
10.5.  If you're at WWDC, hit me up and I'll explain in person.  Ask
anyone in an Omni jacket if they've seen me.

--Kyle Sluder


___

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

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

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

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


Displaying an offset image.

2009-06-11 Thread Mac First

I have a 500x500 image.  It's really a 5x5 array of 100x100 image tiles.

I have a 100x100 NSView, imageParentView.

I have a 500x500 NSImageView (image well in IB), imageView that is  
a subview of imageParentView and which holds my image.


I'd like to display the 3rd tile in the 2nd row, so it shows through  
imageParentView.


This code...

NSRect iviewFrame = [imageView frame];
iviewFrame.origin.x = 300;
iviewFrame.origin.y = 200;
[imageView setFrame:iviewFrame];
NSLog(@frame origin: %0.1f, %0.1f, [imageView frame].origin.x,  
[imageView frame].origin.y);


...Didn't do what I had hoped.  (As far as I can tell, it moves my  
parent view off-screen.  I'm not 100% sure about that, but the framing- 
view -- which I assume is imageParentView -- disappears.)


Am I close?  Hints?  Is there a tutorial for this?

Thanks!

___

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

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

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

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


Re: trimbox and bleedbox from PDF

2009-06-11 Thread John Calhoun

On Jun 11, 2009, at 2:55 PM, gMail.com wrote:
I would need to get the trimbox rect and bleedbox rect from a pdf  
document.

Is anyone who can point me to the right APIs and procedures? Thanks.


You want to create either a PDFDocument (part of PDF Kit .. Cocoa) or  
a CGPDFDocumentRef (CoreGraphics ... straight C).  From there get  
either a PDFPage (PDF Kit) or CGPDFPageRef (CoreGraphics) — both have  
methods/functions then to get the trim and bleed boxen.


John Calhoun—___

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

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

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

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


Re: Displaying an offset image. (SOLVED)

2009-06-11 Thread Mac First


Sheesh!  I'm sorry -- I guess I just need to learn to read.

---

Translates the receiver’s coordinate system so that its origin moves  
to a new location.


	[I stopped reading here and got confused.  The Discussion section  
explains all.]

- (void)translateOriginToPoint:(NSPoint)newOrigin

Parameters newOrigin
A point that specifies the new origin.

Discussion
In the process, the origin of the receiver’s bounds rectangle is  
shifted by (–newOrigin.x, –newOrigin.y). This method neither  
redisplays the receiver nor marks it as needing display. You must do  
this yourself with display or setNeedsDisplay:.


Note the difference between this method and setting the bounds origin.  
Translation effectively moves the image inside the bounds rectangle,  
while setting the bounds origin effectively moves the rectangle over  
the image. The two are in a sense inverse, although translation is  
cumulative, and setting the bounds origin is absolute.


---

The working code is:

NSRect iviewBounds = imageView.bounds;
iviewBounds.origin.x = xStart;
iviewBounds.origin.y = yStart;
[imageView setBounds:iviewBounds];

My apologies for the spam to list.  Hopefully, this will help some  
future archive spelunker.


--
When you scold a dog for chewing your sofa, he's sorry he chewed your  
sofa.  When you scold a wolf for chewing your sofa, he's sorry you  
have such an unhealthy attachment to your sofa.




___

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

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

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

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


Re: Get|SetControlProperty() equivalent

2009-06-11 Thread Peter N Lewis

On 11/06/2009, at 18:41 , Jo Meder wrote:
It would be great to be able to do this for NSViews but I haven't  
been able to find any equivalent. Are there any ingenious ways that  
you might be aware of so I could bolt this on to NSView?


I have yet to find a good solution to this.

It would be fantastic if NSView had an NSDictionary field and  
Interface Builder let you set values in the dictionary.  Given the  
pain of writing Interface Builder plugins, this would be a much easier  
solution to a bunch of problems where you want a custom view to have  
some configuration.


The only vaguely approximate thing is the tag field in NSControl,  
which you can subvert for some purposes, but it is very limited.


I'm trying to avoid setting up a map from NSViews to UI framework  
objects, but I suspect it will be inevitable. Not really a big deal,  
but less hassle to be able to associate the data directly so that  
would be a preferable solution.


The only alternative I could see would be to create a global  
NSDictionary mapping NSView* to UI framework objects, use message  
swizzling on NSView to swap out its init and dealloc methods,  and add  
a category on NSView to access the UI framework objects via the global  
dictionary.  Slightly ugly to write and then trivial to use.  You  
probably don't need to swizzle the init methods, just create the  
global dictionary entry on demand as necessary, but you do need to  
swizzle the dealloc method to know when to get rid of the entry.


Enjoy,
   Peter.

--
 Clipboard Switching and Macros with Keyboard Maestro

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac
http://www.stairways.com/   http://download.stairways.com/



___

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

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

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

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


UINavigationController for desktop Cocoa?

2009-06-11 Thread Houdah - ML Pierre Bernard

Hi!

Has anyone already re-implemented UINavigationController for desktop  
Cocoa. That should be a cool thing to have.


Pierre

- - -
Houdah Software s. à r. l.
http://www.houdah.com

HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend



___

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

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

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

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


Questions on using using modal sheets with Core Data

2009-06-11 Thread Kevin Ross
Hi all, have a Core Data document based application which uses modal  
sheets as a way for the user to edit the document's data.  What is the  
best way to give the sheet the ability to operate on a copy of the  
data with the parents sheet's undo context?  And how best to merge  
these changes with the main document context.


I've thought of having a unique MOC for each sheet, and then posting a  
custom notification that would in turn cause each MOC to perform  
something like:


for (id object in [managedObjectContext registeredObjects]) {
[managedObjectContext refreshObject:object
   mergeChanges:YES];
}

Does this way make any sense?  Is there a better way to do this that  
I'm missing?


Thanks for any pointers!

Kevin


___

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

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

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

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


Re: Questions on using using modal sheets with Core Data

2009-06-11 Thread Kevin Ross
Jeez, I forgot to explain that posting the notification would happen  
when the user accepts the changes made in the modal window.  I hope it  
make a little more sense now.


Thanks,

Kevin



On Jun 11, 2009, at 7:03 PM, Kevin Ross wrote:

Hi all, have a Core Data document based application which uses modal  
sheets as a way for the user to edit the document's data.  What is  
the best way to give the sheet the ability to operate on a copy of  
the data with the parents sheet's undo context?  And how best to  
merge these changes with the main document context.


I've thought of having a unique MOC for each sheet, and then posting  
a custom notification that would in turn cause each MOC to perform  
something like:


for (id object in [managedObjectContext registeredObjects]) {
[managedObjectContext refreshObject:object
   mergeChanges:YES];
}

Does this way make any sense?  Is there a better way to do this that  
I'm missing?


Thanks for any pointers!

Kevin


___

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

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

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

This email sent to apple-li...@twentyfourmountains.com



___

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

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

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

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


Re: Passing References During Initialization / Nib Loading

2009-06-11 Thread Quincey Morris

On Jun 11, 2009, at 18:05, Brad Gibbs wrote:

Why not just use a singleton [[MainWindowController  
sharedWindowController] switchToView:[menuItems objectAtIndex: 
[menuItemsArrayController selectionIndex]] ?


There's nothing wrong with that approach, though it's not perhaps what  
might be understood as a singleton. You happen to have only a single  
main window controller, and propose having a class method to get it,  
that's all. Singleton usually suggests code within the singleton's  
class to actively prevent other instances being created by unruly  
client code. That's not necessary here.


The only drawback with making your main window controller global, and  
it's perhaps a fairly theoretical concern, is that one of the benefits  
of encapsulating parts of your interface (such as multiple view nib  
files) is the elimination of global relationships that hamstring your  
code. Localizing the relationships makes the pieces easier to put  
together safely. In a way, this entire thread has been about the  
difficulty of accommodating a global reference across your entire  
application design.



___

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

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

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

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


NSFontPanelValidation broken?

2009-06-11 Thread David Reitter

Why does the following not have the desired effect?

- (unsigned int) validModesForFontPanel:(NSFontPanel *)fontPanel
{
  /* This doesn't work as intended.  Why?  Bug? */
  return (NSFontPanelFaceModeMask |
  NSFontPanelSizeModeMask |
  NSFontPanelCollectionModeMask  |
  NSFontPanelTextColorEffectModeMask  |
  NSFontPanelDocumentColorEffectModeMask);

}

I can't seem to show the color buttons explicitly, and removing, for  
instance, NSFontPanelStrikethroughEffectModeMask or  
NSFontPanelUnderlineEffectModeMask simply doesn't work right (usually,  
an underline popup is shown in the panel, but the text color effect  
button is hidden).


Is NSFontPanel simply buggy even in 10.5, or am I missing something  
here?


This works as designed:

return  NSFontPanelAllModesMask- NSFontPanelShadowEffectModeMask;

but of course that's not really what I want to do.

PS.: please cc me in replies.
___

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

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

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

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


Re: Questions on using using modal sheets with Core Data

2009-06-11 Thread Dave Fernandes

This is explained in the NSPersistentDocument tutorial in the docs.

On Jun 11, 2009, at 10:03 PM, Kevin Ross wrote:

Hi all, have a Core Data document based application which uses modal  
sheets as a way for the user to edit the document's data.  What is  
the best way to give the sheet the ability to operate on a copy of  
the data with the parents sheet's undo context?  And how best to  
merge these changes with the main document context.


I've thought of having a unique MOC for each sheet, and then posting  
a custom notification that would in turn cause each MOC to perform  
something like:


for (id object in [managedObjectContext registeredObjects]) {
[managedObjectContext refreshObject:object
   mergeChanges:YES];
}

Does this way make any sense?  Is there a better way to do this that  
I'm missing?


Thanks for any pointers!

Kevin


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes%40utoronto.ca

This email sent to dave.fernan...@utoronto.ca


___

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

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

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

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


Re: UINavigationController for desktop Cocoa?

2009-06-11 Thread Luke the Hiesterman
Seems a little weird on the desktop. The whole point of the  
navigationController is to provide a solution to the problem that a  
small phone screen isn't good at showing more than one task at a time.  
We don't really have that problem on the desktop.what exactly do  
you want to do?


Luke

On Jun 11, 2009, at 6:38 PM, Houdah - ML Pierre Bernard wrote:


Hi!

Has anyone already re-implemented UINavigationController for desktop  
Cocoa. That should be a cool thing to have.


Pierre

- - -
Houdah Software s. à r. l.
http://www.houdah.com

HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend



___

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

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

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

This email sent to luket...@apple.com


___

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

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

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

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


Re: UINavigationController for desktop Cocoa?

2009-06-11 Thread Kevin Callahan


On Jun 11, 2009, at 6:38 PM, Houdah - ML Pierre Bernard wrote:


Hi!

Has anyone already re-implemented UINavigationController for desktop  
Cocoa. That should be a cool thing to have.


Pierre


Tweetie?
http://www.atebits.com/tweetie-mac/
http://www.atebits.com/tweetie-mac/teaser.html

Kevin
http://www.kevincallahan.org/software/accessorizer.html




- - -
Houdah Software s. à r. l.
http://www.houdah.com

HoudahGeo: One-stop photo geocoding
HoudahSpot: Powerful Spotlight frontend



___

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

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

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

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



___

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

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

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

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


Re: NSFontPanelValidation broken?

2009-06-11 Thread Quincey Morris

On Jun 11, 2009, at 20:20, David Reitter wrote:


Why does the following not have the desired effect?

- (unsigned int) validModesForFontPanel:(NSFontPanel *)fontPanel
{
 /* This doesn't work as intended.  Why?  Bug? */
 return (NSFontPanelFaceModeMask |
  NSFontPanelSizeModeMask |
  NSFontPanelCollectionModeMask  |
  NSFontPanelTextColorEffectModeMask  |
  NSFontPanelDocumentColorEffectModeMask);

}

I can't seem to show the color buttons explicitly, and removing, for  
instance, NSFontPanelStrikethroughEffectModeMask or  
NSFontPanelUnderlineEffectModeMask simply doesn't work right  
(usually, an underline popup is shown in the panel, but the text  
color effect button is hidden).


Is NSFontPanel simply buggy even in 10.5, or am I missing something  
here?


This works as designed:

return  NSFontPanelAllModesMask- NSFontPanelShadowEffectModeMask;

but of course that's not really what I want to do.


FWIW, your return type is wrong -- it should be NSUInteger, though  
that wouldn't make a difference unless your app was 64-bit.



___

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

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

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

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