GUI: Switching between sources

83 views
Skip to first unread message

Jane House

unread,
Jan 27, 2015, 4:35:50 PM1/27/15
to
Hi all. In our conference room system we want to let users mess with Apple TV controls OR with Teleconference controls - we don't want all controls to be visible at the same time. So, if I select Apple TV, the button changes to blue and I see relevant buttons. If I select Apple TV WHILE teleconference is active two things should happen: 1) Apple TV button should turn blue and 2) Teleconference button should turn green (to signify that it is still active). We know how to switch a source from A to B, but we are not sure how to switch from A to B, while giving B a secondary color if it's active. I am not programming source changes myself (our AV person does), but I do staff related to the UI, and I am wondering, can I do something like this with JS:
 
if (appleTV is active && teleconference is active) set teleconferenceButton green.png.

Does this software allows you do to such thing? Is there a better way?

Thanks!

Andy Greaves

unread,
Jan 27, 2015, 4:44:54 PM1/27/15
to comman...@googlegroups.com
JavaScript is exactly what you need for this.

An if/else statement is what you need

Here's some info on it...

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else

Your conditions can be in the form of...

CF.setJoin("d100" , 1);
For example to set digital join100 to true or on.
(Hopefully I got the syntax correct for that!)

That should get you started.

Andy.

Jane House

unread,
Jan 27, 2015, 4:54:49 PM1/27/15
to comman...@googlegroups.com

I can figure out the if/then syntax. Here are my questions:

1. My teleconference button has these states: gray - inactive, blue - active, green - active but not currently selected. So, if I change the button CF.setJoin("d100" , ...) from 0 to 1, it will change it from gray to blue. But I also have this third state - that's the problem. Should I just hide the button completely, and replace it with the green? It will look like it changed colors, but it would literally be a different button.

2. I see under Basic Actions there is a JavaScript textfield, is that where I put longer JS code? What if I have 200 lines?
Is there a place, like in <head> of html where I put my JS code?

Thanks,

Andy Greaves

unread,
Jan 27, 2015, 5:11:48 PM1/27/15
to comman...@googlegroups.com
Ah okay, I get it now. Three states rather than two.

Well to answer the second question first. Simply make you .js file and put it in the same folder as your project and add it to gui from the script manager option, this will then be loaded when iviewer is launched.

Okay, three states. I've never done this but I can imagine at least two methods, firstly a second button in the same place that is transparent in the off state and your third colour in its on state, then give this another join to be manipulated in your is.
Another way could be to make it appear on a subpage in much the same way although I think the first option would be easier.

No doubt others will be able to tell you a purely JS method for this but I can't think of it off the top of my head.

Hope that helps

Andy.

Barry Gordon

unread,
Jan 27, 2015, 5:14:05 PM1/27/15
to comman...@googlegroups.com

In the place for the line of JS you can put as much JS as you want but it gets messy to write and read. White space does not count between JS statements, and the semicolon is the JS statement separator.

 

 It is better to merely put a call to a JS function in a JS module that you built and integrated into the guiDesigner file.  The advantage is that the module and its contents can be built with a good JS editor that will also syntax check the code. You can pass arguments on the call if needed.

 

Look into tokens that can be associated with a join.  The tokens may be easily used to hold auxiliary state/status information as they can be read/changed.  You just need to do a lot of reading about JS in the CF Scripting documentation.

 

As a rule, you can do everything you want in JS. The reason many advanced developers chose CF was because of the integrated JS engine.

--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jarrod Bell

unread,
Jan 27, 2015, 5:53:28 PM1/27/15
to comman...@googlegroups.com
You can change a button's theme via JS - so if you go ahead and create 3 themes for your button in the theme manager (or just two, up to you) then you can use JS to swap between them.
http://commandfusion.com/docs/scripting/gui.html#cF.setProperties - scroll up to getProperties for a list of the properties you can set/get.

Another option is to just overlay an image on top of the button and set it to clickthrough mode, then you can swap the actual graphic that is loaded into that image dynamically in JS using CF.setJoin.

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
Reply all
Reply to author
Forward
0 new messages