changing colors of an element

Questions, tips and tricks and techniques for scripting in Servoy

changing colors of an element

Postby Ron » Fri Jul 31, 2009 10:37 pm

I named all the elements on my main form and hardcoded the colors.
This works great.
Now I want to go a little further and let a method retrieve the colorcodes from some
field. This way I could change the collorsettings even faster.
But...It does not work.

forms.main.elements.topbar.bgcolor = '#000000' //works

globals.topbar = forms.main.topbarfield //where topbarfield contains: '#000000'
forms.main.elements.topbar.bgcolor = globals.topbar //does not work

Maybe it's the quotes?
If so, how will the code look like with quotes included (colorcode in field will then be without codes).

Thanks,
Ron
Ron
 
Posts: 315
Joined: Fri May 23, 2003 12:30 am
Location: Netherlands

Re: changing colors of an element

Postby mboegem » Sat Aug 01, 2009 2:31 am

Hi Ron,

I've done a simular job in our application and it works just fine.
Be sure your global variable has a value like: #22a000
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1752
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: changing colors of an element

Postby Jan Aleman » Sat Aug 01, 2009 10:13 am

Ron wrote:I named all the elements on my main form and hardcoded the colors.
This works great.
Now I want to go a little further and let a method retrieve the colorcodes from some
field. This way I could change the collorsettings even faster.
But...It does not work.

forms.main.elements.topbar.bgcolor = '#000000' //works

globals.topbar = forms.main.topbarfield //where topbarfield contains: '#000000'
forms.main.elements.topbar.bgcolor = globals.topbar //does not work

so what is topbarfield? a form variable that contains a string? or is it a field that you want to retrieve the color from? Have you considered setting a breakpoint and checking while you step what is going on?
Jan Aleman
Servoy
Jan Aleman
 
Posts: 2083
Joined: Wed Apr 23, 2003 9:49 pm
Location: Planet Earth


Return to Methods

Who is online

Users browsing this forum: No registered users and 38 guests

cron