Facility Control

 View Only
  • 1.  change bacground color of a button on the fly

    Posted 07-15-2015 19:55
    Hi,

    In Dashboard, is it possible to change the background color of a button on the fly?

    Thanks

    Bruno


  • 2.  RE: change bacground color of a button on the fly

    Posted 07-15-2015 20:16

    Yes. One way you can change it through ogScript.

    The bg# style attribute takes a hex colour code (or a pre-defined colour constant)

    `ogscript.setStyle('button id', 'bg#FF0000');`

    #DashBoard


  • 3.  RE: change bacground color of a button on the fly

    Posted 07-17-2015 15:25
    Just as a followup,

    You can change a HUGE number of style elements through scripting on all of your UI elements (including buttons).

    The easiest way to get the appropriate codes to use in the scripting is to create the style on an element using the style editor, then look at the code it generates in the panel for you. I'd never try and memorize the codes or look them all up, much much easier to let DashBoard do the heavy lifting for you.

    Here is an example of settting a button style to:

    -an etched border, bold text, 15 pt font, with a different foreground and background colour for the button.

    ogscript.setStyle('button id', 'bdr:etched;font:bold;size:15;fg#F10000;bg#295490');

    Again, I would never try and memorize the above items, I just have DashBoard create that string for me and then I can use it in my scripting.

    Using this technique you can change the visual appearance of most UI elements at any time you like.

    #DashBoard


  • 4.  RE: change bacground color of a button on the fly

    Posted 07-17-2015 18:20
    Thanks James and Troy

    Bruno

    #DashBoard