View Full Version : Putting an icon on your application
Panchito
2002.06.25, 11:00 PM
Hey all, I just finished my first macintosh app. Can anybody please explain to me how can I give my application an icon ? Let's say some pict file I've chosen ? Please be very clear, I'm still a beginner.
thanks,
Panchito
OneSadCookie
2002.06.25, 11:41 PM
Is your app a MaCOSX-only bundled application, a CFM Carbon bundled application, or a single-file CFM Application (either Carbon or Classic)? The process is different for each.
Feanor
2002.06.26, 12:10 AM
If you're not using Project Builder, I have no idea how to help you. But in PB, it's very simple.
1. Find a picture you like. Anything will do. In an image editing application (ideally photoshop), open the image and edit it to your heart's content. You ideally want to make an image that has a transparent background. If you're using photoshop or something like it, that is pretty straightforward. Make the image square, and ideally reduce it to 128x128 or some other square size. Save it in photoshop format or another format that supports transparency. (There's a way to do it with a jpeg but I haven't figured that out yet. Anyone who knows can add to this, please.)
2. Open the IconComposer application, found in the Dev Tools folder. Double click on the 128x128 square. This will get you an open dialog. Navigate to your image and open it. IconComposer with scale it for you as required if you tell it to. Do the same for the other image sizes, and say yes to the prompt to auto-generate a mask. (You can always make a 1-bit mask yourself). Save your new file (the .icns will be added automatically).
3. In project builder, go to the Project Menu and choose "Add Files...". Find your icon file. Add that to the project.
4. Select "Target" tab in the vertical tab set. Choose the target you want to set the icon for. Choose the Application settings tab in the target details pane. Scroll down to the Icon section. Type the full name of your icon file (with extension) in the space provided. Build and run your project.
I just did this for the first time tonight, following these steps, and added an icon to RaiseMan (the Cocoa app you build in Aaron Hillegass's book) -- the Enterprise, NX-01.
Cheers, F�anor
Here are the directions for ResEdit/CW:
Open your project and go to <Edit/YourProject Settings>
Click on the 'PPC Target' in the settings panel to your left
Then, to your right there should be an editable text field titled 'Creator'
Change that to what you want you creator code to be for your app (it is best to make it have a few upper and lower case letters, to keep from interfering with Apple's reserved, i.e. for a game called 'Rabbit Hunt' it could be 'RbHt')
Close the settings window, it should tell you that the project must be relinked, that's fine
Now open your projects resource file
Then you should be confronted again by an editable text field titled 'Signature'
Guess what goes there? Yep, your application's signature! (you know 'RbHt')
Then hit command-K
Kinda hard to explain what you are seeing now but to the left is the 'Type' field which probably says '????'
Change that to 'APPL'
To the right is the 'Finder Icons'
Double click on those
It will say: 'Choose a new icon type APPL'
Hit the 'New' button and it will send you to an icon editor
Draw or paste you nice little icon into all of the fields
When you are done, close the window
Your nice, neat resource window should now be littered with 'icn*' resources and other unruly things
Save your resource
Delete your old app that was compiled from your project
And then compile your project again and... FINISHED! Custom application icon!
Panchito
2002.06.27, 02:43 AM
Thanks a lot guys.
Jabber,
I followed your instructions up to filling in the creator field with a 4 letter name signature thing. It tells me it needs to relink. So I leave code warrior aside and I open ResEdit. I open the myfile.rsrc which is my aplication's resource file with ResEdit, but I don't see any 'signature' editable text field. Anyway, I press command K and I enter APPL. Then I see a new square among with other resource types ( I have PICT, ALRT, aete, DITL, DLGX and now I have an APPL square). I open that APPL square but it shows nothing, I cant write or paste anything. Can't find Finder Icons anywhere.
Please help :(
Panchito
kainsin
2002.06.27, 08:27 AM
The type and creator codes can be accessed that way in ResEdit. You can get to them by using the "Get File/Folder Info..." menu item in the File menu.
zwilnik
2002.06.27, 09:52 AM
One of the little features that I like about OS 9 and I don't think X will be truly complete until it has it, is 9's method for changing a file's Icons.
1a) Draw the icon in whatever graphic package you want. or
1b) Find an icon you like and get info on it's file. Select the icon box in the top left
2) Copy it
3) Select the file you want to put the icon on
4) Get Info
5) click on the icon box in the top left corner of the info window
6) Paste
that's it. no faffing around with Rez Edit, Project Builder, Code Warrior or anything.
Ok, so it isn't a huge major feature, but it's a bloody nice one :)
Ah, indeed I did skip a step. Mind works faster than the fingers... ;) You can use Zwilnik's way which would be a whole lot easier, but not nearly as, uh, cool :rolleyes: ... When you open your project's resource file, hit command-k. They will give you a list of available resource types, select the one that is called 'BNDL'. You should now see an editable text field that says 'Signature: ????' change that to your app's creator code and then hit command-k again. Now there will be a field which says 'Type: ????' change that to 'APPL'. Then double-click on the field that says 'Finder Icons'. A dialog should pop up that has a button on it that says 'New' click on that button. Now you can create your icon. Hope that explains it better. If you have any more questions, feel free to ask :)
Nimrod
2002.06.27, 11:42 AM
Originally posted by Zwilnik
One of the little features that I like about OS 9 and I don't think X will be truly complete until it has it, is 9's method for changing a file's Icons.
Works for me in 10.1.5, using 1a) and 1b) ...
namoreh
2002.06.27, 02:03 PM
Copying in to the get info box has always worked for me, athough OS X seems to only update the icon when it thinks it has to, because sometimes the old icon remains until I log out and log back in.
Feanor
2002.06.27, 04:09 PM
Originally posted by Zwilnik
One of the little features that I like about OS 9 and I don't think X will be truly complete until it has it, is 9's method for changing a file's Icons.
Works for me in OS X, why doesn't it work for you? People do it with folders all the time. Of course in both systems I think there's a possibility your transparency masks won't come out right. Furthermore, you can add 128bit icons to OS 9 applications and they'll show reduced ones in OS 9 and full size in OS X.
FÎanor
Nimrod
2002.06.27, 04:22 PM
Can somebody possibly summarise how to make 128*128, 32-bit icons for a single-file CFM application? I tend to use CodeWarrior, but have the OS X developer tools installed, so I can use them for icon creation. I'm already familiar with the 'old' way of doing it in classic for small 8-bit icons.
Cheers.
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.