August 19, 2013 at 4:13 pm #12107
I’m totally new to programming and I’m trying to wrap my head around layer visibility to work for a panel I’m working on.
I want to use a combo box to show/hide layers. So, if the first option is selected layer 1 is shown and the others hidden, if the second is selected then layer 2 is shown and the others hidden.
Can anyone give me any ideas how to do this?
Thank you.August 19, 2013 at 5:10 pm #12108zeokaParticipant
- Topics: 73
- Replies: 466
- Total: 539
I’m not remember the exact command in my head but for the “logic” :
combval = Panel:getModulatorByName(“mycombno”):getModulatorValue
mylayer1 = (the defintion i don’t remember,someting with “canvas” a property of the panel )
mylayer2 = same thing
mylayer3 = etc…..
if comval == 1 then
mylayer1:setPropertyInt(“layerVisibility”,1) (the difinition may be not exact)
if comval == 2 then
mylayer2:setPropertyInt(“layerVisibility”,1) (the difinition may be not exact)
You must separate the condition in several ,instead of make 1 condition :
See some panels to get the exact command or someoneelse will gives here
Hope this helps a little…..August 19, 2013 at 5:32 pm #12112
there is a demo panel that illustrates thisAugust 20, 2013 at 8:09 am #12137
Thanks for your help, guys.
Atom – I checked out the demo panel but the layers are switched from checkboxes not a combo boxes. The function used in the example relies on the component name – layerBlue, layerRed, etc to determine which layer to set visibility. I am not experienced enough to adapt this code to a combo box where I would need to change visibility depending on the value selected within the combo box.August 20, 2013 at 9:39 am #12141
I’ll modify the demo to include combo boxes.August 20, 2013 at 9:45 am #12142
Thanks Atom. I’d greatly appreciate that.August 20, 2013 at 8:29 pm #12161
I updated it in the SVN repo, here is the copy.August 20, 2013 at 9:24 pm #12163drsteveParticipant
- Topics: 3
- Replies: 33
- Total: 36
Hi. I am still trying to learn whatever I can about ctrlr, so I downloaded this demo. What does this mean: “To see the layers demo make this layer invisible and make the layer ‘Layers Demo’ visible” and where does someone do that–making layers visible and invisible?
I see that you can select the Current tab by the combo box, by tabs themselves, or by the slider. That seems to be useful. Can different tabs have different devices assigned to them?
SteveAugust 20, 2013 at 11:30 pm #12167zeokaParticipant
- Topics: 73
- Replies: 466
- Total: 539
There is a space in the tab property “Called when the current tab in an uiTabs component is changed” where you can create a midi message by lua (it changes a label in the demo) when the current tab change…
Whatever you change the tabs by slider or tab or combo it will send a midi message for exampleAugust 21, 2013 at 10:26 am #12186
I updated it in the SVN repo, here is the copy.
Thank you kindly, Atom. That’s perfect.
Just out of interest. Is it possible to use this ‘is component visible’ property of a Modulator to hide/show modulators instead of using layers?August 21, 2013 at 11:01 am #12189
You can use the property, or you can just set the visibility flag directly
c = panel:getModulatorByName("blah"):getComponent() c:setVisible (true) -- visible c:setVisible (false) -- invisibleAugust 21, 2013 at 3:07 pm #12201
Well I’m stuck. I can’t get it to work – I must be missing something. Would someone please take a look and tell me where I’m going wrong?
There are three layers. The Base layer which is static and two other layers which should be switched depending on whether ID 1 or 2 is selected (ID 0 should switch them both off). The combo box with the script is called Osc1Mode.
Any help would be great.August 21, 2013 at 4:08 pm #12205
I fixed it for you, you had some type-os and most important stuff, if you rename your modulators (and you did rename the combo that switches the layers) you need to remember that in the code, if you reference something by name
the NAME is the actual name of the combo you want to fetchAugust 21, 2013 at 4:20 pm #12207
Thank you very much, Atom! I greatly appreciate it.
- The forum ‘Programming’ is closed to new topics and replies.