Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Links to hard code aqua buttons?

Links to hard code aqua buttons?
Thread Tools
loren s
Senior User
Join Date: Jul 2001
Status: Offline
Reply With Quote
Jul 9, 2003, 12:35 PM
 
Could you please help me with some links to tutorials on how to hard code aqua buttons without useing interface builder.
     
disco_stu
Junior Member
Join Date: Jun 2002
Location: Springfield
Status: Offline
Reply With Quote
Jul 9, 2003, 02:25 PM
 
I put this in my controller's awakeFromNib method:

- (void)awakeFromNib
{
NSButton *button = [[NSButton alloc] initWithFrame:NSMakeRect( 50.0, 50.0, 140.0, 32.0 )];
[button setBezelStyle:NSRoundedBezelStyle];
[button setTitle:@"Hello, World!"];
[[mainWindow contentView] addSubview:button];
[button release];
}

Explanation:

NSMakeRect makes a rect, or rectangle, that is the size of the frame of the button you want. So my button will be located at x=50.0, y=50.0, its width=140.0, and its height=32.0.

To make the button an Aqua style button, I set the bezel style to NSRoundedBezelStyle (you can change this to other bezel styles, see the documentation in file:///Developer/Documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSButton.html, assuming you have the developer's tools installed).

I then add the button that I just initialized to the window's (mainWindow) primary view (contentView). And voil�, that's it!

Hope that helps!
     
loren s  (op)
Senior User
Join Date: Jul 2001
Status: Offline
Reply With Quote
Jul 9, 2003, 11:11 PM
 
yes it does. Thankyou.
Anymore. ?

I am trying to port a unix program over to the aqua interface. So it will take some time.

^v^
     
disco_stu
Junior Member
Join Date: Jun 2002
Location: Springfield
Status: Offline
Reply With Quote
Jul 10, 2003, 10:11 AM
 
Anymore?
I'm not sure of any place online with actual tutorials (unless you try searching the cocoa-dev archives at cocoa.mamasam.com; you might find some code snippets there) but if you're looking for something else in particular - more sample code and such - let me know, I'd be glad to help out.
     
loren s  (op)
Senior User
Join Date: Jul 2001
Status: Offline
Reply With Quote
Jul 10, 2003, 11:48 AM
 
Yes you can help me, if you may.
Here is the file for the interface buttons in this program.
I have hacked in different colors before. But have failed countless times at getting aqua buttons . I did make a working mock up interface builder, but it was not anything but just the shell with no program in side of it.

And still that could very well much work. But that would take some know how on how to link everthing together. As I am only teaching myself cocoa and all of this codeing stuff.
So i figured that I should at least learn how the buttons are created in the first place.

On top of a trillion other things that I must do.

I thought that if I could get it to OSX aqua the program could get more developers.

Anyhow the code is in an html page .
Note: this program is running on OSX it just has the uglyest grey interface ever. It's interface is drawn in OpenGL . If that helps.

http://www.aprilcolo.com/butter/interface.html
     
disco_stu
Junior Member
Join Date: Jun 2002
Location: Springfield
Status: Offline
Reply With Quote
Jul 10, 2003, 02:33 PM
 
Errrr... yeah. I'm pretty much useless reading other people's code, especially if I don't know what it's trying to do, so why don't you just let me (us) know what this app is that you're trying to create? I see some OpenGL code - is it a game? Can you post a screen shot of what it looks like (ie, non OS X version) and the mockup of what you'd like the interface to look like (just a quick mockup in Interface Builder)? That'd be a start...
     
loren s  (op)
Senior User
Join Date: Jul 2001
Status: Offline
Reply With Quote
Jul 10, 2003, 06:07 PM
 
Ok. I have packed the nib and an app below.

The program is an Open Source 3d animation and game design suite.

I did not say so at first, because I did not want to look like I was promoting it.

You can get it here http://download.blender.org/release/....6-powerpc.dmg

And my file here
www.aprilcolo.com/butter/give.sit

Thankyou .
work work work ^v^
( Last edited by loren s; Jul 10, 2003 at 09:58 PM. )
     
disco_stu
Junior Member
Join Date: Jun 2002
Location: Springfield
Status: Offline
Reply With Quote
Jul 11, 2003, 12:09 AM
 
That looks like a pretty big undertaking. If this is your first attempt at Cocoa programming or just programming in general, I'd highly recommend that you pick a much simpler application to start off with.

That said, Blender is an open source application, released under the GPL license. I would assume that since it's open source, that they'd be happy to have some help 'aquafying' the OS X version. You can always check with their community of developers to see if you can offer them any assistance. I found this in the 'OSX tips.rtf' file in the disk image you linked to:

Why doesn't Blender use Aqua?

Blender runs at many different platforms, and all versions are utilizing OpenGL to draw the entire interface. This keeps the program portable, and makes it easier to maintain.
This is the reason why the look and feel of Blender is quite different from standard Aqua applications. Attempts to integrate Blender better with the OSX desktop are being in process. However, for the short term we don't expect a full Aqua version of Blender.
     
loren s  (op)
Senior User
Join Date: Jul 2001
Status: Offline
Reply With Quote
Jul 11, 2003, 12:18 AM
 
Aw well. Thankyou for your help.

I am the only one to pursue the aqua interface at this moment. And am told from the creator that they can not help me as they still need a real OSX guru. And I have tried to get just that but to no avail.

To big huh. Drat.
so much for that .

thankyou ^v^:
( Last edited by loren s; Jul 11, 2003 at 11:36 PM. )
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 07:48 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,