Home › Forums › General › Programming › [SOLVED] Command to open an uiTabs with a button
- This topic has 19 replies, 4 voices, and was last updated 7 years, 4 months ago by fundorin.
-
AuthorPosts
-
December 2, 2016 at 11:38 am #70386
Hi The World,
Well, I would like to do that…
I have an object uiTabs named GeneralTab with Tab 0 + Tab 1 + Tab 2 + Tab 3 inside.
I have 4 buttons and I would like to open Tab 0 when I click on the button 1, Tab 1 when I click on button 2 etc…
I’ve try this in a LUA routine into the button in section “Called when the mouse is down on this component” … but the syntax is not good :
if value == 1 then
panel:getModulatorByName(“GeneralTab”):setModulatorIndex = 0end
I would be easy if it was the good command !!!!
Have you an idea for the good command ?
thanks a lot,
Xavier-Joseph from Reunion Island
December 2, 2016 at 12:04 pm #70389Hi,
I’ve found quite a solution…
On button option Link to PANAL property : panelIndex
Link to MODULATOR property : uiTabsCurrentTab
Link to MODULATOR : GeneralTab (my Tab name)
Link tom MODULATOR modulation type : numeric
Link to what type of MODULATOR property : ComponentSo,
When button value = 0 it opens Tab 0 and when button value = 1 it opens Tab 1it’s quite a solution…
December 2, 2016 at 3:34 pm #70390It’s not OK because I can open only 2 tabs…
If I modify “Button values” content with 1,2,3,4 the same button can open each Tabs on each mouse click but image button is not preview for 4 different positions !
I’m searching !!!
- This reply was modified 7 years, 4 months ago by JDXA.
December 2, 2016 at 8:51 pm #70392Here a Lua script that does it. It is using the Button names for the if-statement, as said, you can make 4 separate scripts without if’s.
Attachments:
You must be logged in to view attached files.December 3, 2016 at 3:51 am #70397Hi Possemo,
Wow, thanks, it’s exactly what I was looking for !
I’m going to adapt with the last routine you teach me to lite off when another button is ON !
I will not find these syntaxe : getComponent():setPropertyInt !
So, it’s also possible to make an individual routine for each button. I take note.
Thanks so much…
Have a nice day,
Xavier-Joseph from Reunion Island (where the summer is coming quickly !!!)
December 3, 2016 at 12:39 pm #70398when you are new to Ctrlr-Lua the syntax is not obvious, but in fact it is quite easy when you get the hang out of it. When you want to change a value by Lua script (e.g. the current Tab) you can see the name when you change the pulldownmenu “View -> PropertyIDs/Names”. It will show you in the right parameterlist the correct names: uiTabsCurrentTab.
Ah, just saw – this is a bad example. This one is broken: “uiTabsCurerentTab” no matter if you select to view IDs or Names.
December 4, 2016 at 11:54 am #70412Hi Possemo,
Ok, I’ve seen the difference…
So, if I have well understood… the names at the left side, are the names I can use to name modulators into LUA routine ?
Wel, do you remember the routine to display only into Labels or LCDLabels (with custom group number) ?
When the slider has values 0 to 127, all is ok but when I use FixedImageSlider, I have mapped -63 to + 63… the display is not correct (not the same as the JD-XA display)
Slider contents becomes, with Property ID’s/Panel, uiFixedSliderContent… so, I can use this name to display the mapped values ?December 4, 2016 at 1:05 pm #70415No, I’m afraid this won’t be that easy. If someone has another idea please let us know.
You will have to make an if-then list with all values like this:
if modulatorName=="FixedOne" then if value==0 then value="+1" elseif value==1 then value="+2" elseif value==2 then value="+3" elseif value==3 then value="+4" end end
Do you have a lot of such fixed sliders and do they have all the exact same structure? (e.g. from +50 to -50)?
In this case I would do it like this:
if mod:getComponent():getProperty("uiType")=="uiFixedSlider" then if value==0 then value="+1" elseif value==1 then value="+2" elseif value==2 then value="+3" elseif value==3 then value="+4" end end
You would have to do the list only once. In case the modulator is a uiFixedSlider it will do the value conversion.
Attachments:
You must be logged in to view attached files.December 4, 2016 at 3:20 pm #70423Hi Possemo,
Thanks for your reply…I have both -63 +63 and -50 +50…
I have to adapt !
Can I put plenty of command on the same LUA routine ?
December 4, 2016 at 4:24 pm #70424Hi Possemo,
Perhaps I have an idea…
I put these special sliders into a different group and I modify the LUA code and put :
displayThis = modulatorName..” : “..value-63So,
I think it will give the same value as the FixedSlider….I’m going to try !
December 4, 2016 at 4:27 pm #70425Yes it’s working, but I have not the sign “+” before positive values…
Not a big problem !!!!
- This reply was modified 7 years, 4 months ago by JDXA.
December 10, 2016 at 2:31 pm #70549Hi JDXA,
let me know if you need further help/advice. I’ve done this on my Pro2 panel…December 10, 2016 at 3:28 pm #70551Hi Goodweather !
Thanks for your message.
I’ve found a solution with the help of Possemo. I’ve adapted a solution he gave me for a similar problem.
But it’s very kind of you !
Have a nice day,
Xavier-Joseph from Reunion Island (where there’s today a very Goodweather !!!!)
December 10, 2016 at 4:25 pm #70555Is it possible to hide tab headers and use buttons to switch tabs, instead.
I know how to switch tabs with buttons (included demo panel shows exactly how it should be done), but I want to add swutch buttons inside all four tabs and switch between tabs with those buttons, so I could remove tab headers.Yellow area should not be visible/exist:
December 10, 2016 at 8:43 pm #70558Lucky boy Xavier-Joseph! En fait mon nom c’est Bontemps…
Just ask me if you need something or look in my Pro2 panel.
For each modulator I have some _OnChange and _OnClick method.
They are used to display information on the main screen.
I have only one for all positive values and one for all On/Off ones.
For special ones like -50 +50, I have a dedicated _OnChange method (ex: Osc Fine Tune).
For other ones, I’m using different functions within the Miscellaneous method.
@fundorin: not sure if this is possible. Did you look in Ctrlr source and Juce API?
Have a look at the image of my Pro2 panel, tab headers can integrate very well in a panel in fact…Greetings from Belgium!
December 10, 2016 at 10:02 pm #70560Thanks goodweather. What I have is a complete GUI and now I want to change layout with user/fx/inst/mixer buttons in the bottom right corner, but don’t want any tabs being visible.
December 11, 2016 at 5:16 pm #70590Now you are talking! Great job done. Exactly what I have between my PC keyboard and my PC screen. I mean… a 25SL MkII 🙂
What do you want to change? The complete set of buttons in the light grey area?
Do you plan to have the page buttons working?I’m afraid you’ll have to stick with the tab headers but I will have a look in the Ctrlr source files.
Should this not be possible, I would do the following:
– user/fx/inst/mixer as bottom main tabs
– within each main tab, some “sub” tabs for each page (you can pre-program for example up to 8 pages – should be more than enough)Sometimes, you need to adapt the reality to make it fit the virtual world 😉
December 11, 2016 at 7:59 pm #70596I think that I can activate different layers visibility upon user…mixer buttons press (didn’t check if it’s possible, though), but it would be harder to arrange during the development process, switching back and forth between layers.
The other way I could go is to leave one set of controls and make them do different things, based on global variables state, triggered by pressing fx..mixer.
One of the things I want do be able to change is LED rings behaviour. As you might know, there are six different display modes for them.
In fact, the main purpose of the panel I’m developing is to be able to control Reaper from SL MkII (midi) via OSC commands and get feedback from Reaper. So, there could be no GUI at all, but I want Ctrlr to duplicate all visual feedback that is going to SL and also be able to control Reaper directly from Ctrlr (don’t know exactly why I need this, yet).
Anyway, for now I’m just waiting for the new Ctrlr build from atom, which should fix two essential bugs in OSC subsystem of Ctrlr. Until then, I’m just slowly learning some possibilities of Ctrlr, like “tabless” tabs.
Page buttons are used to switch banks of 8 tracks now. At least, the left ones. I might use right ones to switch banks in step of one track.
BTW, do you know how to assign midi out and in devices with a single press of the button, in case if Ctrlr was started before turning on midi controller?
Pressing “refresh devices” doesn’t turn sad smileys into happy ones, even if controller in already on.
One needs to deselect and then select midi device in settings manually to make them connected with Ctrlr. Kinda annoying, as for me.December 11, 2016 at 9:42 pm #70602Could be good to start a separate thread for your Novation panel 🙂
Thx for your explanations, I see a bit better…
– Based on user/fx/inst/mixer selection, I would set a variable so one knows at any time what is selected
– Based on that variable, you could change all labels of the controls. When a contorl is modified, the corresponding OnChange Lua method will perform an if..then..elseif… to know what action to perform
– LED ring behaviour: I’m not aware of the 6 possibilities. Do you mean for the same rotary button? If yes, then you need to build 6 images (each containing the same number of frames) and then I suppose you can switch the image resource according to the wished behaviour
– devices: I didn’t find a way to know if the smiley was happy or sad. I can only find if my synth is in the listisPro2InDevices = function() sDevices = utils.getMidiInputDevices() for i=0, sDevices:size()-1 do if tostring(sDevices:get(i))=="Pro 2" then return (true) end end return (false) end
December 11, 2016 at 9:48 pm #70604I’ve started a new thread – http://ctrlr.org/forums/topic/novation-sl-mkii-and-reaper-midiosc-bridge/
I’ll answer you there, then, goodweather. 🙂 -
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.