Re: Making your own icons for buttons

Scott Raney ((no email))
Wed, 30 Jun 93 14:38:35 MDT

>
>
> Help!
>
> I am having a bit of trouble using our my own images for button icons. What
> I would like to do is to use an image, say in pbm format, and turn that
> into an image into an icon that a button can use. I got as far as this:
>
> 1. create a button
> 2. click on the icon button
> 3. go to the "my icons" card in the icon stack
> 4. double click on one of the icons to edit it; an icon edit window
> appears
> 5. type into the message box:
> import "pbm" from file "/home/damascus/d45/mcintyre/metacard/sa.pbm"
>
> The image then appears in the icon edit window.
>
> What do I do next? I have had several core dumps if I try to a window outside
> the button editing process. I have tried closing the icon edit window and
> nothing happens to the icon that I have selected to edit; the original
> image of the icon remains. I have also tried closing the icon selection window
> by using the "OK" button. Again, the icon on the button does not reflect the
> image that I imported.
>
> Has anybody done this successfully, and if so, could they tell me how to
> do it?

You most likely don't want to import icons into the "My Icons" stack,
as it has been set up with specific icon ids (i.e., you wouldn't be
able to use the icon chooser to pick the images you import anyway).

Any image can be used as an icon. All you have to do is set the
"icon" property of a button to the id of the image. There's nothing
special about the "my icons" stack or the "icon chooser" dialog.

The best place to put icons that will be used for a given project is
on an otherwise unused card of your mainStack, or in a substack of
that mainStack. If you're not going to be using any images in the
substacks, you can just use the id's as they are set when the image is
created. Otherwise, you'll want to set the ids of the images used as
icons so that they don't conflict with the ids of other images. We
recommend using ids in the 100,000s to minimize the potential for
conflict. Be sure you don't give two objects the same id, or the
second one will disappear forever.

Then just set the "icon" property of the button to the id of the image
that button should display. If you just have a few to do, use the
Message Box. If you have a lot of buttons, you may want to build a
little icon chooser dialog with one button per image/icon. As you can
see from the standard icon chooser dialog, the scripting involved is
pretty minimal. Just put something like the following into the card
script of the dialog:
on mouseUp
if word 1 of the selobj is "button"\
and word 1 if the target is "button"
then set the icon of the selobj to the icon of the target
end mouseUp

> Thanks,
>
> Susan McIntyre
> MPR Teltech Ltd,
> Burnaby, BC CANADA
>
> mcintyre@mprgate.mpr.ca
>

-- 
***********************************************************************
* Scott Raney  303-447-3936            Remember: the better you look, *
* raney@metacard.com                   the more you'll see -- Lidia   *
***********************************************************************