Learning Carbon -Need Help

Mac OSX specific forum
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Learning Carbon -Need Help

Post by Nik »

Awaiting Purebasic for Intel Macs, I have started learning some carbon using Xcode and C++. I use nib files to create the Window but I can't seem to get a handle to the Controls in there, I use GetControlByID but it always returns 0 can anyone please help me to find my mistake?
Here is my small example:
http://www.sceneproject.org/~niklas/carbontest2.zip


//The Code should run on both PPC and Intel
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Ok the Problem is GetControlByID butthe problem is that SteControlTitleWithCFString() doesn't set the visible text of the control but som hidden property reading it out in turn works as expected, so now I need to find the function that sets the visibe Text of an EditText Control
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

Ok I solved the problem and managed to finish my example, you can download it here:
http://sceneproject.org/~niklas/carbontest2.zip
johnfinch
User
User
Posts: 45
Joined: Thu May 11, 2006 1:45 am
Location: florida
Contact:

Nice one Nik

Post by johnfinch »

I've been thinking of doing this myself while I wait for PB to be updated. Have you a good book that you recommend for learning Carbon and C++ on OSX? I don't like Objective-C nearly as much as C++.
Leopard-parallels-XP-Vista
Nik
Addict
Addict
Posts: 1017
Joined: Fri May 13, 2005 11:45 pm
Location: Germany
Contact:

Post by Nik »

I'm trying the Learning by Doing way since my mac was expensive and I don't want to spend even more money... seems good so far. Look at my example for a start then you can ask questions.
btw: There is a small mistake in the example: one string doesn't get freed so there is a small memory leak I have fixed it here and I will probably upload a fixed version.
jroad
User
User
Posts: 13
Joined: Sat Feb 04, 2006 10:07 pm

Re: Nice one Nik

Post by jroad »

johnfinch wrote:I've been thinking of doing this myself while I wait for PB to be updated. Have you a good book that you recommend for learning Carbon and C++ on OSX? I don't like Objective-C nearly as much as C++.
You can find some recommendations and resources at the MacRumors Programming forum:
http://forums.macrumors.com/showthread.php?t=90331
johnfinch
User
User
Posts: 45
Joined: Thu May 11, 2006 1:45 am
Location: florida
Contact:

Post by johnfinch »

I have been reading this book. It's rather good and will keep me entertained until the new PB4 MAC is realeased.

Mac OS X Programming by Dan Sydow

The book is all about programming in Carbon using C. It's a blast.

I'm really looking forward to PB4 for my Intel Mac though. It's just so much easier and more intuitive. Makes you wonder how C took over from Basic all those years ago. I remember using QuickBasic from MS for years and writing some excellent applications with it. But hey, we are fighting back again now. I look forward to all the OSX applications that will hit the streets when we have PB working :)
Leopard-parallels-XP-Vista
Post Reply