Parsing xml files in Cocoa applications

2008-10-30 Thread Arnab Ganguly
Hi All,
How do I read, parse xml files in Cocoa App ?Any standard parser is
available?
Thanks in advance
Regards
Arnab
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: inter-object communication

2008-10-30 Thread Nicko van Someren

On 29 Oct 2008, at 06:30, Charles Steinman wrote:

From: Albert Jordan [EMAIL PROTECTED]

What is the recommended way for Object B to inform Object A that it  
is

done processing a request for the following scenario?

Object A has a list of phone numbers to send SMS messages
Object B implements sending an SMS message to a given phone number
I think a delegate is the usual Cocoa pattern for this kind of  
situation. You could have Object B send Object A an - 
objectB:didSendSMSMessage:toNumber: message or something along those  
lines.


A delegate certainly seems to be the appropriate model here; delegates  
work well when there is usually one, and never more than one, object  
interested in the information.  If you have a situation where there  
might well me more than one or less than one interested object (e.g.  
object B noticed that the phone that might send the message has been  
disconnected) then posting a notification might be a better model; any  
interested party can then subscribe to that notification.


Cheers,
Nicko

___

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

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

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

This email sent to [EMAIL PROTECTED]


interface builder and nsarraycontroller binding newbie question

2008-10-30 Thread Bob Henkel
Hello,

I'm pretty new to the OSX and really new to Cocoa.

With the disclaimer aside

For one my first learning projects I started to follow a tutorial that
has me making use of a nsarraycontroller in IB and using bindings to
bind an nsarraycontroller to a Employee class I created.

CLASS Employee
name
salary
-(void)giveRandomSalary

I first setup my nsarraycontroller to the Employee class and then bind
the name and salary values to an nstableview with two columns. I also
added two buttons to the window a insert and a delete button. These
are used to invoke the nsarraycontroller's add and delete methods to
add and remove Employee objects contained in nsarraycontroller.  This
all works just fine and makes sense.

What I want to do now is invoke a method on the object I have selected
in nstableview by clicking a third button labeled Random Salary which
will call the method giveRandomSalary that I created in my Employee
class. The job of this method is just to set the Salary to a random
value. My issue is how do I invoke the method for the Employee object
?  Hopefully I'm not to far off path with what I'm trying to do. Any
help would be great.

Thanks
Bob
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-30 Thread Dave Geering
 From your original implementation of putting the metadata directly into the 
 PDF file, you'll now end up with obviously a proprietary file.  i.e. No 
 application that works with PDF will be able to work with that file.

That is not at all true. You can embed the data into a PDF stream but
never reference it. You'll have to check for an available stream ID
and also correct the cross reference table. You could in fact leave
the original cross reference table intact, add a new stream with your
metadata after the original %%EOF marker, construct the
cross-reference table with only one entry (the stream containing the
metadata), and adding another %%EOF marker. This is perfectly legit
PDF and in fact is the recommended way to use incremental updates as
per page 70 of the PDF reference.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problem with NSData to NSString to NSData

2008-10-30 Thread Jeff Dutky
On Wed, Oct 29, 2008 at 4:46 PM, Joel Norvell [EMAIL PROTECTED] wrote:
 Dear Cocoa-dev People,

 First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the 
 problem with my NSData-NSString-NSData approach.

 As an alternative, would it be fruitful to use a Directory Wrapper to 
 represent the data as two files; one the metadata and the other the pdf?  
 Then I could work with the metadata file, but just display the pdf file.

 In the What could go wrong here? department, would my compound file end up 
 behaving like a directory (or worse)?

Better yet, why not just insert the metadata into the PDF directly as comments?
The PDF format is basically a postscript file (with some missing
features and, I think, optional compression) and you should be able to
insert comments (lines starting with %%) after the first line (which
is a required header comment) with no problem.

Reliably detecting PDF files that contain your meta data and
extracting it may be a bit of a challenge, in the general case, but
not really all that hard. Before writing a lot of custom code to do
this, I'd have a look at the documentation for PDFKit and PDFDocument.

you can get references on the PDF format here:

http://www.adobe.com/devnet/pdf/pdf_reference_archive.html

-- Jeff Dutky
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing xml files in Cocoa applications

2008-10-30 Thread Nick Zitzmann


On Oct 29, 2008, at 3:28 AM, Arnab Ganguly wrote:


How do I read, parse xml files in Cocoa App ?Any standard parser is
available?



Did you see the documentation for the NSXML family of classes?

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Is there an equivalent to std::min/std::max for Cocoa programmer's

2008-10-30 Thread Michael A. Crawford

Done.  See radar 6331394.

-Michael

On Oct 29, 2008, at 1:27 PM, Nick Zitzmann wrote:



On Oct 29, 2008, at 5:19 PM, Michael A. Crawford wrote:

Thank you.  I did try to find these using the help feature in Xcode  
and the documentation that is included with Xcode but I did not get  
a hit.  I also tried spotlight but no-joy.  What is the best way to  
find equivalent methods like these?


AFAICT, those macros aren't documented. File a bug report.

Most of my experience is in coding for POSIX/Linux/Unix and  
Win32/.NET.  Though I could have included the C++ standard library,  
I think it is probably wise not to mix this with Cocoa.



You can use the C++ standard library in Cocoa if you wish, but you  
must use ObjC++ if you do so.


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





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

A way to disable all tooltips in an Application?

2008-10-30 Thread Vijay Malhan
Hello All,
Is there a way to disable all tooltips in an Application.

Regards,
Vijay
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: interface builder and nsarraycontroller binding newbie question

2008-10-30 Thread Ashley Clark

Hi!

On Oct 29, 2008, at 9:43 AM, Bob Henkel wrote:


Hello,


snip


What I want to do now is invoke a method on the object I have selected
in nstableview by clicking a third button labeled Random Salary which
will call the method giveRandomSalary that I created in my Employee
class. The job of this method is just to set the Salary to a random
value. My issue is how do I invoke the method for the Employee object
?  Hopefully I'm not to far off path with what I'm trying to do. Any
help would be great.


For this you'll need some controller object that you define that will  
manage the window. It could be your application delegate or a specific  
window controller. In either case, that controller will need to have  
an IBOutlet NSArrayController instance variable defined that you'll  
then use in IB to establish a link to the array controller you defined  
in your NIB.


something like:
IBOutlet NSArrayController *myArrayController;

You'll also then need to define an IBAction method for your button to  
call in that same controller.


something like:
- (IBAction)changeSalary:(id)sender;

Then in your methods implementation you can message the array  
controller to get its' selected objects and in turn issue the - 
giveRandomSalary method on those objects.


Most of this is covered in this section of the Cocoa Application  
Tutorial:


http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/06Controller/chapter_6_section_1.html#/ 
/apple_ref/doc/uid/TP4863-CH8-SW1



Hope that helps and good luck!

Ashley

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing xml files in Cocoa applications

2008-10-30 Thread Colin Barrett
There's not one but two XML parsers built right in (NSXMLPaser,
NSXMLDocument  friends), and there's also any number of C libraries
(expat, libxml, etc).

If for some bizarre you reason you need to parse XML files backwards,
there's http://boredzo.org/lmx/.

On Wed, Oct 29, 2008 at 2:28 AM, Arnab Ganguly [EMAIL PROTECTED] wrote:
 Hi All,
 How do I read, parse xml files in Cocoa App ?Any standard parser is
 available?
 Thanks in advance
 Regards
 Arnab
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Programmatically change screensaver

2008-10-30 Thread Brad Peterson
Hi,

Does anyone know how to programatically change the user's current screensaver? 
I've tried applescripts and poking around the ~/Library/Preferences/ByHost 
folder, but I can't find anything.

I was hoping there's a proper API or at least a known (stable?) preferences 
file somewhere... 

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


Help on cocoa app

2008-10-30 Thread Arnab Ganguly
Hi All,
I am new to Cocoa application.I have developed a player application using
QTKit.

When I start my application it comes with an open and radio options under
the File.
Now from the open I can play mp3 files locally and from the radio button it
launches the safari browser to go to a particular website.

Is it possible to make the above functionality to have it under the Windows
panel itself i.e instead of launching safari it would show the same in the
application window? What would be the interfaces need to be used for this.

Thanks in advance
Arnab
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help on cocoa app

2008-10-30 Thread Scott Anguish

You will need to explore the webkit api.

Have a look at the minibrowser example on /Developer/Examples/Webkit



Sent from my iPhone

On Oct 30, 2008, at 6:26 AM, Arnab Ganguly [EMAIL PROTECTED]  
wrote:



Hi All,
I am new to Cocoa application.I have developed a player application  
using

QTKit.

When I start my application it comes with an open and radio options  
under

the File.
Now from the open I can play mp3 files locally and from the radio  
button it

launches the safari browser to go to a particular website.

Is it possible to make the above functionality to have it under the  
Windows
panel itself i.e instead of launching safari it would show the same  
in the
application window? What would be the interfaces need to be used for  
this.


Thanks in advance
Arnab
___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: file references in CoreData

2008-10-30 Thread Georg Seifert

Many thanks for your replies. I will try out the aliases.

Georg
___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Re: Static text over an image

2008-10-30 Thread Mark Allan
I've seen this happen *every* time in IB if the items in question are within an 
NSView.  It was driving me crazy for a while until I figured out (completely by 
accident) that the order has to be reversed when you're setting up the NIB/XIB 
file for it to work correctly.

It's a real PITA because to see and edit the text which you want, eventually, 
to appear on top of the image, you constantly have to select the image/text and 
go the Layout menu and move it back and forward as required, and then remember 
to move the text back behind the image before you save and rebuild your project.


Mark 
PS. Apologies if this message arrives twice - I'm not convinced it sent 
properly first time.

-Begin Quoted Message-

I've seen it happen a few times where views will be layered in the  
reverse order that they're set to in IB. Try moving the label behind  
the image and see if that gives you the desired result.

Cheers,
Brandon

On 30-Oct-08, at 12:48 AM, Andre Masse wrote:

 Hi,

 I want to have text over an image. Even though I set it up in IB  
 (move image to the back, bring the label to the front), the label is  
 always drawn behind the image. Is there a setting to be set in IB  
 for that or do I have to draw the text myself?

 Thanks,

 Andre Masse

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: filtering a tableView from a pulldown

2008-10-30 Thread Amy Heavey

On 29 Oct 2008, at 14:42, I. Savant wrote:

On Wed, Oct 29, 2008 at 4:49 AM, Amy Heavey  
[EMAIL PROTECTED] wrote:


The pop up has selectedObject bound to Purchase Order Array  
Controller 2

selection.orderReference

...
At the moment the content Object is bound to  
selection.orderReference of the

Purchase Order Array Controller.


  Okay, but what is orderReference? Is it an attribute holding the
order number?


Yes


If so, this is at least part of your problem. You
probably want the *content values* (the strings displayed in the
popup, which represent the actual objects being listed) bound to
arrangedObjects.orderReference, but the selected *object* should
probably not be the order number. The controller key should be the
selection but the model key path should be empty. This directly
selects the purchase order object in the array controller.


If I leave the model path empty, then I get an extra line in my pop  
up with

_NSControllerObjectProxy: 0x143e450

 and it doesn't auto select the chosen Purchase ORder from the  
previous window. If I put orderReference in the model path then the  
pop up itself displays the way I intended,




  The way you have it bound now means that your Line Items
controller's content is the orderReference (which I assume is a
string, given the error you posted previously). A string probably
won't contain a list of line items, right?


correct, I think part of my problem is I am used to working with  
MySQL databases, and I'm thinking along the lines of joining across a  
value, I think I'm getting a bit confused between concepts,



I assume your PurchaseOrder
entity has a to-many relationship to the line items (we'll call it
lineItems for obvious reasons). If this is the case, then your Line
Item controller's content should be bound to the Purchase Order
controller's selection.lineItems. This means the Line Item
controller's contents points to an NS[Mutable]Set containing the line
items of the selected purchase order.


I tried to bind the contentArray to that but it threw an error,




OK, so now I tried to bind the Purchase Order Items Array Controller  
(which is your line items I believe), as follows:


content set - Purchse Order Array Controller
controller key - selection
model path - empty


  You want the content *set*. To-many relationships in Core Data deal
with NS[Mutable]Sets, not arrays. Both of these points are thoroughly
covered in the documentation, but you have to understand that you're
dealing with two separate mechanisms that happen to be designed to
work well together. This means there are two different areas of the
documentation that you need to read carefully.


Thanks, I was considering it all as Arrays, based on the fact that  
they are called Array Controllers, but an Array Controller can also  
use a Set as a datasource, (datasource not used here in the cocoa  
sense, )





But I'm still getting an error when trying to use the bindings you  
suggested above, now it doesn't like the NSSet,


[Session started at 2008-10-30 12:30:53 +.]
2008-10-30 12:30:55.531 powizard[13245] An uncaught exception was raised
2008-10-30 12:30:55.532 powizard[13245] Cannot create NSSet from  
object _NSControllerObjectProxy: 0x1646580 of class  
_NSControllerObjectProxy
2008-10-30 12:30:55.532 powizard[13245] *** Uncaught exception:  
NSInternalInconsistencyException Cannot create NSSet from object  
_NSControllerObjectProxy: 0x1646580 of class _NSControllerObjectProxy


I do appreciate all your help. I'm hoping if I can get this one  
working I'll be able to work out others myself.


Thank You

Amy
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: When does Cocoa get No more! from malloc?

2008-10-30 Thread Jerry Krinock


On 2008 Oct, 25, at 21:58, Ken Thomases wrote:


On Oct 25, 2008, at 11:48 PM, Jerry Krinock wrote:


Why did malloc say No more! on his Mac, but not on mine?


Because you didn't let yours run amok for long enough.


Thank you, Ken.  I thought I did, but maybe I didn't.

If your app is leaking memory on a (more or less) continuous basis,  
it will eventually get an error like your user got.  You just have  
to let it keep at it.


An internet search shows me that the error message...

   malloc: *** mmap(size=2097152) failed (error code=12)

is quite common.

What is the significance of the number 2097152, besides the fact that  
it is 2^21?  I suppose is the limit of how much malloc will give any  
app?  2097152 what?  What are the units?  Is this set or documented  
anywhere?


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSBezierPath problems, seems to be two bugs [solved]

2008-10-30 Thread Jochen Moeller

Hello List

two weeks ago I described a remaining shape in the sample code  
Movie_Overlay, when the NSColor -whiteColor was replaced by -clearColor.


Now I have implemented an overlay window in my own app and found the  
cause for that shape.

It is in MyDocument.m the code line:
   [overlayWindow setHasShadow:YES];

When changed to:
   [overlayWindow setHasShadow:NO];
the background remains clear as expected.

So the shape turns out to be the shadow of the first NSBezierPath  
stroke (Why only the first one in the animation?).


Another remaining question is: Why can NSRectFill() not erase that  
shadow?


But the main problem is solved when no shadow is created in the  
overlay window.


Greetings,
Jochen Moeller


Am 15.10.2008 um 13:56 schrieb Jochen Moeller:


in the sample code Movie_Overlay (here with Xcode 3.1.1)
http://developer.apple.com/samplecode/Movie_Overlay/index.html
both subviews (AnimationView and ImageView) are filled with - 
whiteColor in -drawRect:.


- (void)drawRect:(NSRect)rect { // original AnimationView.m
  [[NSColor whiteColor] set];
  NSRectFill(rect);
  [self doStarAnimation];
}

This is not what I want because the movie is dimmed with increasing  
alpha values in the overlay. So I replaced the -whiteColor by - 
clearColor in both -drawRect: and used bounds instead of rect.  
Additionally I set the alpha value to 0.5 (instead 0.3) in MyDocument.


- (void)drawRect:(NSRect)rect { // 1st modification
  [[NSColor clearColor] set];   // in AnimationView.m
  NSRectFill([self bounds]);
  [self doStarAnimation];
}

1st Issue:
This worked fine in ImageView but in AnimationView remained a light  
grey shape of the animation figure which was not erased by  
NSRectFill(). Therefore I replaced NSRectFill() by -fillRect: in the  
next step.


- (void)drawRect:(NSRect)rect { // 2nd modification
  [[NSColor clearColor] set];   // in AnimationView.m
  [NSBezierPath fillRect:[self bounds]];
  [self doStarAnimation];
}


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Re: Static text over an image

2008-10-30 Thread Alex Curylo


On 30-Oct-08, at 5:42 AM, [EMAIL PROTECTED] wrote:

I've seen this happen *every* time in IB if the items in question  
are within an NSView.  It was driving me crazy for a while until I  
figured out (completely by accident) that the order has to be  
reversed when you're setting up the NIB/XIB file for it to work  
correctly.


It's a real PITA because to see and edit the text which you want,  
eventually, to appear on top of the image, you constantly have to  
select the image/text and go the Layout menu and move it back and  
forward as required, and then remember to move the text back behind  
the image before you save and rebuild your project.



Or you could do what I did when I had a project this was an intense  
annoyance for what with the several-times-a-day client updates, which  
is to just programmatically reverse the order on load. That smoothed  
development considerably.


--
Alex Curylo -- [EMAIL PROTECTED] -- http://www.alexcurylo.com/

There are two great secrets to success in life.
The first is to not tell everything you know.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Static text over an image

2008-10-30 Thread Andre Masse

On Oct 30, 2008, at 01:32, Andrew Merenbach wrote:

What operating system are you deploying to, and which SDK are you  
linking against?  If you're using anything before Leopard, you're  
out of luck with your present method, as clipping was not enforced  
among sibling views prior to 10.5.  There might possibly be caveats  
using 10.5, as well, although I'm not versed enough to know what  
they are -- hopefully someone with more experience, in this  
particular issue, will be able to chime in.



I'm linking against 10.5. Thanks for pointing that issue.


On Oct 30, 2008, at 01:44, Rob Keniger wrote:

Try double-clicking the Image view in IB, which will move IB's  
active selection to the view itself. If you now drag a text field  
to the image, it will be placed as a subview of the NSImageView and  
always display in front.


Thanks for your suggestion Rob, but I tried that but couldn't make it  
work when the image is in an NSView.


Here's what i did:

- created a new Cocoa application project,
- opened the xib,
- dragged an NSApplication image from the media tab in IB to the window,
- dragged a label (NSTextField) on top of the image,
- saved, build and run.

The label is correctly drawn over the image. Then I:

- dragged a custom view (NSView),
- dragged an NSApplication image in the custom view,
- double-clicked the image, the white frame comes up to show that I'm  
inside the image's view,
- dragged a label (NSTextField) on top of the image and couldn't put  
it *in* the image's view. No matter what I do, IB doesn't let me. I  
tried to moved it inside by switching to list view in IB and dragging  
the label inside the image view but no luck.

- saved, build and run.

The label is drawn behind...

Thanks to both Brandon and Mark who suggested to reverse the order.  
That solves the problem! Now, for what I currently need (having a  
label over a gradient background), this is a small issue. When you  
want an entire layout build on top of an image background, this  
becomes much more involving. Sure, there's a workaround but I think  
it's better to file a bug on radar so that this *behavior* is fixed,  
and I'll do that :-)


Thanks to all for your suggestions,

Andre Masse
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Static text over an image

2008-10-30 Thread Andre Masse


On Oct 30, 2008, at 09:08, Alex Curylo wrote:

Or you could do what I did when I had a project this was an intense  
annoyance for what with the several-times-a-day client updates,  
which is to just programmatically reverse the order on load. That  
smoothed development considerably.


Pardon my ignorance (still learning Cocoa) but can you point to me  
what class/method to use for that?


Thanks,

Andre Masse

PS: Bug filed on radar.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: filtering a tableView from a pulldown

2008-10-30 Thread I. Savant
 The pop up has selectedObject bound to Purchase Order Array Controller 2
 selection.orderReference

 ...

 At the moment the content Object is bound to selection.orderReference of the
 Purchase Order Array Controller.

  If you're binding the content object(s), this is wrong. Again, you
want the popup's *selected object*. bound to Purchase Order Array
Controller.selection.


 If I leave the model path empty, then I get an extra line in my pop up with
 _NSControllerObjectProxy: 0x143e450
  and it doesn't auto select the chosen Purchase ORder from the previous
 window. If I put orderReference in the model path then the pop up itself
 displays the way I intended,

  Okay, it *displays* the way you intended, but it's still designating
the orderReference string as the selected object. This is wrong. I
believe the confusion is partly my own because it's not in front of me
and this thread spans several days. :-)

  The popup can be configured in various ways (for maximum flexibility
and confusion :-)). For simplicity, how about this? Remove all popup
bindings so you're starting clean. Bind the popup's Content Values to
Purchase Order Array Controller's arrangedObjects.orderReference. Bind
the popup's Selected Value to the PO controller's
selection.orderReference.

  With this set of bindings, the PO array controller's selection
management should work perfectly. This assumes the Line Item array
controller is also configured properly, so to verify your popup's
configuration, I'd disconnect the Line Item controller's content
binding for now just to test this.

 correct, I think part of my problem is I am used to working with MySQL
 databases, and I'm thinking along the lines of joining across a value, I
 think I'm getting a bit confused between concepts,

  Yeah, forget all that. It has nothing to do with Core Data because
Core Data is not an RDBMS (per the documentation). It has many
similarities but it has a number of very important differences. They
(the documentation team and developers) have coined the phrase,
object graph management and persistence framework. Take it as
gospel. Repeat after me: Core Data is NOT an RDBMS. :-)

 Thanks, I was considering it all as Arrays, based on the fact that they are
 called Array Controllers, but an Array Controller can also use a Set as a
 datasource, (datasource not used here in the cocoa sense, )

  Yes. Core Data was added in 10.4, the Bindings mechanism was added
in 10.3. At the time, an array controller controlled arrays (I
believe, but I may be wrong). It just wouldn't do to rename it
NSArrayAndSetController or to add another controller dedicated to
sets, but I can see the source of confusion. :-) Another important
aspect was added, too, which I'll mention in a moment.

 OK, so now I tried to bind the Purchase Order Items Array Controller (which
 is your line items I believe), as follows:
 content set - Purchse Order Array Controller
 controller key - selection
 model path - empty
...
 But I'm still getting an error when trying to use the bindings you suggested
 above, now it doesn't like the NSSet,
 2008-10-30 12:30:55.532 powizard[13245] Cannot create NSSet from object
 _NSControllerObjectProxy: 0x1646580 of class _NSControllerObjectProxy
 2008-10-30 12:30:55.532 powizard[13245] *** Uncaught exception:
 NSInternalInconsistencyException Cannot create NSSet from object
 _NSControllerObjectProxy: 0x1646580 of class _NSControllerObjectProxy

  Have I misspoken somewhere? I can't find where I might have, but you
quoted me saying, ... your Line
Item controller's content should be bound to the Purchase Order
controller's 'selection.lineItems'.

  I meant for your Items controller's Content Set binding to be bound
to Purchase Order Array Controller's selection.lineItems (or whatever
your to-many relationship to your items set is called). The binding
you specified above does not follow this.

 I do appreciate all your help. I'm hoping if I can get this one working I'll
 be able to work out others myself.

  Been there. Once it clicks, you'll enjoy a brief euphoric rush,
followed by a strong desire for a shot or three of liquor. Once that's
out of your system, a lot of other Bindings-related stuff will make a
lot more sense. Stick with it.

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Static text over an image

2008-10-30 Thread John Joyce


On Oct 30, 2008, at 7:41 AM, [EMAIL PROTECTED] wrote:


Date: Thu, 30 Oct 2008 10:31:03 
From: Mark Allan [EMAIL PROTECTED]
Subject: RE: Re: Static text over an image
To: Brandon Walkin [EMAIL PROTECTED], Andre Masse
[EMAIL PROTECTED]
Cc: Cocoa Dev cocoa-dev@lists.apple.com
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=UTF-8

I've seen this happen *every* time in IB if the items in question  
are within an NSView.  It was driving me crazy for a while until I  
figured out (completely by accident) that the order has to be  
reversed when you're setting up the NIB/XIB file for it to work  
correctly.


It's a real PITA because to see and edit the text which you want,  
eventually, to appear on top of the image, you constantly have to  
select the image/text and go the Layout menu and move it back and  
forward as required, and then remember to move the text back behind  
the image before you save and rebuild your project.




No, you don't have to constantly re-arrange things. It would be nice  
if there were some sort of layers in IB.
However, all you need to do to edit it is change the document window  
view from Icon view to List view or Column view.
You can then select exactly what you want to work with from there. As  
your Nib/Xib gets more complex, this is necessary.
Beyond that, you may find yourself setting a lot of things in code at  
some point...

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: When does Cocoa get No more! from malloc?

2008-10-30 Thread Michael Ash
On Thu, Oct 30, 2008 at 8:56 AM, Jerry Krinock [EMAIL PROTECTED] wrote:

 On 2008 Oct, 25, at 21:58, Ken Thomases wrote:

 On Oct 25, 2008, at 11:48 PM, Jerry Krinock wrote:

 Why did malloc say No more! on his Mac, but not on mine?

 Because you didn't let yours run amok for long enough.

 Thank you, Ken.  I thought I did, but maybe I didn't.

 If your app is leaking memory on a (more or less) continuous basis, it
 will eventually get an error like your user got.  You just have to let it
 keep at it.

 An internet search shows me that the error message...

   malloc: *** mmap(size=2097152) failed (error code=12)

 is quite common.

 What is the significance of the number 2097152, besides the fact that it is
 2^21?  I suppose is the limit of how much malloc will give any app?  2097152
 what?  What are the units?  Is this set or documented anywhere?

The units are bytes.

The significance is probably that this is the chunk size that malloc
uses when requesting memory from the operating system.

For efficiency, malloc doesn't call out to the OS every time you call
it. For small allocations, it makes one call out to the OS for a big
block of memory, and then divides it up into pieces. Apparently it
asks for 2MB at a time.

In the end the number is not really important. All it means is that
you've exhausted your address space and therefore your app must die.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: When does Cocoa get No more! from malloc?

2008-10-30 Thread Chris Suter
 An internet search shows me that the error message...

   malloc: *** mmap(size=2097152) failed (error code=12)

 is quite common.

 What is the significance of the number 2097152, besides the fact that it is
 2^21?

It's just the amount of memory in bytes it was trying to allocate when
it failed.

If you're that interested, you can look at the source code. It's open source.

This is straying a bit off-topic for the Cocoa list.

-- Chris
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: filtering a tableView from a pulldown

2008-10-30 Thread Amy Heavey

On 30 Oct 2008, at 14:11, I. Savant wrote:

The pop up has selectedObject bound to Purchase Order Array  
Controller 2

selection.orderReference

...

At the moment the content Object is bound to  
selection.orderReference of the

Purchase Order Array Controller.


  If you're binding the content object(s), this is wrong. Again, you
want the popup's *selected object*. bound to Purchase Order Array
Controller.selection.


I did have the selected object not the content object bound.




If I leave the model path empty, then I get an extra line in my  
pop up with

_NSControllerObjectProxy: 0x143e450
 and it doesn't auto select the chosen Purchase ORder from the  
previous
window. If I put orderReference in the model path then the pop up  
itself

displays the way I intended,


  Okay, it *displays* the way you intended, but it's still designating
the orderReference string as the selected object. This is wrong. ...




  The popup can be configured in various ways (for maximum flexibility
and confusion :-)). For simplicity, how about this? Remove all popup
bindings so you're starting clean. Bind the popup's Content Values to
Purchase Order Array Controller's arrangedObjects.orderReference. Bind
the popup's Selected Value to the PO controller's
selection.orderReference.


OK, done that...


  With this set of bindings, the PO array controller's selection
management should work perfectly. This assumes the Line Item array
controller is also configured properly, so to verify your popup's
configuration, I'd disconnect the Line Item controller's content
binding for now just to test this.


OK, the pop up is displaying the PO orderReferences fine, however  
when I change the option in the pulldown, it's changing the value of  
the selected row in the table,


correct, I think part of my problem is I am used to working with  
MySQL
databases, and I'm thinking along the lines of joining across a  
value, I

think I'm getting a bit confused between concepts,


  Yeah, forget all that. It has nothing to do with Core Data because
Core Data is not an RDBMS (per the documentation). It has many
similarities but it has a number of very important differences. They
(the documentation team and developers) have coined the phrase,
object graph management and persistence framework. Take it as
gospel. Repeat after me: Core Data is NOT an RDBMS. :-)


Core Data is NOT an RDBMS :)



Thanks, I was considering it all as Arrays, based on the fact that  
they are
called Array Controllers, but an Array Controller can also use a  
Set as a

datasource, (datasource not used here in the cocoa sense, )


  Yes. Core Data was added in 10.4, the Bindings mechanism was added
in 10.3. At the time, an array controller controlled arrays (I
believe, but I may be wrong). It just wouldn't do to rename it
NSArrayAndSetController or to add another controller dedicated to
sets, but I can see the source of confusion. :-) Another important
aspect was added, too, which I'll mention in a moment.

OK, so now I tried to bind the Purchase Order Items Array  
Controller (which

is your line items I believe), as follows:
content set - Purchse Order Array Controller
controller key - selection
model path - empty

...
But I'm still getting an error when trying to use the bindings you  
suggested

above, now it doesn't like the NSSet,
2008-10-30 12:30:55.532 powizard[13245] Cannot create NSSet from  
object
_NSControllerObjectProxy: 0x1646580 of class  
_NSControllerObjectProxy

2008-10-30 12:30:55.532 powizard[13245] *** Uncaught exception:
NSInternalInconsistencyException Cannot create NSSet from object
_NSControllerObjectProxy: 0x1646580 of class  
_NSControllerObjectProxy


  Have I misspoken somewhere? I can't find where I might have, but you
quoted me saying, ... your Line
Item controller's content should be bound to the Purchase Order
controller's 'selection.lineItems'.

  I meant for your Items controller's Content Set binding to be bound
to Purchase Order Array Controller's selection.lineItems (or whatever
your to-many relationship to your items set is called). The binding
you specified above does not follow this.


OK, I think I've done that.

So now, the pulldown  filters the tableview. but there's a snag.

I select a Purchase Order in my window, and click a button which  
opens the panel with the Purchase Orders 'line items' in the table.  
The Purchase Order is in the pulldown, and the items in that order  
are in the table.


If I now select a different orderReference in the pulldown, it  
changes all of the 'lineItems' Purchase ORder to the newly selected  
one, so in my table, all of those items now have a different  
orderReference.


I expected to be able to select a different orderReference in  the  
pulldown, and for the table to update to display the lineitems for  
that OTHER order.




I do appreciate all your help. I'm hoping if I can get this one  
working I'll

be able to work out others myself.


  Been there. Once it clicks, you'll 

Re: When does Cocoa get No more! from malloc?

2008-10-30 Thread Chris Suter
On Fri, Oct 31, 2008 at 1:28 AM, Michael Ash [EMAIL PROTECTED] wrote:

 Apparently it asks for 2MB at a time.

For tiny regions (for blocks = 16 bytes), it looks like it appears to
allocate 1 MB chunks. For small regions (blocks = 512 bytes), I think
it's around 8MB blocks. I think the 2 MB must come from a large
allocation or from one of the other data structures.

-- Chris
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: filtering a tableView from a pulldown

2008-10-30 Thread I. Savant
On Thu, Oct 30, 2008 at 10:31 AM, Amy Heavey [EMAIL PROTECTED] wrote:

 So now, the pulldown  filters the tableview. but there's a snag.

 I select a Purchase Order in my window, and click a button which opens the
 panel with the Purchase Orders 'line items' in the table. The Purchase Order
 is in the pulldown, and the items in that order are in the table.

 If I now select a different orderReference in the pulldown, it changes all
 of the 'lineItems' Purchase ORder to the newly selected one, so in my table,
 all of those items now have a different orderReference.

 I expected to be able to select a different orderReference in  the pulldown,
 and for the table to update to display the lineitems for that OTHER order.

  What I'm envisioning from your previous descriptions is apparently
different than what you actually have. There is something (or several
somethings) I'm not understanding about your setup. Is it possible for
you to post a pared-down version of your project somewhere for myself
and others on the list to take a look at? At the very least, try to
create a separate Xcode project with a similar data model and
simplified interface that reflects what you're attempting to do and
post that instead. The very act of doing so may even help you
understand what's going on before you post it.

  The problem, essentially, is that there are a lot of aspects to your
approach that I just can't see, which leads to a lot of (necessary)
assumptions on my part. I don't think this is going to help you very
much. Having something in front of us typically leads to an instant
ah-hah!.

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: filtering a tableView from a pulldown

2008-10-30 Thread Amy Heavey

On 30 Oct 2008, at 14:41, I. Savant wrote:


Is it possible for
you to post a pared-down version of your project somewhere for myself
and others on the list to take a look at?


I've uploaded the project folder to www.amygibbs.co.uk/xcode/powizard

one thing to note, is that at the moment the persistantstore is  
hardcoded to my thumbdrive, as if I can get it up and running I'd  
like to store the file there rather than having to copy/paste it from  
the application support folder all the time. It's not perfect but  
I've got bigger issues with this first!



Thanks,



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: When does Cocoa get No more! from malloc?

2008-10-30 Thread Shawn Erickson
Try out vmmap against your (or some) application to see how things are
getting allocated. It can give you insights into how things are
working at the VM level.

[0:502]  vmmap iTunes
Virtual Memory Map of process 7842 (iTunes)
Output report format:  2.2  -- 32-bit process

 Non-writable regions for process 7842
__PAGEZERO -1000 [4K] ---/--- SM=NUL
/Applications/iTunes.app/Contents/MacOS/iTunes
__TEXT 1000-00ae9000 [ 10.9M] r-x/rwx SM=COW
/Applications/iTunes.app/Contents/MacOS/iTunes

 snip 

MALLOC_TINY0100-0110 [ 1024K] rw-/rwx SM=PRV
DefaultMallocZone_0x100
MALLOC_TINY0110-0120 [ 1024K] rw-/rwx SM=PRV  zone_0x0
MALLOC_LARGE   0120-0121 [   64K] rw-/rwx SM=PRV
DefaultMallocZone_0x100
MALLOC_LARGE   01218000-01219000 [4K] rw-/rwx SM=PRV
DefaultMallocZone_0x100
VM_ALLOCATE ?  01219000-0121b000 [8K] rw-/rwx SM=PRV
MALLOC_LARGE   0121b000-0123b000 [  128K] rw-/rwx SM=PRV
DefaultMallocZone_0x100

 snip 

 Summary for process 7842
ReadOnly portion of Libraries: Total=146.7M resident=81.4M(56%)
swapped_out_or_unallocated=65.3M(44%)
Writable regions: Total=757.6M written=114.9M(15%)
resident=131.2M(17%) swapped_out=17.6M(2%) unallocated=626.3M(83%)

REGION TYPE [ VIRTUAL]
=== [ ===]
ATS (font support)  [   33.6M]
CG backing stores   [   9616K]
CG shared images[   1056K]
Carbon  [   2040K]
CoreGraphics[480K]
IOKit   [  512.8M]
MALLOC  [  145.2M]
Memory tag=240  [  4K]
STACK GUARD [   56.1M]
Stack   [   22.2M]
VM_ALLOCATE ?   [   16.4M]
__DATA  [   10.4M]
__IMAGE [   1240K]
__IMPORT[744K]
__LINKEDIT  [   6540K]
__OBJC  [   2240K]
__PAGEZERO  [  4K]
__TEXT  [  140.3M]
__UNICODE   [532K]
mapped file [   32.1M]
shared memory   [   49.4M]
shared pmap [   1096K]

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Static text over an image

2008-10-30 Thread Shawn Erickson
On Wed, Oct 29, 2008 at 9:48 PM, Andre Masse [EMAIL PROTECTED] wrote:
 Hi,

 I want to have text over an image. Even though I set it up in IB (move image
 to the back, bring the label to the front), the label is always drawn behind
 the image. Is there a setting to be set in IB for that or do I have to draw
 the text myself?

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaViewsGuide/WorkingWithAViewHierarchy/chapter_5_section_5.html

Note: For performance reasons, Cocoa does not enforce clipping among
sibling views or guarantee correct invalidation and drawing behavior
when sibling views overlap. If you want a view to be drawn in front of
another view, you should make the front view a subview (or descendant)
of the rear view.

In fact IB and ibtool warns about this when you compile a XIB.

If you are using layer backed views I think this restriction goes away
since layers have a more formal Z ordering requirement. I am not sure
if restricting to 10.5 alone is enough to deal with this (don't think
it is).

You normally deal with this by nesting views... your text view would
be a subview of the image view or by doing custom rendering.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


coredata: building tree from Entities

2008-10-30 Thread Georg Seifert

hello,

once again a beginner question on coredata.

I want to display my data in a outlineview grouped one of the entities  
attributes.

my Data:

Elements (
{titel1, name1},
{titel1, name2},
{titel2, name3},
{titel2, name4},
{titel2, name5} )

the OutlineView should show:

titel1
name1
name2
titel2
name3
name4
name5


Can I build it using fetched properties?

Any help or hint is appreciated.
Georg
___

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

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

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

This email sent to [EMAIL PROTECTED]


Image from font file

2008-10-30 Thread Georg Seifert

hello,

I wonder what is the best way to render images from a font file with a  
given string. The font is not activated in the system.


I came up with:
- using Quicklook, but I could only get images with Ag (like the  
icon for font files), not the alphabetic overview I get in the finder.  
(is there a way to render a sting with it?)
- activating the font locally, render the image and deactivate it.  
(this is a bit overkill I suppose (and I didn’t tried it))

- using a framework (like freetype)

Any suggestions are appreciated
Georg___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Static text over an image

2008-10-30 Thread Andre Masse

Thanks for the link Shawn. I guess I'll have to live with that.

Andre Masse

On Oct 30, 2008, at 11:26, Shawn Erickson wrote:

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaViewsGuide/WorkingWithAViewHierarchy/chapter_5_section_5.html 



Note: For performance reasons, Cocoa does not enforce clipping among
sibling views or guarantee correct invalidation and drawing behavior
when sibling views overlap. If you want a view to be drawn in front of
another view, you should make the front view a subview (or descendant)
of the rear view.

In fact IB and ibtool warns about this when you compile a XIB.

If you are using layer backed views I think this restriction goes away
since layers have a more formal Z ordering requirement. I am not sure
if restricting to 10.5 alone is enough to deal with this (don't think
it is).

You normally deal with this by nesting views... your text view would
be a subview of the image view or by doing custom rendering.

-Shawn


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-30 Thread Randall Meadows

On Oct 29, 2008, at 6:05 PM, Aki Inoue wrote:

The threshold being discussed here is the boundary between the  
screen font vs printer font in NSFont jargon.


For font size smaller than 16pt, we automatically substitute the  
default printer font to its corresponding screen font.

The metrics gap is caused by the substitution.

You can disable the auto-substitution with  
NSStringDrawingDisableScreenFontSubstitution flag.


Cool, I can see I can use this in  
boundingRectWithSize:options:attributes: as well as the draw; I'll try  
that out (I was using sizeWithAttributes:, but I can switch that).  Do  
I assume correctly that they perform the same basic functionality?


When you change the scale/font size, the baseline shifts naturally  
when you layout from the top.
In order to keep it fixed at the baseline, you need to layout/render  
on it.

-drawInRect:withAttributes: always render from the top.

To render with the baseline, use -drawWithRect:options:attributes:.


Can you give me any more pointers about this?  Neither the String  
Programming Guide for Cocoa nor the Attributed Strings Programming  
Guide even mention any of the NSStringDrawingOptions flags.  This is  
definitely sometime I'm dealing with:


My view is made up of many different fields which are all drawn  
independently from one another.  However, the layout of the fields is  
predetermined: field A is a label, and field B is the associated  
value; however, they are drawn independently, and as I mentioned  
before, if the contents of a field don't fit naturally then the font  
size is reduced until it can fit.  This is a case where I need to make  
sure that the baselines of both field A and field B are the same.



Thanks!
randy
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-30 Thread Randall Meadows

On Oct 30, 2008, at 9:53 AM, Randall Meadows wrote:


On Oct 29, 2008, at 6:05 PM, Aki Inoue wrote:

The threshold being discussed here is the boundary between the  
screen font vs printer font in NSFont jargon.


For font size smaller than 16pt, we automatically substitute the  
default printer font to its corresponding screen font.

The metrics gap is caused by the substitution.

You can disable the auto-substitution with  
NSStringDrawingDisableScreenFontSubstitution flag.


Cool, I can see I can use this in  
boundingRectWithSize:options:attributes: as well as the draw; I'll  
try that out (I was using sizeWithAttributes:, but I can switch  
that).  Do I assume correctly that they perform the same basic  
functionality?


OK, I assumed INcorrectly.  That method takes a size already, and it's  
the size that I'm primarily interested in.


So how can I get a the width that a particular string is going to be  
drawn in, *and* disable that subsitution?  Will calling  
NSLayoutManager setUsesScreenFonts:NO before calling NSString  
sizeWithAttributes: do the right thing?  Or is there another tack I  
should be taking?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Static text over an image

2008-10-30 Thread Alex Curylo


On 30-Oct-08, at 8:01 AM, [EMAIL PROTECTED] wrote:


which is to just programmatically reverse the order on load. That
smoothed development considerably.


Pardon my ignorance (still learning Cocoa) but can you point to me
what class/method to use for that?



The exact details escape me now, but I seem to recall that since the  
order of -subviews was not completely deterministic depending on what  
the latest mucking about in the nib had been I resorted to something  
like


NSView** putTheseInFront = {
   _ibOverlay1,
   _ibTextField2,
   ...
   nil
}

while (*putTheseInFront)
{
   NSView* itsSuperview = [*putTheseInFront superview];
   [[*putTheseInFront retain] removeFromSuperview];
   [itsSuperview addSubview:*putTheseInFront)];
   putTheseInFront++;
}

Not exactly scalable, but it sorted the workflow at hand nicely with  
no apparent runtime delay.


--
Alex Curylo -- [EMAIL PROTECTED] -- http://www.alexcurylo.com/

I am so honoured to know you, the first glider off Eagle.
 That is s cool.
-- Martina Lang



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-30 Thread Randall Meadows

On Oct 30, 2008, at 10:02 AM, Randall Meadows wrote:


On Oct 30, 2008, at 9:53 AM, Randall Meadows wrote:

So how can I get a the width that a particular string is going to  
be drawn in, *and* disable that subsitution?  Will calling  
NSLayoutManager setUsesScreenFonts:NO before calling NSString  
sizeWithAttributes: do the right thing?  Or is there another tack I  
should be taking?


And where would I get a layout manager from if I'm trying to disable  
this before determining the size, not actually drawing it?


OK, I just tried passing

NSSize thisSize = [self boundingRectWithSize:NSMakeSize(CGFLOAT_MAX,  
CGFLOAT_MAX)

   options:NSStringDrawingDisableScreenFontSubstitution
   attributes:attrs].size;

and got the exact same behavior as I originally did, where a point  
size of 16 generated a height of 18, but a point size of 15 generated  
a height of 21, so apparently this did NOT disable the substitution.   
Does that only work in conjunction with other flags?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [MEET] CocoaHeads Mac Developer Meetings

2008-10-30 Thread Negm-Awad Amin


Am Mi,29.10.2008 um 23:29 schrieb Stephen Zyszkiewicz:


Greetings,

CocoaHeads is an international Mac programmer's group.  We specialize
in Cocoa, but everything Mac programming related is welcome.

Why Should I Attend?
Meeting other Mac OS X developers in person is both fun and immensely
useful. There's no better way to learn Cocoa or get help with problems
than being around other people who are writing Mac software.

We usually have several Cocoa experts hanging around that are happy to
answer whatever questions they can. Bring your laptop and any code
you're working on.

Everyone is Welcome
Meetings are free and open to the public. Feel free to drop in even if
you've never attended or aren't currently using Cocoa. We usually have
a few new faces, so don't worry about being the odd one out.

Upcoming meetings:
Canada
Ottawa/Gatineau- Thursday November 13, 2008 08:00 PM EDT.

Germany
Berlin- Thursday November 13, 2008 07:00 PM CEST.
Bonn- Thursday November 20, 2008 07:00 PM CEST.

I want to add:
Aachen- Thursday October 30, 2008 07:00 PM CEST


Sweden
Stockholm- Monday November 03, 2008 07:30 PM CEST.

United Kingdom
Swindon- Monday November 03, 2008 09:00 PM BST.

United States
Boston- Thursday November 13, 2008 07:00 PM EDT.
Boulder- Tuesday November 11, 2008 08:00 PM MDT.
Colorado Springs- Thursday November 13, 2008 07:00 PM MST.
Des Monies- Thursday November 13, 2008 07:00 PM CST.
Fort Lauderdale- Sunday November 16, 2008 08:00 PM EDT.
Minneapolis- Thursday November 13, 2008 06:00 PM CST.
Philadelphia- Thursday November 13, 2008 07:00 PM EDT.
Provo- Thursday November 13, 2008 07:00 PM MST.
St. Louis- Saturday November 22, 2008 02:00 PM CST.


Please check the web site at http://cocoaheads.org for more
information including last-minute changes. Some chapters may have yet
to post their meeting for this month.


Steve
Silicon Valley CocoaHeads
http://cocoaheads.org
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Static text over an image

2008-10-30 Thread Andre Masse

Thanks for your code snippet, I get the idea now.

Andre Masse


On Oct 30, 2008, at 12:07, Alex Curylo wrote:



The exact details escape me now, but I seem to recall that since the  
order of -subviews was not completely deterministic depending on  
what the latest mucking about in the nib had been I resorted to  
something like


NSView** putTheseInFront = {
  _ibOverlay1,
  _ibTextField2,
  ...
  nil
}

while (*putTheseInFront)
{
  NSView* itsSuperview = [*putTheseInFront superview];
  [[*putTheseInFront retain] removeFromSuperview];
  [itsSuperview addSubview:*putTheseInFront)];
  putTheseInFront++;
}

Not exactly scalable, but it sorted the workflow at hand nicely with  
no apparent runtime delay.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: coredata: building tree from Entities

2008-10-30 Thread Quincey Morris

On Oct 30, 2008, at 08:39, Georg Seifert wrote:


once again a beginner question on coredata.

I want to display my data in a outlineview grouped one of the  
entities attributes.

my Data:

Elements (
{titel1, name1},
{titel1, name2},
{titel2, name3},
{titel2, name4},
{titel2, name5} )

the OutlineView should show:

titel1
name1
name2
titel2
name3
name4
name5


Can I build it using fetched properties?


It's more an NSOutlineView question than a Core Data question.

For an outline view with bindings, you need a tree-structured  
hierarchy of individual objects, each of which (at least) implements  
the children method whose name you specify for the outline view in  
IB. If your titles and names are string attributes, that's not going  
to work.


You might be able to do it fairly easily using a data source for the  
outline view, instead of bindings, for the name/title column(s).


Or, create a hierarchy of stand-in objects and use bindings.

Or, redesign your Core Data model so that the parent/child  
relationships are explicit in the model.



___

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

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

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

This email sent to [EMAIL PROTECTED]


-[_NSZombie methodSignatureForSelector:] not working

2008-10-30 Thread Michael Ash
The famous TN2124
(http://developer.apple.com/technotes/tn2004/tn2124.html) has this to
say about debugging using zombies:

You can use GDB to set a breakpoint on -[_NSZombie
methodSignatureForSelector:] to further debug this sort of problem.

However this does not appear to work. GDB cannot resolve this
breakpoint, and indeed the _NSZombie class no longer appears to exist
on 10.5.5 (and presumably all of 10.5). This test program illustrates:

#import Foundation/Foundation.h

int main( int argc, char **argv )
{
[NSAutoreleasePool new];

id obj = [[NSObject alloc] init];
[obj release];

NSLog(@Class of released object is %@, _NSZombie is %@,
NSStringFromClass(obj-isa), NSClassFromString(@_NSZombie));

return 0;
}

This is the output I get on my machine when the above is run with
NSZombieEnabled=YES:

2008-10-30 12:54:42.810 a.out[28706:10b] Class of released object is
_NSZombie_NSObject, _NSZombie is (null)

So it would appear that NSZombieEnabled has gone to creating dynamic
zombie classes rather than simply using a single _NSZombie class as in
days past. Which is fine. Except that I no longer know where to set my
breakpoint. Am I doing something wrong, or what's the substitute for
-[_NSZombie methodSignatureForSelector:]?

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Porting from Windows to Mac

2008-10-30 Thread Rakesh Singhal
Hi all

I have to port a project form windows to Mac. The existing code is in
C++ and classes are inherited from MFC library classes. Do I have any
alternative for MFC in MAC OS?

I have gone through some posting on Apple lists and I found that there
are 2 cross-platform tools Power Plant and Code Warrior. Which one is
better and If I want to use any of them then do I need to install them
on Mac system and will I need to modify the code very much? Which type
of application do I need to choose for porting in Mac cocoa or carbon
or something?

Thanks in advance.

Regards
rksinghal
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing xml files in Cocoa applications

2008-10-30 Thread Paul Reilly
There is also some good sample code on the iPhone Developer site, called
SeismicXML which shows how to parse an XML document.

Paul
___

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

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

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

This email sent to [EMAIL PROTECTED]


Customizing controls: Inheritance bad?

2008-10-30 Thread Brian Williams
Hello,

 

I'm brand new to Cocoa/Obj-C and I'm working on converting an app. to
use Cocoa...

 

I've heard that, in general, if you are using inheritance in Cocoa,
you're not following the typical standard design pattern.  Is this true?

 

To respond to special keyboard events in an NSTableView, I created a
subclass and provided an implementation for keyDown.

To draw some customized stuff in an NSColorWell, I created a subclass
and provided an implementation for drawRect.

Etc.

 

In the olden days, this kind of object-oriented approach was perfectly
correct.

 

But I'm told I should be using delegate methods and firstResponders
somehow.

 

In general, is there a preferred approach to using actions over
delegates, and delegates over handling Cocoa events?  It seems there are
many different ways to handle the same problem and some ways are
preferred over others...

 

Also, could someone recommend a good intro to FirstResponders as this is
a concept I don't understand fully yet?

 

Thanks,

Brian

___

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

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

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

This email sent to [EMAIL PROTECTED]


Type comparison warning

2008-10-30 Thread DKJ
I'm probably missing something simple, but I don't understand why this  
line:


return (i == -1 ? [NSNull null] : [NSNumber numberWithInteger:i]);

(where i is an NSInteger) produces this warning:

comparison of distinct Objective-C types lacks a cast

(The return type of the method is id.)

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [MEET] CocoaHeads Mac Developer Meetings

2008-10-30 Thread Torsten Curdt
 Greetings,

 CocoaHeads is an international Mac programmer's group.  We specialize
 in Cocoa, but everything Mac programming related is welcome.

 Why Should I Attend?
 Meeting other Mac OS X developers in person is both fun and immensely
 useful. There's no better way to learn Cocoa or get help with problems
 than being around other people who are writing Mac software.

 We usually have several Cocoa experts hanging around that are happy to
 answer whatever questions they can. Bring your laptop and any code
 you're working on.

 Everyone is Welcome
 Meetings are free and open to the public. Feel free to drop in even if
 you've never attended or aren't currently using Cocoa. We usually have
 a few new faces, so don't worry about being the odd one out.

 Upcoming meetings:
 Canada
 Ottawa/Gatineau- Thursday November 13, 2008 08:00 PM EDT.

 Germany
 Berlin- Thursday November 13, 2008 07:00 PM CEST.
 Bonn- Thursday November 20, 2008 07:00 PM CEST.

 I want to add:
 Aachen- Thursday October 30, 2008 07:00 PM CEST

And also:

Frankfurt- Monday November 10, 2008 08:00 PM CEST

cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Customizing controls: Inheritance bad?

2008-10-30 Thread Jean-Daniel Dupas


Le 30 oct. 08 à 16:51, Brian Williams a écrit :


Hello,



I'm brand new to Cocoa/Obj-C and I'm working on converting an app. to
use Cocoa...



I've heard that, in general, if you are using inheritance in Cocoa,
you're not following the typical standard design pattern.  Is this  
true?




To respond to special keyboard events in an NSTableView, I created a
subclass and provided an implementation for keyDown.

To draw some customized stuff in an NSColorWell, I created a subclass
and provided an implementation for drawRect.

Etc.



In the olden days, this kind of object-oriented approach was perfectly
correct.



And it's always perfectly correct. That's the way to do it.




But I'm told I should be using delegate methods and firstResponders
somehow.


Yes, use them when they provide a way to do what you need (and it's  
often the case), but they do not fit for some kind of customization  
(like custom drawing).





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Type comparison warning

2008-10-30 Thread Dave Carrigan


On Oct 30, 2008, at 10:12 AM, DKJ wrote:

I'm probably missing something simple, but I don't understand why  
this line:


return (i == -1 ? [NSNull null] : [NSNumber numberWithInteger:i]);

(where i is an NSInteger) produces this warning:

comparison of distinct Objective-C types lacks a cast

(The return type of the method is id.)



The ternary conditional operator requires that both sides of the : are  
the same type. In your case, one is a NSNull* and one is a NSNumber*,  
and C has no idea that a NSNull* and a NSNumber* are in any way the  
same kind of pointer, which means that it has no idea what the type of  
the overall statement is. This would compile:


  return (i == -1 ? (id)[NSNull null] : (id)[NSNumber  
numberWithInteger:i]);


--
Dave Carrigan
[EMAIL PROTECTED]
Seattle, WA, USA



PGP.sig
Description: This is a digitally signed message part
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Porting from Windows to Mac

2008-10-30 Thread Scott Ribe
 Do I have any
 alternative for MFC in MAC OS?

No.

 I have gone through some posting on Apple lists and I found that there
 are 2 cross-platform tools Power Plant and Code Warrior.

CodeWarrior was a suite of tools, which was discontinued years ago, and
never supported Intel Macs.

PowerPlant was their framework, which was originally Mac-specific, later
ported to Windows, discontinued by them but still supported by some
long-time users, not of much use in porting MFC to Mac.

In fact, there's not really anything of much use in porting MFC to Mac. In
order to be cross-platform, and app needs to be designed with that goal in
mind. If this app was not so designed, then you may be the one who gets to
refactor it.

Whether you use something like wxWindows or QT, or separate UI from the
application functionality and reimplement the UI in Cocoa or Carbon, depends
on the details of the app.

***DO NOT*** expect that it's merely a matter of finding the corresponding
Mac API call for each Windows API call--the differences run deeper than
that. In order to be successful, you ***WILL*** have to learn to be a Mac
developer, period, no shortcuts.

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSOperationQueue broken?

2008-10-30 Thread Michael Ash
I hate to blame an OS bug but I see no other explanation, so here we go.

I have a program which uses NSOperationQueue heavily. It uses lots of
different queues each of which has a max concurrent operation count
set to 1. In this way, the NSOperationQueue functions as a
serialization mechanism, like a lock but easier to use. This is
extremely handy.

One unusual thing it does, which I think may be the thing that kills
it, is that it often enqueues a new operation from inside of an
existing one being run on the same queue. This is to provide more
granularity for cancellation or priorities. For example, when there is
a lot of data to process, the NSOperation I enqueue just processes the
first piece of it. Then when it's done processing, it enqueues a
second NSOperation which will continue the processing. This way if I
want to cancel processing or do some higher-priority operation, it
doesn't have to wait for everything.

Anyway, I very rarely get this exception:

*** -[NSInvocationOperation start]: receiver has already started or finished

And this then crashes the app, because it's happening on an internal
NSOperationQueue thread which doesn't have an exception handler. The
rarity made this really difficult to debug, but I finally twigged to
the problem and wrote a test case which reproduces the exception
easily... on some hardware. This is that test case:

#import Foundation/Foundation.h


@interface Tester : NSObject
{
NSOperationQueue *_queue;
}

- (void)test;

@end

@implementation Tester

- (id)init
{
if((self = [super init]))
{
_queue = [[NSOperationQueue alloc] init];
[_queue setMaxConcurrentOperationCount:1];
}
return self;
}

- (void)test
{
NSInvocationOperation *op = [[NSInvocationOperation alloc]
initWithTarget:self selector:_cmd object:nil];
[_queue addOperation:op];
[op release];
}

@end

int main(int argc, char **argv)
{
[NSAutoreleasePool new];

NSMutableArray *testers = [NSMutableArray array];
int i;
for(i = 0; i  10; i++)
[testers addObject:[[[Tester alloc] init] autorelease]];

for(Tester *tester in testers)
[tester test];

while(1) sleep(1000);
}

Compile and run and wait. On my Mac Pro it throws that exception
crashes inside of ten seconds with this backtrace:

#0  0x96480ff4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ ()
#1  0x9207ee3b in objc_exception_throw ()
#2  0x92db74de in -[NSOperation start] ()
#3  0x92db7112 in __runop ()
#4  0x902ae1f7 in _pthread_wqthread ()
#5  0x902ae0aa in start_wqthread ()

I've had a few other people test as well. Most of them said that they
experienced the same crash. Some said they saw no crash. This is not a
big surprise for a threading bug but it's a bit odd.

Anyway, I would really love for this to be my bug, because then I
could fix it and stop having this problem. If anyone sees anything I'm
doing wrong then please tell me what it is. Failing that, if anyone
happens to know of a workaround for this problem, I would love to hear
it. Otherwise it's off to write an NSOperationQueue replacement, a
task I'm steeling myself for but not looking forward to.

For the Apple types among us, I have filed this as rdar://6332143 .

Any tips, tricks, corrections, or criticisms are most welcome!

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -[_NSZombie methodSignatureForSelector:] not working

2008-10-30 Thread Chris Kane
As long as you don't foolishly have a signal handler for SIGTRAP setup  
to ignore it, the zombie mechanism causes its own debugger trap for  
you in 10.5 and later.  For stopping in the debugger purposes, no  
breakpoint is needed.  If you have a SIGTRAP handler, it will get  
called instead of a debugger trap, and you can break on your handler.


#import Foundation/Foundation.h

int main( int argc, char **argv ) {
   id dead = [NSObject new];
   [dead release];
   [dead self];
   return 0;
}

% cc test.m -framework Foundation -o dead
% ./dead
objc[12320]: FREED(id): message self sent to freed object=0xc04850
zsh: illegal hardware instruction  dead
%
% NSZombieEnabled=YES ./dead
2008-10-30 10:39:35.736 dead[12323:10b] *** -[NSObject self]: message  
sent to deallocated instance 0xc048b0

zsh: trace trap  NSZombieEnabled=YES dead


Chris Kane
Cocoa Frameworks, Apple


On Oct 30, 2008, at 10:03, Michael Ash wrote:


The famous TN2124
(http://developer.apple.com/technotes/tn2004/tn2124.html) has this to
say about debugging using zombies:

You can use GDB to set a breakpoint on -[_NSZombie
methodSignatureForSelector:] to further debug this sort of problem.

However this does not appear to work. GDB cannot resolve this
breakpoint, and indeed the _NSZombie class no longer appears to exist
on 10.5.5 (and presumably all of 10.5). This test program illustrates:

#import Foundation/Foundation.h

int main( int argc, char **argv )
{
   [NSAutoreleasePool new];

   id obj = [[NSObject alloc] init];
   [obj release];

   NSLog(@Class of released object is %@, _NSZombie is %@,
NSStringFromClass(obj-isa), NSClassFromString(@_NSZombie));

   return 0;
}

This is the output I get on my machine when the above is run with
NSZombieEnabled=YES:

2008-10-30 12:54:42.810 a.out[28706:10b] Class of released object is
_NSZombie_NSObject, _NSZombie is (null)

So it would appear that NSZombieEnabled has gone to creating dynamic
zombie classes rather than simply using a single _NSZombie class as in
days past. Which is fine. Except that I no longer know where to set my
breakpoint. Am I doing something wrong, or what's the substitute for
-[_NSZombie methodSignatureForSelector:]?

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Type comparison warning

2008-10-30 Thread Scott Ribe
First off, NSInteger is an object not an int and can't be directly compared
to an int. Second, i is not likely an NSInteger, it's a pointer to an
NSInteger, which means it can be compared to an int, via implicit or
explicit casting, but in the absence of an explicit cast, the compiler
assumes that's probably not what you intended to do.

Next, NSNull  NSNumber are distinct types; the ternary operator wants both
potential returns to be of the same type (or compatible types for some
meaning of compatible), so the compiler will warn you about that once you
fix the first problem. Just cast both to id and you'll be fine--assuming the
code that receives this id properly handles the fact that it may point to
different types.

I started to say this is all basic C stuff, but that's not quite fair. It's
the intersection of Objective-C extensions with the basic C rules, which
still hold true.


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


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Porting from Windows to Mac

2008-10-30 Thread Gary L. Wade
Check out this article on Apple's web site:

http://developer.apple.com/documentation/Porting/Conceptual/win32porting/win32porting.html

Essentially, CodeWarrior, for Mac development, should not be considered for new 
development (I have to use it for a legacy product, and there's lots of 
features it lacks, and debugging is painful under 10.4 and later, especially 
for Intel-based Macs).  Use Xcode instead; it's free and already available to 
you on your system disks.

PowerPlant, for the most part, was very useful before CarbonEvents and Cocoa 
came to be part of the Mac operating system, but since these facilities and 
many more became available, you'll be better off rewriting your code into 
platform-specific and platform-neutral logic, and then move your MFC-based code 
into the platform-specific section, which is where your Mac/Cocoa code will go, 
and any logic that doesn't really care about a particular platform should go 
into the platform-neutral area.

Hi all

I have to port a project form windows to Mac. The existing code is in
C++ and classes are inherited from MFC library classes. Do I have any
alternative for MFC in MAC OS?

I have gone through some posting on Apple lists and I found that there
are 2 cross-platform tools Power Plant and Code Warrior. Which one is
better and If I want to use any of them then do I need to install them
on Mac system and will I need to modify the code very much? Which type
of application do I need to choose for porting in Mac cocoa or carbon
or something?

Thanks in advance.

Regards
rksinghal
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Type comparison warning

2008-10-30 Thread Clark Cox
On Thu, Oct 30, 2008 at 10:47 AM, Scott Ribe [EMAIL PROTECTED] wrote:
 First off, NSInteger is an object not an int and can't be directly compared
 to an int.

Not true, NSInteger and NSUInteger are typedefs for plain integer
types, *not* Objective-C objects.

-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Customizing controls: Inheritance bad?

2008-10-30 Thread Andy Lee

On Oct 30, 2008, at 11:51 AM, Brian Williams wrote:

I've heard that, in general, if you are using inheritance in Cocoa,
you're not following the typical standard design pattern.  Is this  
true?


I would say that's an overstatement.  Many Cocoa classes are designed  
so that you should only need to subclass them rarely, and often with  
fairly minor modifications to the inherited behavior.  If you find  
yourself doing a lot of work in a subclass, you should check whether  
the base class provides a simpler way to do it, perhaps with a  
delegate.  Maybe, maybe not.



To respond to special keyboard events in an NSTableView, I created a
subclass and provided an implementation for keyDown.

To draw some customized stuff in an NSColorWell, I created a subclass
and provided an implementation for drawRect.


Overriding keyDown: and drawRect: (the colons are significant) is not  
uncommon.



But I'm told I should be using delegate methods and firstResponders
somehow.


If a delegate method exists that does what you want to do, then it  
only makes sense to use it.



In general, is there a preferred approach to using actions over
delegates, and delegates over handling Cocoa events?  It seems there  
are

many different ways to handle the same problem and some ways are
preferred over others...


You forgot notifications. :)

I'm sorry I don't have time to dig up links -- this topic has been  
addressed very well by others.


Bottom line, there isn't a blanket rule or philosophy in Cocoa that  
delegates are good and subclassing is bad.  Hope this helps.


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Type comparison warning

2008-10-30 Thread Scott Ribe
 Not true, NSInteger and NSUInteger are typedefs for plain integer
 types, *not* Objective-C objects.

Yes, yes, yes. Thanks for pointing that out. I'm not doing 10.5-only
development yet, so I read NSNumber because I'm not used to seeing
NSInteger anywhere.

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Type comparison warning

2008-10-30 Thread Jean-Daniel Dupas


Le 30 oct. 08 à 19:01, Scott Ribe a écrit :


Not true, NSInteger and NSUInteger are typedefs for plain integer
types, *not* Objective-C objects.


Yes, yes, yes. Thanks for pointing that out. I'm not doing 10.5-only
development yet, so I read NSNumber because I'm not used to seeing
NSInteger anywhere.


NSInteger can safely be used for developpement that target any OS 10  
version (it is binary compatible with previous OS X version).


All my projects that target 10.4 already use NSInteger (and are 64  
bits safe).


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-30 Thread Christopher Hickman
***DO NOT*** expect that it's merely a matter of finding the corresponding
Mac API call for each Windows API call--the differences run deeper than
that. In order to be successful, you ***WILL*** have to learn to be a Mac
developer, period, no shortcuts.

Don't let that scare you.  It's easier than you think.  And in the end, you'll 
go back to Win32 grumbling about how much extra work you have to do there. ;)

Topher
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: -[_NSZombie methodSignatureForSelector:] not working

2008-10-30 Thread Michael Ash
On Thu, Oct 30, 2008 at 1:41 PM, Chris Kane [EMAIL PROTECTED] wrote:
 As long as you don't foolishly have a signal handler for SIGTRAP setup to
 ignore it, the zombie mechanism causes its own debugger trap for you in 10.5
 and later.  For stopping in the debugger purposes, no breakpoint is needed.
  If you have a SIGTRAP handler, it will get called instead of a debugger
 trap, and you can break on your handler.

Thank you very much for the information. It seems that the technote
needs to be updated, but this is not such a big deal if it will break
in the debugger automatically. I'll file a bug on it.

What prompted the original question, though, was that my debugger was
*not* stopping. Of course when I test it now it stops fine. But before
I saw several zombie messages logged over the space of a few minutes
before another exception (the NSOperation exception I posted about in
another message) brought things down.

Perhaps this should go over to the xcode-users list, but since you
mentioned it, what could cause me to foolishly ignore SIGTRAP? I don't
have any signal handlers installed in the program in question, and a
quick test of messaging a released object at the top of main() breaks
into the debugger correctly, as do tests in a couple of other
locations I tried. Maybe I just imagined the previous difficulty

In any case, thanks again for the information, it's good to know how this works.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-30 Thread Martin Stoufer
wax sentimental='true'Ah, CodeWarrior. I first cut my coding teeth on 
that ol' app. What an experience it was to actually design my own apps. 
Those were the days./wax

OK, so I actually used gcc before that, but still

I have to agree with Gary on this one. I have ported over a few 
dead-on-the-vine Win32 apps into a modern Cocoa based version. I have 
found that once you rectify the MVC designs strategies on each side, the 
development in XCode goes rather easy. On every project, the process of 
getting the business logic from the old app cast into the better design 
has consistently been a challenge. I wish Rakesh good will in this most 
noble of ventures and offer my help in decrypting the MFC.



Gary L. Wade wrote:

Check out this article on Apple's web site:

http://developer.apple.com/documentation/Porting/Conceptual/win32porting/win32porting.html

Essentially, CodeWarrior, for Mac development, should not be considered for new 
development (I have to use it for a legacy product, and there's lots of 
features it lacks, and debugging is painful under 10.4 and later, especially 
for Intel-based Macs).  Use Xcode instead; it's free and already available to 
you on your system disks.

PowerPlant, for the most part, was very useful before CarbonEvents and Cocoa 
came to be part of the Mac operating system, but since these facilities and 
many more became available, you'll be better off rewriting your code into 
platform-specific and platform-neutral logic, and then move your MFC-based code 
into the platform-specific section, which is where your Mac/Cocoa code will go, 
and any logic that doesn't really care about a particular platform should go 
into the platform-neutral area.

  

Hi all

I have to port a project form windows to Mac. The existing code is in
C++ and classes are inherited from MFC library classes. Do I have any
alternative for MFC in MAC OS?

I have gone through some posting on Apple lists and I found that there
are 2 cross-platform tools Power Plant and Code Warrior. Which one is
better and If I want to use any of them then do I need to install them
on Mac system and will I need to modify the code very much? Which type
of application do I need to choose for porting in Mac cocoa or carbon
or something?

Thanks in advance.

Regards
rksinghal


___

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

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

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

This email sent to [EMAIL PROTECTED]
  


--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *



smime.p7s
Description: S/MIME Cryptographic Signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: NSOperationQueue broken?

2008-10-30 Thread Quincey Morris

On Oct 30, 2008, at 10:40, Michael Ash wrote:


   [_queue addOperation:op];


Have you tried using performSelectorOnMainThread: to force serializing  
of the queuing? It might be an acceptable workaround, if it works.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Need help programatically wiring up an NSTreeController to an NSOutlineView

2008-10-30 Thread Ken Tozier

Hi

I've been Googling bindings, and reading the Apple bindings  
documentation for a week, but have gotten nowhere on this one. I  
desperately need help from someone who knows programmatic bindings.


I have a class where I store all properties in an NSMutableDictionary  
and wrote a few accessors to make it simpler to access some of the  
items stored in the dictionary. The program compiles without errors  
and runs fine until I try to programatically add new instances of the  
class to a bound NSMutableArray, which is giving me the following error:


-[NSCFArray _valueForKeyPath:ofObjectAtIndexPath:]: unrecognized  
selector sent to instance 0x11d29350


If anyone could point out where I'm screwing up in the example code  
below it would be hugely appreciated.


Thanks in advance.



Here's what the stripped down class looks like:

--

@interface PMProject : NSObject
{
NSMutableDictionary *properties;
}

// Name accessor
- (NSString *) name;

// Required NSTreeController methods
- (NSArray *) children;
- (BOOL) isLeafNode;

@end

@implementation PMProject

- (id) init
{
self = [super init];
if (self)
{
properties = [[NSMutableDictionary alloc] init];

[properties setObject: @CO_01-05 forKey: @display_name];
[properties setObject: [NSArray array] forKey: @children];
}

return self;
}

- (NSString *) name
{
NSLog(@Entered: MyProject: name);
return [properties objectForKey: @display_name];
}

- (NSArray *) children
{
NSLog(@Entered: MyProject:children);
return [properties objectForKey: @children];
}

- (BOOL) isLeafNode
{
NSLog(@Entered: MyProject:isLeafNode);
return ([[self children] count] == 1) ? YES : NO ;
}

@end

--

A higher level object (PMController ) contains an NSMutableArray  
property which stores a collection of  PMProject objects and an  
NSTreeController property to serve as the intermediary between the  
NSMutableArray and an NSOutlineView.


I'm setting up the NSTreeController like so:

- (void) initTableController
{
tableController = [[NSTreeController alloc] initWithContent: 
nil];
[tableController setChildrenKeyPath: @children];
[tableController setLeafKeyPath: @isLeafNode];
// NOTE: PMController is a singleton class that stores an
// NSMutable array of currently open PMProject objects
	[tableController bind: @contentArray toObject: [PMController  
sharedController] withKeyPath: @currentProjects options: nil];

}

And am trying to bind the name column of the NSOutlineView to the  
NSTreeController like this


- (void) initMyProjectOutline
{
// create text cell
nameCell= [[NSTextFieldCell alloc] init];

// create the name column
nameColumn  = [[NSTableColumn alloc] initWithIdentifier: 
@name];
[nameColumn setDataCell: nameCell];
[nameColumn setMinWidth: 1000];
// bind value to MyProject:name accessor
	// NOTE: I've tried both of the following but am getting nothing in  
the NSOutlineView name column
	[nameColumn bind: @value toObject: tableController withKeyPath:  
@content.name options: nil];
	[nameColumn bind: @value toObject: [tableController content]  
withKeyPath: @name options: nil];


// create the table
table   = [[NSOutlineView alloc] initWithFrame: tableFrame];
[table addTableColumn: nameColumn];
[table setHeaderView: nil];
[table setAutoresizingMask: NSViewWidthSizable | NSViewMaxYMargin];
[table setUsesAlternatingRowBackgroundColors: YES];
[table setFocusRingType: NSFocusRingTypeNone];
	[table setColumnAutoresizingStyle:  
NSTableViewLastColumnOnlyAutoresizingStyle];
	[table bind: @content toObject: tableController withKeyPath:  
@content options: nil];


[self addSubview: table];
}


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOperationQueue broken?

2008-10-30 Thread Michael Ash
On Thu, Oct 30, 2008 at 2:45 PM, Quincey Morris
[EMAIL PROTECTED] wrote:
 On Oct 30, 2008, at 10:40, Michael Ash wrote:

   [_queue addOperation:op];

 Have you tried using performSelectorOnMainThread: to force serializing of
 the queuing? It might be an acceptable workaround, if it works.

I haven't, simply because this stuff is performance critical and
having it get blocked because the main thread is busy processing user
input is unacceptable. So alas, while that may get around whatever bug
I'm encountering, it's not a usable workaround for me.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-30 Thread Ricky Sharp


On Oct 30, 2008, at 12:49 PM, Gary L. Wade wrote:


Check out this article on Apple's web site:

http://developer.apple.com/documentation/Porting/Conceptual/win32porting/win32porting.html 



Essentially, CodeWarrior, for Mac development, should not be  
considered for new development (I have to use it for a legacy  
product, and there's lots of features it lacks, and debugging is  
painful under 10.4 and later, especially for Intel-based Macs).  Use  
Xcode instead; it's free and already available to you on your system  
disks.


PowerPlant, for the most part, was very useful before CarbonEvents  
and Cocoa came to be part of the Mac operating system, but since  
these facilities and many more became available, you'll be better  
off rewriting your code into platform-specific and platform-neutral  
logic, and then move your MFC-based code into the platform-specific  
section, which is where your Mac/Cocoa code will go, and any logic  
that doesn't really care about a particular platform should go into  
the platform-neutral area.



I have to strongly second this approach.  Of the 15 frameworks I've  
authored and/or used over the years, the most successful apps written  
always contained platform-specific UI.


If you attempt to go cross-platform for everything, the app typically  
suffers (since you're now dealing with a least-common-denominator UI  
and many religious wars such a button placements).  Also have found  
that the amount of workarounds and/or bugs in such frameworks are  
often quite high.  So the benefits of the so-called write-once are  
typically lost.


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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-30 Thread Paul Archibald

Amen.

Codewarrior is dead, long live Xcode. (I still mourn CodeWarrior, but  
what's past is past.)


I did some work with MFC a couple of years ago, and thought it was  
pretty nice (not elegant, but productive). Now, I am trying to port  
my Cocoa app to Windows, and for various reasons decided to go with  
MFC again. I cannot believe how much of a pain it is. I just learned  
some Cocoa/ObjC for my last project, and it was easier to learn Cocoa/ 
ObjC than to get this thing going in MFC/C++.


Get the Objective-C 2.0 Programming Language pdf from Apple, and  
have it printed out at Kinkos, and BUY A COPY OF Cocoa Programming  
for Mac OS X, Third Edition by Aaron Hillegass. While there is a  
learning curve for Cocoa/ObjC, once you get going you will look back  
at MFC with disdain.


Refactor the MFC project FIRST. Seperate the UI from the logic as  
much as possible. It should help you understand the MFC code better,  
and you might even be able to stick some of it in a dynamic library  
for reuse.


On Oct 30, 2008, at 11:21 AM, [EMAIL PROTECTED] wrote:

***DO NOT*** expect that it's merely a matter of finding the  
corresponding
Mac API call for each Windows API call--the differences run deeper  
than
that. In order to be successful, you ***WILL*** have to learn to  
be a Mac

developer, period, no shortcuts.


Don't let that scare you.  It's easier than you think.  And in the  
end, you'll go back to Win32 grumbling about how much extra work  
you have to do there. ;)


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-30 Thread Stefan Werner


On Oct 30, 2008, at 8:31 AM, Rakesh Singhal wrote:


I have to port a project form windows to Mac. The existing code is in
C++ and classes are inherited from MFC library classes. Do I have any
alternative for MFC in MAC OS?

I have gone through some posting on Apple lists and I found that there
are 2 cross-platform tools Power Plant and Code Warrior.


None of the two. What you want is Xcode (the standard IDE for Mac OS  
X) and, may I humbly suggest, wxWidgets. wxWidgets is a cross-platform  
toolkit that is not the same as MFC but probably one of the easiest to  
port to from MFC:

http://wiki.wxwidgets.org/WxWidgets_For_MFC_Programmers
 In fact, it appears that there's even a sed script to convert MFC  
code to wx code (can't vouch for it, I never tried it: http://wiki.wxwidgets.org/Helpers_For_Automated_Rescue_From_MFC) 
. wxWidgets uses native controls on both OS X and Windows.


Should you decide to use a Mac OS native API instead of a cross- 
platform toolkit, use Cocoa.


-Stefan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Image from font file

2008-10-30 Thread Jason Coco


On Oct 30, 2008, at 11:40 , Georg Seifert wrote:


hello,

I wonder what is the best way to render images from a font file with  
a given string. The font is not activated in the system.


I came up with:
- using Quicklook, but I could only get images with Ag (like the  
icon for font files), not the alphabetic overview I get in the  
finder. (is there a way to render a sting with it?)
- activating the font locally, render the image and deactivate it.  
(this is a bit overkill I suppose (and I didn’t tried it))

- using a framework (like freetype)

Any suggestions are appreciated


If it's a regular, supported (but not activated) font file, you can do  
something like this (this is what I do actually):


#import Cocoa/Cocoa.h
#import ApplicationServices/ApplicationServices.h

/* ... */

NSString* fontsFolder = [[[NSBundle mainBundle] resourcePath]  
stringByAppendingPathComponent:@/Fonts];

NSURL* fontsURL = [NSURL fileURLWithPath:fontsFolder];

OSStatus status;
FSRef fsRef;
CFURLGetFSRef((CFURLRef)fontsURL, fsRef);
status = ATSFontActivateFromFileReference(fsRef,  
kATSFontContextLocal, kATSFontFormatUnspecified, NULL,  
kATSOptionFlagsDefault, NULL);


NSFont* myFont = [NSFont fontWithName:@My Font size:12.0];
[mWelcomeLabel setFont:myFont];

/* ... */

In this example, it assumes that your font files are in the  
application bundled under the Resources directory in a directory named  
Fonts, so basically:


/Applications/MyApplication.app/Contents/Resources/Fonts/MyFont.dfont

BTW, this call doesn't require linking to the full Carobn framework,  
nor does it actually activate the font in the Font Book... just for  
this instance of your application.


HTH, Jason

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Can I put UTIs in NSFilesPromisePboardType promise drag array?

2008-10-30 Thread Nathan Vander Wilt
So I was reading through the Leopard AppKit release notes today, and  
stumbled across the Support for UTIs in NSView and NSWindow (a few  
sections below http://developer.apple.com/releasenotes/Cocoa/AppKit.html#UTIs) 
.


It states:
NSView's -dragPromisedFilesOfTypes:fromRect:source:slideBack:event:  
method now accepts UTIs as type strings, in addition to the sort of  
file name extensions that were accepted in Mac OS 10.4.


So it looks like there is NOT any reason to build an  
NSFilesPromisePboardType array out of UTIs on 10.5+ after all! I've  
filed yet another why is this only buried in the release notes?!?  
bug on the documentation: rdar://problem/6332711.


thanks,
-natevw


On Oct 1, 2008, at 2:27 PM, Nathan Vander Wilt wrote:

I am initiating a promise drag by adding an array of strings to my  
pasteboard using for the NSFilesPromisePboardType. The documentation  
states that the types can be specified as filename extensions or as  
HFS file types encoded [as strings]. Is there any reason to not  
build an array of UTIs instead?


thanks,
-natevw
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Image from font file

2008-10-30 Thread Georg Seifert

Thanks for your answer. I found this with google, too.

The problem is, I want to build somthing like a font preview app. So  
it needs to be fast and may happen with 10 or even 50 fonts at once.  
And it may conflict with activated fonts.


Georg

Am 30.10.2008 um 20:22 schrieb Jason Coco:



On Oct 30, 2008, at 11:40 , Georg Seifert wrote:


hello,

I wonder what is the best way to render images from a font file  
with a given string. The font is not activated in the system.


I came up with:
- using Quicklook, but I could only get images with Ag (like the  
icon for font files), not the alphabetic overview I get in the  
finder. (is there a way to render a sting with it?)
- activating the font locally, render the image and deactivate it.  
(this is a bit overkill I suppose (and I didn’t tried it))

- using a framework (like freetype)

Any suggestions are appreciated


If it's a regular, supported (but not activated) font file, you can  
do something like this (this is what I do actually):


#import Cocoa/Cocoa.h
#import ApplicationServices/ApplicationServices.h

/* ... */

NSString* fontsFolder = [[[NSBundle mainBundle] resourcePath]  
stringByAppendingPathComponent:@/Fonts];

NSURL* fontsURL = [NSURL fileURLWithPath:fontsFolder];

OSStatus status;
FSRef fsRef;
CFURLGetFSRef((CFURLRef)fontsURL, fsRef);
status = ATSFontActivateFromFileReference(fsRef,  
kATSFontContextLocal, kATSFontFormatUnspecified, NULL,  
kATSOptionFlagsDefault, NULL);


NSFont* myFont = [NSFont fontWithName:@My Font size:12.0];
[mWelcomeLabel setFont:myFont];

/* ... */

In this example, it assumes that your font files are in the  
application bundled under the Resources directory in a directory  
named Fonts, so basically:


/Applications/MyApplication.app/Contents/Resources/Fonts/MyFont.dfont

BTW, this call doesn't require linking to the full Carobn framework,  
nor does it actually activate the font in the Font Book... just for  
this instance of your application.


HTH, Jason


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTask and get results

2008-10-30 Thread Jason Coco


On Oct 30, 2008, at 16:54 , J. Todd Slack wrote:


Hi All,

Can I run an NSTask and get the results back for parsing?

I looked at CocoaDev and I see that I can specify a pipe, which  
needs a file to write to, but can I just get the results back in an  
array or something?


You would have to read the piped output yourself and put it into an  
array... depending on how the other app outputs it may not be that  
hard (like read the output
directly into NSData, then to a split string that outputs your  
array... assuming that there is some kind of field separater generated  
by the other app. However...


I am running a SQL query and I wish the results to be returned to  
me. I am returning one field as a result of the select statement.


Why not just do the SQL query yourself? Use the database's native C  
library (or, even better, Objective-C bindings if it has one), or ODBC  
if the other database may change. I would definitely do it that way  
instead of using NSTask to run some command line utility and then  
trying to parse the output.


J

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Image from font file

2008-10-30 Thread Jason Coco


On Oct 30, 2008, at 16:32 , Georg Seifert wrote:


Thanks for your answer. I found this with google, too.

The problem is, I want to build somthing like a font preview app. So  
it needs to be fast and may happen with 10 or even 50 fonts at once.  
And it may conflict with activated fonts.


Well, you can use the ATS calls to activate whole directories of fonts  
at once. There are also result codes you can check if fonts were  
invalid (when activating multiple at once). It shouldn't cause any  
conflicts. If the font is already active then it's already active.

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

detecting an option-click on a button

2008-10-30 Thread Paul Archibald
Is there a simple way to detect that the option key was down when a  
button was clicked? I have a method in my controller that gets the  
button click, of course, and I have been trying this:


-(IBAction) handleButton:(id)sender {

if( [[NSApp currentEvent] modifierFlags]  NSAlternateKeyMask ) {
// handle option + click
}
else {
// do normal stuff
}
}

but of course the currentEvent is not necessarily related to the  
sender. In fact, I realize there is no reason to think that there  
should be any information about the keyboard status in the sender  
parameter.





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-30 Thread Νικόλας Τουμπέλης
I haven't done any porting between the two platforms, but I have worked with
both for some time.

It's not easy to port such an application and be prepared to rewrite most of
the code (not counting the learning curve). All the GUI stuff, you have to
separate from the model, in order to have a decent starting point and make
your life easier. Hence, a lot of refactoring beforehand (and some decent
unit testing).

You have to take into account that Mac development is centered on the MVC
pattern and the tools are built for that purpose. You will find that the GUI
designer (Interface Builder) is separate from the code editor (Xcode) and
you don't have the same mixed up model that e.g. Visual Studio and Delphi
promote.

I would also recommend that you start over with the design of your GUI, for
the sensibilities and design principles of Mac OS X are very different. This
difference is exacerbated if you consider the age of MFC...


- Nick

email: [EMAIL PROTECTED]
twitter: macsphere
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOperationQueue broken?

2008-10-30 Thread Jamie Johnson


Looks like you're hosing memory because the subsequent invocation  
operations are being released prior to their completion as seen in  
this call stack:


#0  0x1a0c in -[MyOp dealloc] at NSOp-Test.m:27
#1  0x94fba20f in NSPopAutoreleasePool
#2  0x9504f3a8 in -[NSOperation start]
#3  0x1ad6 in -[MyOp start] at NSOp-Test.m:39

As a guess the NSOperationQueue places the operation in an  
autoreleasepool, not really retaining it itself. The nearest pool  
happens to be constructed in NSOperation -start. Upon exit boom!


By reorganizing the problem you should be able to avoid this apparent  
bug. As I understand it you have a task that can be broken down into a  
serializable set of operations. Decompose the task into a Queue with N 
+1 operations. Each of the N operations are configured with their  
chunk of the data to process, the +1 is simply an operation whose  
dependent upon the complete set of N and serves to trigger a  
notification that the task is complete. If an ordering is required  
configure the dependency appropriately.


To support canceling tell the queue to -cancelAllOperations.

Jamie

On Oct 30, 2008, at 11:51 AM, Michael Ash wrote:


On Thu, Oct 30, 2008 at 2:45 PM, Quincey Morris
[EMAIL PROTECTED] wrote:

On Oct 30, 2008, at 10:40, Michael Ash wrote:


 [_queue addOperation:op];


Have you tried using performSelectorOnMainThread: to force  
serializing of

the queuing? It might be an acceptable workaround, if it works.


I haven't, simply because this stuff is performance critical and
having it get blocked because the main thread is busy processing user
input is unacceptable. So alas, while that may get around whatever bug
I'm encountering, it's not a usable workaround for me.
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-30 Thread Tommy Nordgren


On 30 okt 2008, at 08.31, Rakesh Singhal wrote:


Hi all

I have to port a project form windows to Mac. The existing code is in
C++ and classes are inherited from MFC library classes. Do I have any
alternative for MFC in MAC OS?

I have gone through some posting on Apple lists and I found that there
are 2 cross-platform tools Power Plant and Code Warrior. Which one is
better and If I want to use any of them then do I need to install them
on Mac system and will I need to modify the code very much? Which type
of application do I need to choose for porting in Mac cocoa or carbon
or something?

Thanks in advance.

Regards
rksinghal
___


I suggest you port your app to use the Qt framework from TrollTech
(http://www.trolltech.com) It is implemented in C++, and the native  
layer

on Mac OS X is implemented using Carbon and Cocoa.
You might have to implement some modules in your app differently
depending on target OS, particularly to get native look and feel.
The most important thing with using Qt, is that you will be able to
port your app to any unix dialect that uses X windows, as well.
--
What is a woman that you forsake her, and the hearth fire and the home  
acre,
to go with the old grey Widow Maker.  --Kipling, harp song of the Dane  
women

Tommy Nordgren
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-30 Thread Bill Bumgarner

On Oct 30, 2008, at 3:14 PM, Tommy Nordgren wrote:

I suggest you port your app to use the Qt framework from TrollTech
(http://www.trolltech.com) It is implemented in C++, and the native  
layer

on Mac OS X is implemented using Carbon and Cocoa.
You might have to implement some modules in your app differently
depending on target OS, particularly to get native look and feel.
The most important thing with using Qt, is that you will be able to
port your app to any unix dialect that uses X windows, as well.


Qt is good stuff, but be very careful going down this path.

While Qt applications are very portable, the Macintosh Qt apps tend to  
stick out like sore thumbs.


Google Earth, likely one of the most popular Qt applications around,  
is certainly an awesomely powerful application.


But the UI stinks.   It looks bad, it doesn't behave like standard Mac  
OS X applications, and it is generally clunky.


b.bum



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Porting from Windows to Mac

2008-10-30 Thread Stefan Werner


I would also recommend that you start over with the design of your  
GUI, for
the sensibilities and design principles of Mac OS X are very  
different. This

difference is exacerbated if you consider the age of MFC...


You are aware that MFC (1992) is younger than NextStep (1988)? ;-)
And if age is a criteria, we should always prefer Carbon over Posix.

-Stefan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Porting from Windows to Mac

2008-10-30 Thread Νικόλας Τουμπέλης

 You are aware that MFC (1992) is younger than NextStep (1988)? ;-)


I was mostly referring to the Mac OS X user interface...,


 And if age is a criteria, we should always prefer Carbon over Posix.


True :)


- Nick

email: [EMAIL PROTECTED]
twitter: macsphere


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Need help programatically wiring up an NSTreeController to an NSOutlineView

2008-10-30 Thread Ron Lue-Sang







A higher level object (PMController ) contains an NSMutableArray  
property which stores a collection of  PMProject objects and an  
NSTreeController property to serve as the intermediary between the  
NSMutableArray and an NSOutlineView.


I'm setting up the NSTreeController like so:

- (void) initTableController
{
tableController = [[NSTreeController alloc] initWithContent: 
nil];
[tableController setChildrenKeyPath: @children];
[tableController setLeafKeyPath: @isLeafNode];
// NOTE: PMController is a singleton class that stores an
// NSMutable array of currently open PMProject objects
	[tableController bind: @contentArray toObject: [PMController  
sharedController] withKeyPath: @currentProjects options: nil];

}

And am trying to bind the name column of the NSOutlineView to the  
NSTreeController like this


- (void) initMyProjectOutline
{
// create text cell
nameCell= [[NSTextFieldCell alloc] init];

// create the name column
nameColumn  = [[NSTableColumn alloc] initWithIdentifier: 
@name];
[nameColumn setDataCell: nameCell];
[nameColumn setMinWidth: 1000];
// bind value to MyProject:name accessor
	// NOTE: I've tried both of the following but am getting nothing in  
the NSOutlineView name column
	[nameColumn bind: @value toObject: tableController withKeyPath: @content.name 
 options: nil];
	[nameColumn bind: @value toObject: [tableController content]  
withKeyPath: @name options: nil];


// create the table
table   = [[NSOutlineView alloc] initWithFrame: tableFrame];
[table addTableColumn: nameColumn];
[table setHeaderView: nil];
[table setAutoresizingMask: NSViewWidthSizable | NSViewMaxYMargin];
[table setUsesAlternatingRowBackgroundColors: YES];
[table setFocusRingType: NSFocusRingTypeNone];
	[table setColumnAutoresizingStyle:  
NSTableViewLastColumnOnlyAutoresizingStyle];
	[table bind: @content toObject: tableController withKeyPath:  
@content options: nil];


[self addSubview: table];



Reverse the order here. Add the column to the outlineView and then  
bind it (the column). The binding for the column should be
	[nameColumn bind: @value toObject: tableController withKeyPath: @arrangedObjects.name 
 options: nil];


And you don't have to bind the outlineView's content at all. That  
happens automatically when you bind one of the outlineView's columns.  
By binding the column after it's added to the outlineView, you'll also  
get the sortDescriptors and selectionIndexPaths bindings set up for you.




--
RONZILLA

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: detecting an option-click on a button

2008-10-30 Thread Graham Cox


On 31 Oct 2008, at 8:51 am, Paul Archibald wrote:

but of course the currentEvent is not necessarily related to the  
sender



I think you'll find it is. Only one event is handled per event loop,  
and when the action method is called it's synchronous with that loop.  
Thus the current event will be the click that caused the action to get  
sent.


--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Horizontal Stepper

2008-10-30 Thread Jeffrey Goines
Hi,
is there an easy way to get a horizontal NSStepper?

I've tried it in Interface Builder with Affine Transform through Content
Filters (in the Effects Inspector)
but this rotates the visual representation out of the clickable space.

thank you,
Jeffrey
___

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

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

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

This email sent to [EMAIL PROTECTED]


When and how often do you mix C++ with Objective C in your project?

2008-10-30 Thread Boon Chew
Hi all,

I am a newbie to the cocoa world (PC - Mac switcher).  I have a fair amount of 
experience coding in C and C++ and I am just getting into Obj C now.  Right now 
I am trying to learn the language idioms and patterns in the Obj C world, 
specifically, when do you find yourself mixing C++ code with your Obj C code in 
your project?  How often do you do that? What's the pros and cons of doing that?

- boon




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Type comparison warning

2008-10-30 Thread Scott Ribe
 All my projects that target 10.4 already use NSInteger (and are 64
 bits safe).

I got an error when I first tried. Perhaps that was with a project that
still supports 10.3.9...

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Help with NSBitmapImageRep, please

2008-10-30 Thread M Pulis

Group,

I have a sensor device that give me raw data for an image of 1201 by  
861 pixels at 16 bits per pixel.


Although monochromatic, I would like to represent it in an RGB  
bitmap. I use an NSInteger [3] to populate the pixels via setPixel.


The result I get looks like the old TV horizontal hold is screwy,  
so I know that either my bitmap specifications are bogus or the  
sensor data is packed different than expected. I can draw lines  
programmatically into the bitmap, so I _think_ I'm close.



The fragment creating the bitmap prior to the setPixel loops is:

NSBitmapImageRep *aFrameBitmap=nil;
aFrameBitmap = [NSBitmapImageRep alloc];
[aFrameBitmap initWithBitmapDataPlanes:nil
pixelsWide:colCount
pixelsHigh:rowCount
bitsPerSample:16
samplesPerPixel:3
hasAlpha:NO 
isPlanar:NO
colorSpaceName:@NSCalibratedRGBColorSpace
// bitmapformat:0 /*??? as seen in CocoaDrawingGuide/Images/ 
chapter_7_section_5 but Xcode error ???*/
bytesPerRow:(colCount*2)*3  // colCount pixels wide by 2 bytes  
per pixel by 3 colors (RGB)

bitsPerPixel:0]; // allow cocoa to calc value

[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext

graphicsContextWithBitmapImageRep:aFrameBitmap]];


In support of the bogus specs theorem, however, are errors in the  
console that appear:


Error: CGBitmapContextCreate: unsupported parameter combination: 16  
integer bits/component; 48 bits/pixel; 3-component colorspace;  
kCGImageAlphaNone; 7206 bytes/row.

Error: CGContextScaleCTM: invalid context

So, what is wrong am I missing here?

Thanks,

Gary
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Type comparison warning

2008-10-30 Thread Nick Zitzmann


On Oct 30, 2008, at 6:03 PM, Scott Ribe wrote:

I got an error when I first tried. Perhaps that was with a project  
that

still supports 10.3.9...



If you're using an older SDK, then you can support NS(U)Integer and  
CGFloat in your older code just by copying the definitions from the  
Leopard SDK, taking out all of the 64-bit code (__LP64__), and putting  
the definitions in a place where they will be loaded _after_ the  
Foundation framework headers but _before_ your own code. This will  
help you get ready for 64-bit development when you're ready to take  
the plunge.


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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: When and how often do you mix C++ with Objective C in your project?

2008-10-30 Thread Kiel Gillard

On 31/10/2008, at 10:33 AM, Boon Chew wrote:


Hi all,

I am a newbie to the cocoa world (PC - Mac switcher).  I have a  
fair amount of experience coding in C and C++ and I am just getting  
into Obj C now.  Right now I am trying to learn the language idioms  
and patterns in the Obj C world, specifically, when do you find  
yourself mixing C++ code with your Obj C code in your project?  How  
often do you do that? What's the pros and cons of doing that?


- boon


Welcome to Cocoa with Objective-C!

Any new code I write I always used Objective-C. If I need to mix C++,  
it's usually because there is some legacy code that I need to support.  
This happens rarely.


I guess some pros are code reuse and enforcing structured/modular  
design (for example, I could write my model layer in C++ and write the  
controller and view layers in Objective-C using Cocoa). I would  
suspect some cons could be slightly slower compile times, inconsistent  
coding styles (alternating between similar yet slightly different  
languages) and missing out on some of the sweet features of Cocoa that  
Objective-C allows it to implement (key value coding, for example).


Kiel

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOperationQueue broken?

2008-10-30 Thread Michael Ash
On Thu, Oct 30, 2008 at 6:04 PM, Jamie Johnson [EMAIL PROTECTED] wrote:

 Looks like you're hosing memory because the subsequent invocation operations
 are being released prior to their completion as seen in this call stack:

 #0  0x1a0c in -[MyOp dealloc] at NSOp-Test.m:27
 #1  0x94fba20f in NSPopAutoreleasePool
 #2  0x9504f3a8 in -[NSOperation start]
 #3  0x1ad6 in -[MyOp start] at NSOp-Test.m:39

 As a guess the NSOperationQueue places the operation in an autoreleasepool,
 not really retaining it itself. The nearest pool happens to be constructed
 in NSOperation -start. Upon exit boom!

It's a good theory. Alas, I don't think it's the case.

To prove this, take my original test case and replace the -test method
with this group of methods:

- (void)test
{
[NSThread detachNewThreadSelector:@selector(_enqueueThread)
toTarget:self withObject:nil];
}

- (void)_enqueueThread
{
while(1)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSInvocationOperation *op = [[NSInvocationOperation alloc]
initWithTarget:self selector:@selector(_operationTarget) object:nil];
[_queue addOperation:op];
[op release];
[pool release];
}
}

- (void)_operationTarget
{
}

This avoids the pitfall you mention but still (on my computer) throws
the same exception as before.

Based on the state of the program when it crashes, it appears that the
problem is caused by a race condition which occasionally causes two of
the worker threads that NSOperationQueue spawns to dequeue and execute
the same NSOperation. Since an NSOperation is only supposed to run
once, things fall down go boom. This is just a theory, mind, and I'm
not sure of it yet.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help with NSBitmapImageRep, please

2008-10-30 Thread Graham Cox


On 31 Oct 2008, at 11:12 am, M Pulis wrote:

Error: CGBitmapContextCreate: unsupported parameter combination:  
16 integer bits/component; 48 bits/pixel; 3-component colorspace;  
kCGImageAlphaNone; 7206 bytes/row.

Error: CGContextScaleCTM: invalid context

So, what is wrong am I missing here?



What it says. You can't have 16 bits per pixel RGB bitmaps, they are  
not supported.


You can have 16 bits per pixel monochromatic images, or you can have 8  
bits per pixel RGB. If you want to convert your 16 bit image to RGB,  
you will have to compress it down to 8 bits - you can do that simply  
by taking the top 8 bits of each 16 bit pixel and replicating it  
across the three R, G and B components. Of course you'll lose a lot of  
dynamic range, but the image will look roughly the same.


Also, GetPixel/SetPixel are very slow - you'll be better off just  
doing the conversion on a raw block of memory and wrapping a bitmap  
rep around it when you're done.



hth,  Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help with NSBitmapImageRep, please

2008-10-30 Thread Graham Cox


On 31 Oct 2008, at 11:44 am, Graham Cox wrote:


You can't have 16 bits per pixel RGB bitmaps



I mean 16 bits per *COMPONENT*, not pixel - slip of the pen ;-)

--Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What's wrong with this font thing?

2008-10-30 Thread Aki Inoue
Looks like the typesetter behavior used by these NSStringDrawing  
methods are affecting the default line height.


Please file a bug.

Thanks,

Aki

On 2008/10/30, at 9:19, Randall Meadows wrote:


On Oct 30, 2008, at 10:02 AM, Randall Meadows wrote:


On Oct 30, 2008, at 9:53 AM, Randall Meadows wrote:

So how can I get a the width that a particular string is going to  
be drawn in, *and* disable that subsitution?  Will calling  
NSLayoutManager setUsesScreenFonts:NO before calling NSString  
sizeWithAttributes: do the right thing?  Or is there another tack  
I should be taking?


And where would I get a layout manager from if I'm trying to disable  
this before determining the size, not actually drawing it?


OK, I just tried passing

NSSize thisSize = [self boundingRectWithSize:NSMakeSize(CGFLOAT_MAX,  
CGFLOAT_MAX)

  options:NSStringDrawingDisableScreenFontSubstitution
  attributes:attrs].size;

and got the exact same behavior as I originally did, where a point  
size of 16 generated a height of 18, but a point size of 15  
generated a height of 21, so apparently this did NOT disable the  
substitution.  Does that only work in conjunction with other flags?

___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


NSTextView actions

2008-10-30 Thread Randall Meadows
OK, last text-related question of the day (I promise, only because I'm  
calling it a day after I send this)...


I have an NSTextView, in an NSScrollView, (loaded from a nib) that I  
embed in a custom view at runtime; I also draw a reflection of that  
custom view.


I figured out how to do a live reflection, where the reflection  
updates in real-time as the scroll bar is dragged around.  However,  
it's only a partial solution, and while it works (partially), it's  
butt-ugly, and I'm guessing there must be a more elegant way to do  
this than what I'm doing.


To do the live-drag reflection, I cache the original target/action of  
the scroller, and stuff my own target/action into it instead.


originalAction = [verticalScroller action];
originalTarget = [verticalScroller target];
[verticalScroller setTarget:self];
[verticalScroller setAction:@selector(scrollReflection:)];

In my action, I call

[originalTarget performSelector:originalAction withObject:sender];

to handle the knob drag itself, and then update my reflection view.   
This works great.  As long as I only drag the knob in the scroll bar.   
If I page or use the arrow keys, my action doesn't get called (I'm not  
using the scroll arrows themselves, so I don't know what happens in  
that case).


I looked for a notification or a delegate method on both NSScrollView  
and NSTextView, but I didn't find anything that seemed to tell me Hey  
you, my contents just changed position! so that I can update my  
reflection in all cases.


Hmmmwait a minute.  I think I see what's happening...

When I hit, for example, the Page Up area of the scroll bar, it  
animates to it's new position; my reflection updates only a very small  
portion of this change.  It doesn't at all when I hit the Page Up key,  
though.  Is the animation process taking long enough that the very  
next line of code is executed before it's done, and therefore I don't  
capture any (or most) of the scroll?  If so, is there some  
deterministic way I can tell when the scroll animation has completed,  
so I can update my view?



Thanks!
randy
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help with NSBitmapImageRep, please

2008-10-30 Thread Adam R. Maxwell
 
On Thursday, October 30, 2008, at 05:12PM, M Pulis [EMAIL PROTECTED] wrote:

   NSBitmapImageRep *aFrameBitmap=nil;
   aFrameBitmap = [NSBitmapImageRep alloc];
   [aFrameBitmap initWithBitmapDataPlanes:nil

Missed this in my previous message: you need to assign the result of 
[aFrameBitmap initWithBitmapDataPlanes...] or nest the alloc/init.  So do this:

NSBitmapImageRep *x = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:...] 

or the less-standard

NSBitmapImageRep *x = [NSBitmapImageRep alloc];
x = [x initWithBitmapDataPlanes:...];

I recommend the former, since it's a more typical Cocoa pattern.  Disregarding 
the result of the initializer can get you in trouble quickly.

-- 
Adam
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: When and how often do you mix C++ with Objective C in your project?

2008-10-30 Thread Peter N Lewis
AI am a newbie to the cocoa world (PC - Mac switcher).  I have a 
fair amount of experience coding in C and C++ and I am just getting 
into Obj C now.  Right now I am trying to learn the language idioms 
and patterns in the Obj C world, specifically, when do you find 
yourself mixing C++ code with your Obj C code in your project?  How 
often do you do that? What's the pros and cons of doing that?


Keyboard Maestro was written entirely in in C++/Carbon.  There were a 
couple useful Cocoa classes, so I mixed them in (eg Cocoa has a 
method to expand ~ in file paths).


When it was time to start moving to Cocoa more seriously, I just 
turned the compiler on to Objective C++ for the entire project, 
recompiled and there was essentially no change (no size or speed 
changes were noticeable).  Then I just started writing Cocoa objects 
for various UI.  Many of my Cocoa objects have a C interface to 
create them and a C++ pointer as a delegate to interface with.


About the biggest issue is that you cannot have C++ objects in an 
Objective C object (their constructors and destructors wont be 
called).  You can happily have pointers to C++ objects though, you 
just have to manage the creation and destruction yourself (which can 
be a bit of a pain in Cocoa as there is no single constructor place - 
but fortunately (or not) you wont be using Garbage Collection any 
time soon so at least dealloc is a single point for removal in most 
cases).


You also need tor read the Apple docs on mixing Carbon  Cocoa.

Introduction to Carbon-Cocoa Integration Guide
http://developer.apple.com/documentation/Cocoa/Conceptual/CarbonCocoaDoc/CarbonCocoaDoc.html


But basically, it just works.  There isn't much pain with simply 
using Objective C++ and writing parts of your code in Cocoa.


Enjoy,
   Peter.

--
  Keyboard Maestro 3 Now Available!
Now With Status Menu triggers!

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


Re: NSTextView actions

2008-10-30 Thread Randall Meadows

On Oct 30, 2008, at 7:23 PM, Randall Meadows wrote:

When I hit, for example, the Page Up area of the scroll bar, it  
animates to it's new position; my reflection updates only a very  
small portion of this change.  It doesn't at all when I hit the Page  
Up key, though.  Is the animation process taking long enough that  
the very next line of code is executed before it's done, and  
therefore I don't capture any (or most) of the scroll?  If so, is  
there some deterministic way I can tell when the scroll animation  
has completed, so I can update my view?


Just for grins, I changed my call to update the reflection to use

performSelector:withObject:afterDelay:

instead, and while that does help the paging issue, it completely  
breaks dragging the knob; doing that now, it doesn't update at all  
until I release the mouse to end the drag.


It also did nothing when I press the Page Up/Dn or arrow keys,  
either.  So that's obviously not the solution.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Silicon Valley CocoaHeads ... ?

2008-10-30 Thread j o a r


On Oct 30, 2008, at 2:10 PM, Jay Reynolds Freeman wrote:


Excuse me wasting bandwidth, but I have the impression that the
Silicon Valley CocoaHeads group is dead or at least catatonic
at the moment, and thought I would double-check by asking here ...



Sorry for the delay. The lack of events recently is not for lack of  
trying, there has just been a number of unfortunate roadblocks. We're  
hoping to have a new event in the next couple of weeks. Stay tuned.


And yes, the CocoaHeads mailing list is probably better for questions  
like this one.


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: When and how often do you mix C++ with Objective C in your project?

2008-10-30 Thread Chris Hanson

On Oct 30, 2008, at 6:30 PM, Peter N Lewis wrote:

About the biggest issue is that you cannot have C++ objects in an  
Objective C object (their constructors and destructors wont be  
called).


You can enable this for code that targets Tiger and later using the  
Call C++ Default Ctors/Dtors in Objective-C build setting in Xcode  
(GCC_OBJC_CALL_CXX_CDTORS), which maps to the -fobjc-call-cxx-cdtors  
compiler flag.


However, even when using this flag, NSCopyObject() will not invoke  
copy constructors, so it should not be relied upon for classes that  
use that runtime function to conform to the NSCopying protocol.


  -- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: When and how often do you mix C++ with Objective C in your project?

2008-10-30 Thread Colin Barrett
On Thu, Oct 30, 2008 at 4:33 PM, Boon Chew [EMAIL PROTECTED] wrote:
 Hi all,

 I am a newbie to the cocoa world (PC - Mac switcher).  I have a fair amount 
 of experience coding in C and C++ and I am just getting into Obj C now.  
 Right now I am trying to learn the language idioms and patterns in the Obj C 
 world, specifically, when do you find yourself mixing C++ code with your Obj 
 C code in your project?  How often do you do that? What's the pros and cons 
 of doing that?

While the folks here have posted excellent advice about how to work
with C++ and ObjC, your question was when and how often do ObjC and
C++ mix.

The answer is: not often. The vast majority of the time people write
applications in pure ObjC (note that since ObjC is a pure superset of
C, this could involve syscalls or using a C library of some kind).

Most of the time ObjC and C++ are mixed out of necessity, not desire
(although there are some exceptions).

-Colin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOperationQueue broken?

2008-10-30 Thread Colin Barrett
On Thu, Oct 30, 2008 at 5:30 PM, Michael Ash [EMAIL PROTECTED] wrote:
 Based on the state of the program when it crashes, it appears that the
 problem is caused by a race condition which occasionally causes two of
 the worker threads that NSOperationQueue spawns to dequeue and execute
 the same NSOperation. Since an NSOperation is only supposed to run
 once, things fall down go boom. This is just a theory, mind, and I'm
 not sure of it yet.

I'm not sure it would help, but it might. You could try using the
dependency mechanism in addition to setting maxConcurrentOperations to
1. Keep track of the last NSOperation in your for loop and assign in
as you go.

If that fixes it, it could be a race in maxConcurrentOperations.

This is all highly speculative.
-Colin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Need help programatically wiring up an NSTreeController to an NSOutlineView

2008-10-30 Thread Ken Tozier


On Oct 30, 2008, at 7:22 PM, Ron Lue-Sang wrote:

Reverse the order here. Add the column to the outlineView and then  
bind it (the column). The binding for the column should be
	[nameColumn bind: @value toObject: tableController withKeyPath:  
@arrangedObjects.name options: nil];


And you don't have to bind the outlineView's content at all. That  
happens automatically when you bind one of the outlineView's  
columns. By binding the column after it's added to the outlineView,  
you'll also get the sortDescriptors and selectionIndexPaths bindings  
set up for you.


Thanks Ron. That was the ticket.

Next problem seems to be that the outline is seeing all objects as  
leaf nodes. My PMProject class has the following isLeafNode and  
children methods which is getting called and returning correct values.


Why is the outline seeing everything as a leaf node?

- (NSArray *) children
{
NSLog(@Entered: PMProject:children);
return pages;
}

- (BOOL) isLeafNode
{
	NSLog(@Entered: PMProject:isLeafNode: %@, ([pages count] == 1) ?  
@YES : @NO);

return ([pages count] == 1) ? YES : NO ;
}

Projects can contain one or more PMPage objects which also have the  
required children  and isLeafNode methods


- (NSArray *) children
{
return nil;
}

- (BOOL) isLeafNode
{
return YES ;
}

Even though I'm storing PMProjects and PMPages in standard Cocoa  
NSMutableArrays, do I need to add some sort of willChangeValueForKey  
somewhere in my add/remove projects/pages code?





___

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

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

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

This email sent to [EMAIL PROTECTED]


  1   2   >