Design a Media Spectrum Widget
Introduction
The Media Spectrum widget is a highly configurable widget that allows you to easily display a collection of Media Gauge D widgets in one widget.
This tutorial requires basic knowledge about using the graphics editor. This includes adding widgets and modifying widget properties during design time. For more information regarding this, refer to the Graphics Editor manual.
Widget Properties
Size, Position and Orientation
- Left and Top
-
Position of a widgets can be changed by entering values for the Left and Top properties.
-
Alternatively, the widget can be positioned by simply clicking and dragging into the desired position.
-
If the width or height of the Media Spectrum widget is set to the maximum size of the display top or left dragging will not function.
- Width and Height
-
For the Media Spectrum widget, the size properties, Width and Height, can be changed by entering the value of a known width and Height in pixels.
-
Or the width and height can be simply changed by dragging the red dotted widget outline to the required size. Changing Width or Height will only have an effect on the length of the Bar Gauges. In Landscape mode, Height will be adjustable and in Portrait mode, Width will be adjustable. Width and Height changes will be automatically trimmed to suit the Bar Thickness and Bar Spacing set properties.
- Range
-
The Media Spectrum can be set to any range from 0 to 1000.
- Orientation
-
The Media Spectrum widget Orientation can be Landscape or Portrait. In Landscape mode the Bar Gauges will be vertical. In Portrait mode the Bar Gauges are horizontal. The Orientation can be changed by selecting Landscape or Portrait property value.
Gauge
- Count
-
The Gauge Count property sets the amount of visible Bar Gauges in the spectrum.
- Thickness
-
The Gauge thickness of the Individual Bar Gauges can be set by entering the thickness in Pixels as the property value. The Width of the Media Spectrum widget will be determined the by the Gauge Thickness multiplied by the Gauge Count and Gauge Spacing when in Landscape mode. In Portrait mode the height will be determined in the same manner.
- Spacing
-
The space between the individual Bar Gauges can adjusted set by entering a pixel value as the property value.
Direction
- The direction of the movement of the Bar Gauges of the Media Spectrum can be changed from Normal to Inverted.
-
In Landscape Orientation, Normal will move the gauges from bottom to top and Inverted will move the gauges from top to bottom. In Portrait Orientation, Normal will move the gauges from Left to Right and Inverted will move the gauges from right to left.
Active / Inactive
- Start / End Color
-
The Individual bar gauges are made up from 10 segments. If the Darken Inactive Mode is chosen, these colors can be set as a gradual fade from the chosen Start color to the chosen End color which will lighten from a dark level as the gauge progresses through its movement. The color can be selected by clicking on the property value.
- Inactive Color
-
The Inactive Color property sets the color of the inactive part of the individual bar gauges when the Inactive Mode property is set to Custom. This will make the Inactive part a constant color throughout the range and would usually be set to a darker color than the Active Start Color. This color can be changed by clicking on the property value using the color selector.
- Inactive Mode
-
The Inactive Mode property sets how the inactive part of the individual bar gauge behaves as the bar gauge moves. In Darken mode, the inactive (off) part of the bar gauge will be a darker color of the color fade from Active Start color to Active End color. In Custom mode the inactive (off) part of the bar gauge will be the Inactive color that is set by the Inactive Color property.
Demonstration
For this demonstration we will using 2 Media Panels and a Media Spectrum widget to make a simulated changing spectrum display. For instructions on how to add a widget, refer to this discussion.
Add a Media Panel widget from the Static tab.
and then set the properties as shown.
Next, add another Media Panel widget and set the properties as shown.
Finally, add a Media Spectrum widget from the Led Tab and set the properties as shown.
If the Genius environment is being used the demonstration can be tested by entering simple code in the code window.
Or copy and paste the code below.
var b[6];
func setup()
setSpectrumValue(MediaSpectrum0, 0, 0);
endfunc
/*
* User Loop Function
*/
func loop()
var r, t;
for(t := 0; t < 6; t++)
r := ABS(RAND() % 98);
if(r > b[t])
setSpectrumValue(MediaSpectrum0, t, r);
b[t] := r;
else
b[t] := b[t] - 7;
if(b[t] < 0) b[t] := 0;
setSpectrumValue(MediaSpectrum0, t, b[t]);
endif
next
pause(10);
endfunc
Ensure that the Port is set to the correct port that the TIMI module is connected to.
and then click on the Upload Button to Upload the entire project to the display.
When the Upload has completed you should see the Media Spectrum show random values.
Or the page can be used in the Commander environment by saving the Page and clicking in the Object Selector to choose Page0.
Then Click on Save Configuration.
A Save Dialogue Window will appear. Enter a filename (MediaSpectrumPage) then click on Save
You can find out further information about the Commander Environment in the Getting Started with the Commander Environment tutorial.