[SOLVED] Command to open an uiTabs with a button

Home Forums General Programming [SOLVED] Command to open an uiTabs with a button

Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #70386
    JDXA
    Participant
      • Topics: 10
      • Replies: 45
      • Total: 55

      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 = 0

      end

      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

      • This topic was modified 7 years, 4 months ago by JDXA.
      • This topic was modified 7 years, 4 months ago by JDXA.
      • This topic was modified 7 years, 4 months ago by JDXA.
      #70389
      JDXA
      Participant
        • Topics: 10
        • Replies: 45
        • Total: 55

        Hi,

        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 : Component

        So,
        When button value = 0 it opens Tab 0 and when button value = 1 it opens Tab 1

        it’s quite a solution…

        #70390
        JDXA
        Participant
          • Topics: 10
          • Replies: 45
          • Total: 55

          It’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.
          #70392
          Possemo
          Participant
            • Topics: 14
            • Replies: 638
            • Total: 652
            • ★★★

            Here 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.
            #70397
            JDXA
            Participant
              • Topics: 10
              • Replies: 45
              • Total: 55

              Hi 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 !!!)

              #70398
              Possemo
              Participant
                • Topics: 14
                • Replies: 638
                • Total: 652
                • ★★★

                when 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.

                #70412
                JDXA
                Participant
                  • Topics: 10
                  • Replies: 45
                  • Total: 55

                  Hi 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 ?

                  #70415
                  Possemo
                  Participant
                    • Topics: 14
                    • Replies: 638
                    • Total: 652
                    • ★★★

                    No, 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.
                    #70423
                    JDXA
                    Participant
                      • Topics: 10
                      • Replies: 45
                      • Total: 55

                      Hi 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 ?

                      #70424
                      JDXA
                      Participant
                        • Topics: 10
                        • Replies: 45
                        • Total: 55

                        Hi 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-63

                        So,
                        I think it will give the same value as the FixedSlider….

                        I’m going to try !

                        #70425
                        JDXA
                        Participant
                          • Topics: 10
                          • Replies: 45
                          • Total: 55

                          Yes 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.
                          #70549
                          goodweather
                          Participant
                            • Topics: 45
                            • Replies: 550
                            • Total: 595
                            • ★★★

                            Hi JDXA,
                            let me know if you need further help/advice. I’ve done this on my Pro2 panel…

                            #70551
                            JDXA
                            Participant
                              • Topics: 10
                              • Replies: 45
                              • Total: 55

                              Hi 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 !!!!)

                              #70555
                              fundorin
                              Participant
                                • Topics: 8
                                • Replies: 66
                                • Total: 74

                                Is 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:

                                #70558
                                goodweather
                                Participant
                                  • Topics: 45
                                  • Replies: 550
                                  • Total: 595
                                  • ★★★

                                  Lucky 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!

                                  #70560
                                  fundorin
                                  Participant
                                    • Topics: 8
                                    • Replies: 66
                                    • Total: 74

                                    Thanks 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.

                                    View post on imgur.com

                                    #70590
                                    goodweather
                                    Participant
                                      • Topics: 45
                                      • Replies: 550
                                      • Total: 595
                                      • ★★★

                                      Now 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 😉

                                      #70596
                                      fundorin
                                      Participant
                                        • Topics: 8
                                        • Replies: 66
                                        • Total: 74

                                        I 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.

                                        #70602
                                        goodweather
                                        Participant
                                          • Topics: 45
                                          • Replies: 550
                                          • Total: 595
                                          • ★★★

                                          Could 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 list

                                          isPro2InDevices = 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
                                          #70604
                                          fundorin
                                          Participant
                                            • Topics: 8
                                            • Replies: 66
                                            • Total: 74

                                            I’ve started a new thread – http://ctrlr.org/forums/topic/novation-sl-mkii-and-reaper-midiosc-bridge/
                                            I’ll answer you there, then, goodweather. 🙂

                                          Viewing 20 posts - 1 through 20 (of 20 total)
                                          • The forum ‘Programming’ is closed to new topics and replies.
                                          There is currently 0 users and 71 guests online
                                          No users are currently active
                                          Forum Statistics
                                          Threads: 2,495, Posts: 17,374, Members: 77,605
                                          Most users ever online was 12 on January 22, 2019 3:47 pm
                                          Ctrlr