Page 1 of 1

Carbon calls to Cocoa gadgets

Posted: Mon Aug 06, 2012 9:16 pm
by WilliamL
With the introduction of 4.7 with gadgets that are created using Cocoa I'm wondering what happens in my old programs that modify gadgets with carbon calls? I would assume that the carbon calls wouldn't have any effect but will they also create IMA errors (getting those) or other errors? I'm guessing that carbon calls that don't involve gadgets (like printing) will still work fine in the 'x86' version.

Re: Carbon calls to Cocoa gadgets

Posted: Tue Aug 07, 2012 5:17 am
by wilbert
The Cocoa version of PureBasic is much different internally.
You still can use Carbon calls the OS supports but if they interact with PB objects, you will have problems.
GadgetID for example returns different kind of objects but also images are different ( Carbon uses CGImage, Cocoa uses NSImage ).
Most likely when you use Carbon API calls to modify PB gadgets and compile the same code with the Cocoa version of PB, it will crash.

Re: Carbon calls to Cocoa gadgets

Posted: Tue Aug 07, 2012 5:38 am
by J. Baker
Yeah, none of my ImportC functions work with the Cocoa version. I think it's best to stick with Cocoa from here on out. The way Apple is going, I wouldn't be surprised if OS X 10.9 (when that day comes) doesn't even support Carbon.

Re: Carbon calls to Cocoa gadgets

Posted: Tue Aug 07, 2012 5:23 pm
by WilliamL
So does the carbon printing still work ok for printing strings and images/lines/boxes?

I guess I'm going to have to start looking into re-creating my printing include file ( http://www.purebasic.fr/english/viewtop ... 06#p356265 ) in Cocoa. :shock:

Re: Carbon calls to Cocoa gadgets

Posted: Tue Aug 07, 2012 5:27 pm
by wilbert
One of the reasons for such code was the bad printing quality on OS X.
I have the impression the print quality has improved on the Cocoa version of PureBasic.

Re: Carbon calls to Cocoa gadgets

Posted: Tue Aug 07, 2012 5:34 pm
by WilliamL
I take that as a 'yes' that carbon printing still works.. or are you saying that printing in pb with cocoa will be good enough without resorting to API?

If not, as for the cocoa printing, I'll need some help there...

Re: Carbon calls to Cocoa gadgets

Posted: Tue Aug 07, 2012 5:56 pm
by wilbert
The code example from the PureBasic help file gives sharp text on my laser printer. :D
So what I was saying that it probably is good enough without any API calls.

Re: Carbon calls to Cocoa gadgets

Posted: Tue Aug 07, 2012 5:59 pm
by WilliamL
Whew! Thanks wilbert for trying it. I'll see how it goes for me and maybe the API (for printing) will be a thing of the past.