Preset Browser callback?
-
Hey all!
I'm trying to write the name of the currently loaded preset into a label so that the user can see which preset is loaded even when the preset browser tile is hidden - i got this working on compile with the following:PresetNameLabel.set("text", Engine.getCurrentUserPresetName());
The problem i'm having is putting this in the callback of the floating tile does absolutely nothing:
//PresetDisplay const var PresetNameLabel = Content.getComponent("PresetNameLabel"); inline function onPresetBrowserControl(component, value) { PresetNameLabel.set("text", Engine.getCurrentUserPresetName()); }; Content.getComponent("PresetBrowser").setControlCallback(onPresetBrowserControl);
I tried popping a 'hello world' print into the callback, nada. Is there another way I should be getting a callback from the preset browser? I've had a read around the forum and it looks like a broadcaster might do the job but i can't make heads nor tails of it.
-
@Lurch For this you need to use the preset handler.
Look at the
setPostCallback
function. -
@d-healey Ahh gotcha - thanks as always d.healey!
For the future:
//PresetDisplay const var PresetNameLabel = Content.getComponent("PresetNameLabel"); UserPresetHandler.setPostCallback(function() { PresetNameLabel.set("text", Engine.getCurrentUserPresetName()); });