Carbon calls to Cocoa gadgets

Mac OSX specific forum
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Carbon calls to Cocoa gadgets

Post 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.
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Carbon calls to Cocoa gadgets

Post 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.
User avatar
J. Baker
Addict
Addict
Posts: 2196
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Carbon calls to Cocoa gadgets

Post 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.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: Carbon calls to Cocoa gadgets

Post 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:
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Carbon calls to Cocoa gadgets

Post 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.
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: Carbon calls to Cocoa gadgets

Post 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...
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Carbon calls to Cocoa gadgets

Post 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.
WilliamL
Addict
Addict
Posts: 1259
Joined: Mon Aug 04, 2008 10:56 pm
Location: Seattle, USA

Re: Carbon calls to Cocoa gadgets

Post 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.
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
Post Reply