HISE Docs

Content


Class methods

addAudioWaveform

Adds a audio waveform display.

Content.addAudioWaveform(String audioWaveformName, int x, int y)



addButton

Adds a toggle button to the Content and returns the component index.

Content.addButton(String buttonName, int x, int y)



addComboBox

Adds a comboBox to the Content and returns the component index.

Content.addComboBox(String boxName, int x, int y)



addFloatingTile

Adds a floating layout component.

Content.addFloatingTile(String floatingTileName, int x, int y)



addImage

Adds a image to the script interface.

Content.addImage(String imageName, int x, int y)



addKnob

Adds a knob to the Content and returns the component index.

Content.addKnob(String knobName, int x, int y)



addLabel

Adds a text input label.

Content.addLabel(String label, int x, int y)



addPanel

Adds a panel (rectangle with border and gradient).

Content.addPanel(String panelName, int x, int y)



addSliderPack

Adds a slider pack.

Content.addSliderPack(String sliderPackName, int x, int y)



addTable

Adds a table editor to the Content and returns the component index.

Content.addTable(String tableName, int x, int y)



addViewport

Adds a viewport.

Content.addViewport(String viewportName, int x, int y)



addVisualGuide

Creates either a line or rectangle with the given colour.

Content.addVisualGuide(var guideData, var colour)


This function creates visual guide lines or rectangles that appear on the interface (not in the compiled plugin). They are useful for debugging or layout alignments.

It expects two arguments, the first must be an array with either two or four elements and the second must be a colour (it's recommended to use the Colours constants for this).

If the array has two elements, it will add a horizontal or vertical line, depending on which element is non-zero. If the array has four elements it will be a rectangle (with the same format that you pass into eg. Graphics.fillRect() ).

Anything else will cause the visual guides to be cleared, so if you want to delete all lines, just pass in 0 .

Content.addVisualGuide([0, 200], Colours.white);       // adds a horizontal line at 200px
Content.addVisualGuide([100, 0], Colours.red);         // adds a vertical line at 100px
Content.addVisualGuide([10, 10, 100, 50], 0xFF00FF00); // adds a rectangle

Content.addVisualGuide(0, 0);                          // clears all visual guides

The lines will always be rendered on top of all UI elements so that they are always visible.

addWebView

Adds a web view.

Content.addWebView(String webviewName, int x, int y)



callAfterDelay

Calls a function after a delay. This is not accurate and only useful for UI purposes!.

Content.callAfterDelay(int milliSeconds, var function, var thisObject)



createLocalLookAndFeel

Creates a look and feel that you can attach manually to certain components.

Content.createLocalLookAndFeel()



createMarkdownRenderer

Creates a MarkdownRenderer.

Content.createMarkdownRenderer()



createPath

Creates a Path that can be drawn to a ScriptPanel.

Content.createPath()



createScreenshot

Creates a screenshot of the area relative to the content's origin.

Content.createScreenshot(var area, var directory, String name)


This function can be used to create an image from a section of your interface and save it as PNG file. Just pass an array with 4 elements ([x, y, w, h] ), a File object that points to a directory and a relative filename (without the file extension) and it will render the specified area into a PNG image.

// Save the image to C:\Users\UserName\Documents\myimage.png;
Content.createScreenShot([0, 0, 1024 768], 
                         FileSystem.getFolder(FileSystem.Documents), 
                         "myimage");

Be aware that this takes the current zoom factor into account, so if you have a UI Zoom Factor of 200%, the resulting image will be twice the size of the "default" interface dimensions. It will also hide any visual guides that you might have added so they don't clutter your exported image.

Also be aware that if you use OpenGL shaders, they will not be rendered to the image (because they are rendered directly to the screen). However there is a helper function available to enable shaders to be rendered to a screenshot.

createShader

Creates an OpenGL framgent shader.

Content.createShader( String fileName)


If you want to create a ScriptShader , use this method and supply the filename as parameter (see ScriptShader.setFragmentShader() for more information about including shaders).

createSVG

Creates an SVG object from the converted Base64 String.

Content.createSVG( String base64String)



getAllComponents

Returns an array of all components that match the given regex.

Content.getAllComponents(String regex)



getComponent

Returns the reference to the given component.

Content.getComponent(var name)



getComponentUnderDrag

Returns the ID of the component under the mouse.

Content.getComponentUnderDrag()



getComponentUnderMouse

Returns the name of the component that is currently hovered.

Content.getComponentUnderMouse()



getCurrentTooltip

Returns the current tooltip.

Content.getCurrentTooltip()


This can be used to create a custom tooltip implementation if the TooltipPanel does not suit your needs.

This will return the "raw" tooltip (as in the tooltip from the UI element where the mouse is hovering over). For most applications you might want to introduce a custom delay, so that if you move the mouse away from the element, it will "stick" a little bit longer.

This example will display the current tooltip on a label with a delay of a second.

const var t = Engine.createTimerObject();
const var Label1 = Content.getComponent("Label1");
reg isPending = false;

t.setTimerCallback(function()
{
	var tooltip = Content.getCurrentTooltip();
	
	if(tooltip == "")
	{
		// Now the mouse is over a component without a tooltip
	
		if(Label1.get("text") != "" && !isPending)
		{
			// The tooltip label was not empty so we set the isPending flag
			// and reset the internal counter of the timer object
			isPending = true;
			this.resetCounter(); // [1]
		}
		else if (this.getMilliSecondsSinceCounterReset() > 1000)
		{
			// Now a second has passed since [1] without a new tooltip being
			// set, so we clear the label and reset the isPending flag
			isPending = false;
			Label1.set("text", "");
		}
	}
	else
	{
		// We update the label with the new tooltip and
		// clear the isPending flag
		isPending = false;
		Label1.set("text", tooltip);
	}
});

// We don't need it to be super fast, so 100ms should be fine
t.startTimer(100);


getScreenBounds

Returns the total bounds of the main display.

Content.getScreenBounds(bool getTotalArea)



isCtrlDown

Checks whether the CTRL key's flag is set.

Content.isCtrlDown()



isMouseDown

Returns 1 if the left mouse button is clicked somewhere on the interface and 2 if the right button is clicked.

Content.isMouseDown()



makeFrontInterface

Sets this script as main interface with the given size.

Content.makeFrontInterface(int width, int height)



makeFullScreenInterface

Sets this script as main interface with the given device resolution (only works with mobile devices).

Content.makeFullScreenInterface()



refreshDragImage

Calls the paint function of the drag operation again to refresh the image.

Content.refreshDragImage()



restoreAllControlsFromPreset

Restores all controls from a previously saved XML data file.

Content.restoreAllControlsFromPreset( String fileName)



setColour

Sets the colour for the panel.

Content.setColour(int red, int green, int blue)



setContentTooltip

sets the Tooltip that will be shown if the mouse hovers over the script's tab button.

Content.setContentTooltip( String tooltipToShow)



setHeight

Sets the height of the content.

Content.setHeight(int newHeight)



setName

Sets the name that will be displayed in big fat Impact.

Content.setName( String newName)



setPropertiesFromJSON

Restore the Component from a JSON object.

Content.setPropertiesFromJSON( String name,  var jsonData)



setToolbarProperties

Sets the main toolbar properties from a JSON object.

Content.setToolbarProperties( var toolbarProperties)



setUseHighResolutionForPanels

Set this to true to render all script panels with double resolution for retina or rescaling.

Content.setUseHighResolutionForPanels(bool shouldUseDoubleResolution)



setValuePopupData

sets the data for the value popups.

Content.setValuePopupData(var jsonData)


Examples:

Content.setValuePopupData({
    "itemColour":   Colours.forestgreen,    // BG colour TOP
    "itemColour2":  Colours.firebrick, // BG colour BOTTOM
    "bgColour":     Colours.gainsboro,      // In fact the Border colour...
    "borderSize":   6.66,
    "textColour":   Colours.navajowhite,
    "fontSize":     66.6,
    "fontName":     "Comic Sans MS"
});
Content.setValuePopupData({
    "fontName":"Comic Sans MS",
    "fontSize": 14,
    "borderSize": 1,
    "borderRadius": 1,
    "margin":0,
    "bgColour": 0xFF636363,
    "itemColour": 0xFF000000,
    "itemColour2": 0xFF000000,
     "textColour": 0xFF636363 
});


setWidth

Sets the height of the content.

Content.setWidth(int newWidth)



showModalTextInput

Opens a text input box with the given properties and executes the callback when finished.

Content.showModalTextInput(var properties, var callback)



storeAllControlsAsPreset

Saves all controls that should be saved into a XML data file.

Content.storeAllControlsAsPreset( String fileName,  ValueTree automationData)