Change Button Color with script - Solved

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Change Button Color with script - Solved

Post by DR White »

I guess I am a really slow learner.

I have looked through several resources and I have tried several variations of code, but still cannot change the fill color of my button.

Can someone tell me What I am doing wrong. My code is below:

set the buttonColor of button Button1 to "131,250,199"

Thanks,

David
Last edited by DR White on Thu Sep 19, 2013 2:59 am, edited 1 time in total.
magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Change Button Color with script

Post by magice »

Try "backgroundColor"
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10502
Joined: Wed May 06, 2009 2:28 pm

Re: Change Button Color with script

Post by dunbarx »

Hi again.

And be careful. LiveCode is so english-like, that it is tempting to make up words that seem logical, but in fact do not exist, or worse, are used in a different way. You will luck out now and then, though, but always check the dictionary.

"ButtonColor". Makes sense; no such word. But at least you have the flavor of the language. There is a formal syntax, though, and you must check for it.

Craig Newman
magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Change Button Color with script

Post by magice »

One neat little trick I have learned, is to look at the property inspector. When you figure out how to change a property there, mouse over the control you used and it will give you the property name to be used in a script.
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10502
Joined: Wed May 06, 2009 2:28 pm

Re: Change Button Color with script

Post by dunbarx »

Magice.

Mostly correct, and I never really made that connection. Cool.

But it is not purely an aid to locating properties, though mostly it works well for that. I was playing around in the "size and position" tab, and the tooltips there are either just explanatory, or not well assigned. ("left" shows the tooltip "loc", for example)

Craig
magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Change Button Color with script

Post by magice »

dunbarx wrote:Magice.

Mostly correct, and I never really made that connection. Cool.

But it is not purely an aid to locating properties, though mostly it works well for that. I was playing around in the "size and position" tab, and the tooltips there are either just explanatory, or not well assigned. ("left" shows the tooltip "loc", for example)

Craig
True it is not perfect, especially with more complex properties that can me modified in multiple ways, but it at the least gives you a starting point of where to look in the dictionary. It has been an extremely helpful learning tool for me.
DR White
Posts: 718
Joined: Fri Aug 23, 2013 12:29 pm

Re: Change Button Color with script

Post by DR White »

WOW Magice!

That works GREAT! :D

Thanks!
Post Reply