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: 686
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Change Button Color with script - Solved

Post by DR White » Fri Aug 23, 2013 5:14 pm

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 » Fri Aug 23, 2013 5:59 pm

Try "backgroundColor"

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Change Button Color with script

Post by dunbarx » Fri Aug 23, 2013 6:34 pm

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 » Fri Aug 23, 2013 7:00 pm

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: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Change Button Color with script

Post by dunbarx » Fri Aug 23, 2013 7:26 pm

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 » Fri Aug 23, 2013 7:55 pm

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: 686
Joined: Fri Aug 23, 2013 12:29 pm
Location: Virginia, USA

Re: Change Button Color with script

Post by DR White » Sat Aug 24, 2013 1:50 am

WOW Magice!

That works GREAT! :D

Thanks!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”