changing colors of an element

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

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

Ron:
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?