Re: Colored Buttons?
Re: Colored Buttons?
- Subject: Re: Colored Buttons?
- From: Dennis De Mars <email@hidden>
- Date: Sun, 4 Nov 2001 14:43:08 -0800
There's a little bit in IB Help on the subject. It's not much but it's
actually about enough to figure out how to do it, since it is pretty
simple to do.
I'll grant, though, that it is not obvious where to find the info. If
you bring up IB Help and search on "image" you'll get a couple of topics
pop up: "Storing Images" and "What's in the Nib File Window" Despite its
title, the first topic is not what you want, it just discusses embedding
image data in the nib file itself, which is off by default, the standard
thing is to have the images as separate files in your project, the nib
file just references them.
In the second topic, "What's in the Nib File Window," there is a
discussion of the tabs that you find in the nib file window (the window
that has your instances in it). For a Cocoa app, the tabs are
"Instances" "Images" "Sounds" and "Classes". The Image tab brings up the
image pane, and under the discussion of this pane in the IB Help topic
we we find the paragraph:
"The Image pane lets you view all of the tiff files that your nib file
can use. You can drag the images onto interface items, such as buttons
or graphic panes to add that image to the item."
So, to create your red button, you can do the following:
1) Create a red rectangle in some graphics app and store it as a tiff
file (you can probably use other formats, but tiff is the lowest common
denominator image representation in Cocoa).
2) Import it into your project, or just drag the file onto the "Images"
pane in your nib window (the nib file has to be part of an open project
for this to work, the file actually gets stored in a project folder).
3) Create a rounded bezel button in the desired location (this is the
button in the palette with the transparent rounded rectangle and a Mac
OS logo image in it).
4) Drag the image from your nib file image pane onto your button. The
image will now be displayed by the button.
This will work for some other button styles too. You'll want to
eliminate the border if you want the button to be all red.
You can also add text, but this can only be displayed next to the image,
not superimposed on top of it, which is probably not what you want. If
you want a red button with text, you'll probably have to add the text to
the image itself when you create it in your graphics app.
- Dennis D.
P.S. I agree that an IB manual is needed. I am sure Apple is working on
it, but it is certainly frustrating in the meantime. They may want to
wait until the IB and PB design settles down before they do a
comprehensive manual.
It is worthwhile to read the IB FAQ also, they cover some of the more
common stumbling blocks. There's nothing in there that would have helped
with your button color question, though.
On Sunday, November 4, 2001, at 01:29 PM, email@hidden wrote:
On Sunday, November 4, 2001, at 03:53 PM, Erik M. Buck wrote:
You can add images to the "images" suitcase in IB if you want
Suitcase? I find nothing that looks like a suitcase, and the IB Help
has nothing about a suitcase!
A bare minimum RTFM is in order.
Sorry, but damnit I do try. After looking over the docs on NSButton I
think I might understand how this is done, but I'm not sure at this
stage.
In any event, making a stupid button red or whatever seems like a lot
of work for a result of so little consequence. Is this a plot to
encourage people to adhere to Apple's idea of what looks good?
As for the FM: it does not exist as such. What does exist is
incomplete and often cryptic docs on the various classes, legacy stuff
scattered all over hell and gone, marginal tutorials from Apple, some
other better-than-marginal tutorials from other folks, an ill-advise
book called "Learning Cocoa," a worthless tome from Jesse Feiler, and
for someone like me who knows how to get his hands on an advance copy,
a book out of the Big Nerd Ranch that is a giant leap beyond the
bug-ridden Apple/O'Reilly nonsense. And this list! Thank you again,
but please remember in future that if I have not RTFM, it's because I
have not been able to find the bloody thing.
Brian E. Howard
Cocoa Cult Central
wishing for a FMTR
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev