I guess it's done, but I admit I do not know where to start.
I need an interface that has multiple pages! Someone knows how?
Easy way is to just use panels, easier way is to use my tab class (it uses panels too) - https://github.com/davidhealey/HISE-Scripting-Framework/blob/master/libraries/tab.js
I'll put a demo together for you later today
The basic procedure is to use a
ScriptPanelper page, add all controls as child components of this panel and then just toggle the visiblility of each page in a button callback (or whatever). I'll think about adding an example of this to the repository because it seems like a pretty common use case.
Here's how to do it with my tab class which should also explain how to do it with panels since it's pretty much the same thing just with some added helper functions.
Thank you for your answers!
Yes, that would be an example. D.healey's script works but the buttons do not work to open and close.
How do we add children's components?
To add a child component to a parent use the
parentComponentproperty on the child
Could you put an example? I have a hard time doing what I want ... I know it's simple!
I only want that when I click on a button, a page opens with new control.
I found in the API parent parent, but it does not work.
A big thank you for your help.
That first example I posted shows everything you need, the buttons work for me so I'm not sure why it's not working for you.
Here is a simpler example, I've added a child component to page 1. Important: by default button 1 is active but page 2 is displayed, some extra fiddling around would be required to fix this but I don't think it's necessary for the purpose of this example. Click button 2 first then button 1.
not working in the last github HISE version because of starting onInit: "content.setheight: ..."
you must replace it by: "Content.makeFrontInterface(..., ...);"
I'm using the latest version from GitHub - built on 6th December
Content.setHeight() is still available so it should not be the culprit here.
I found the smartest solution to handle multiple page logic is to write a function that shows and hides all pages at once and then just call this function from every button callback with the page you want to show as parameter. The advantage of this approach is that you can also put a function call to this function in you onInit callback to set the default view (and change this during development while you are working on a certain page)
sorry for that, but just downloaded this repository (6Dec) and tried, but: NO. With content set Height i just have a small Y black rectangle, no interface.
as i wrote before.
for multiples pages , also see: http://forum.hise.audio/topic/117/multiple-interfaces
tried this snippet, and with some ajustments it works.
Content.setHeight() sets only the height, but the width is zero. So you need add Content.setWidth() or just call Content.makeFrontInterface() to save some typing :)
I was just working in the Main Workspace so there was no need to set a width.
I have two versions, version 1.1.1, which I keep for my old project (there are .js commands) that does not work on the Other. And the last of github that I compile.
On both it does not work, I have no idea why. When I click on the button, no page closes or opens ... Nothing happens.
In the last example, I do not see the green scriptpanel. Yet, nothing to do with the buttons .... And that's on both versions.
I can have misery!
Good! It still does not work after several hours of work ....
Here is the code:
const var page1 = Content.addPanel("page1", 18, 290);
// [JSON page1]
// [/JSON page1]
const var page2 = Content.addPanel("page2", 103, 0);
// [JSON page2]
// [/JSON page2]
const var button1 = Content.addButton("button1", 0, 210);
// [JSON button1]
// [/JSON button1]
const var button2 = Content.addButton("button2", 0, 310);
// [JSON button2]
// [/JSON button2]
If anyone sees an error, please help me! I based myself on the HiseSnippet you sent me!
Well I can see you're using JSON and
control.set()you only need to use one. Also you've only posted the contents of your on init callback. What's not working exactly?
Everything is now Ok! It remains for me to focus on my plugin! Thank you all.
One last thing. When I recall my presets, it is not page 1 which comes back (bg1) .... Why?
Is there a way to say that page one is master?
You need to exclude the buttons from being saved / restored in a preset. Just set the „saveInPreset“ property to false.
I think it works. At least, each time I change the preset the mastre remains in place.
It's normal when I recompile, I have to press on a tabs for it to come back ...? In any case, I think it's ok.