Creating Buttons

Hey guys-

I’ve been trying to think of how to do this. I need to either create buttons or load each one from a seperate nib file (both with images on the buttons). I’ve been trying to get this to work, but I can’t.

Any help is appreciated. :slight_smile:

Thank you!

Without more information about exactly what you are trying to do, what you have tried, what you can do, what you can’t do etc. I can’t really help. There are many more ways to accomplish what you want than what you think. Is it possible you can create the buttons ahead of time and then make them visible/invisible when you need? Can you create a second window containing all of the buttons and have that window be invisible, then just move the buttons back and forth between your visible and invisible window? If you have a blank button can you set an image to the button programmatically? Do you know how to use call methods to access objective-c methods? As I said, without knowing more I can’t really suggest anything.

I can’t create the buttons ahead of time & make them visible because the images will be different.
I could have just one window, how would I move them back and forth?
I was trying to have a blank button and set the image programmatically.
I do know how to use call methods for objective-c.
Thank you for you help! :slight_smile:

I tried calling method “setImage:” but to no avail, I get an error. Maybe a problem with the image? Its a png.

I have an image named “arrow.icns” in my project. I can use this code to place the image on the button…

set newImage to load image “arrow.icns”
call method “setImage:” of theObject with parameter newImage

-or using only applescript-

set newImage to load image “arrow.icns”
set image of theObject to newImage

So as I mentioned earlier, if you don’t post the code you’re using and post many more details, there’s no way I can help you… but you don’t seem to want to do that.

Thank you!! Adding the load image part made it work.

I wanted to post code, but I am working in a test app which is blank so that I can test code before editing my main app.
Thanks again,
skyhighmac :slight_smile: