Facility Control

 View Only
  • 1.  Change image background?

    Posted 08-04-2017 12:33
    Hi there!

    I'm trying to make a dashboard for a scoring system for hockey. So far, so good, I have interaction with Xpression etc... Now I would very much like to be able to set the logoes of each team through Dashboard! I have a preset folder with 10 teams, and a paramter dropdown with the names of each team. team1.jpg, team2.jpg etc etc. Now above the parameter dropdown, I would very much like a preview of the logo. So I'm looking for a way to change the background of the image whenever I change the dropdown. Then have a button that basically "takes" the value from the dropdown etc, this is the easy part appereantly...

    So, any clues? :)


  • 2.  RE: Change image background?

    Posted 08-04-2017 13:18
    You can change the background with ogscript.setStyle('COMPONENT_ID', 'bg-u:RELATIVE_PATH_TO_NEW_BACKGROUND_IMAGE');

    #DashBoard


  • 3.  RE: Change image background?

    Posted 08-04-2017 13:24
    Thank you! That should set me on a "path" to get it. Now, if I may ask... How would I go about and grab the current value of a paramter?
    in code that is, the visual basic part is easy, but in order to get this into code I mean...
    #DashBoard


  • 4.  RE: Change image background?

    Posted 08-04-2017 14:41
    params.getValue('OID_OF_PARAMETER', INDEX); //USUALLY, THE INDEX IS 0
    #DashBoard


  • 5.  RE: Change image background?

    Posted 08-04-2017 15:11

    Thaaaank you again!

    Made it work now thank to you. Appreciate it! Now to get this up and running with Xpression and we're all set!

    NOTE: For others, this is what I ended up with in code. Seeing as I wanted the action to perform when I changed the value of the parameter I got the value using a slightly different way.

    var val = this.getValue();
    ogscript.debug(val);
    ogscript.setStyle('hjemmelag_img', 'bg-u:Bilder/Logoer/'+val+'.png');

    It basically get the value from the parameter dropdown, stores that in a local variable named "val", writes that value into the debugger. Then it set the style of hjemmelag_img (hometeam_img), to get the image from my folder "Bilder/Logoer/" set the value retrieved earlier, and adds a .png at the end.


    #DashBoard