Jeff Morse
Jeff Morse

Reputation: 69

How do I change the icon of a button in livecode, using code and not the inspector tool?

I want to have a button change appearance when certain events occur. I thought the code would look something like this:

on mouseUp
   set the icon of this button to the id 1044
end mouseUp

The icon of the button is its normal appearance and in inspector when you put the id of a certain image into the icon space the image will take on the appearance of whatever has that icon. What code would allow me to do this

Upvotes: 0

Views: 628

Answers (2)

Devin
Devin

Reputation: 603

You can also set the icon by referring to the name of the desired image. Say you have a button named "foo" and an image named "bar":

set the icon of button "foo" to "bar"

Upvotes: 0

Scott Rossi
Scott Rossi

Reputation: 885

set the icon of button "abc" to 1044

or

set the icon of button "abc" to the id of image "source image"

In both cases you are setting the icon property of the button to the id of an image object.

Upvotes: 1

Related Questions