get componentVisibleName

Home Forums General Programming get componentVisibleName

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #84670
    Quimquim
    Participant
      • Topics: 7
      • Replies: 23
      • Total: 30

      Hi I can set componentVsibleName with the Following line

      panel:getModulatorByName(Fav_Button_Name):getComponent():setProperty(“componentVisibleName”,Tone_Name,true)

      but I’m pulling my hair to find the good syntax to GET it when modulator value change.

      I have tried many sintax but when then line with get pass all I get is a nil value

      I dig all through the forum and only find a line to get it when a mousedown on the modulator name but I need to get it when modulator value change

      Stay tuned. Quimquim

      #84671
      human fly
      Participant
        • Topics: 124
        • Replies: 1070
        • Total: 1194
        • ★★★★

        it’s terrible how quickly you forget all this… :-/
        can you get it to work with mouse click down?
        i know there’s a difference with value change, just
        can’t remember what it is..

        you might be able to go straight to the component with that.
        (ie: maybe omit getModulatorByName() – but that wouldn’t change this)
        i’m having a look though my methods to see what i’ve done with other
        properties. the form of that looks alright. (back in a minute)

        • This reply was modified 5 years, 9 months ago by human fly.
        #84673
        human fly
        Participant
          • Topics: 124
          • Replies: 1070
          • Total: 1194
          • ★★★★

          how are you defining ‘Tone_Name’?

          #84674
          human fly
          Participant
            • Topics: 124
            • Replies: 1070
            • Total: 1194
            • ★★★★

            i tried to do something with 4 radio buttons and a knob selector,
            but not got it yet. this is what i tried, it crashes:

            changeName = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source)
            
            	local tbl_buttons={}
            	local Tone_Name = nil
            
            	for i=1,4 do
             	local button=panel:getModulatorByName("tone"..i):getValue()
            	table.insert(tbl_buttons,button)
            
            		if tbl_buttons[ i ]~=0 then 
            		Tone_Name = i 
            		end
            		console(String("tone="..Tone_Name))
            	end
            
            panel:getModulatorByName(Fav_Button_Name):getComponent():setProperty("componentVisibleName",Tone_Name,true)
            
            end
            #84677
            dnaldoog
            Participant
              • Topics: 4
              • Replies: 480
              • Total: 484
              • ★★

              This works.

              Tone_Name="piano"
              panel:getModulatorByName("Fav_Button_Name"):getComponent():setPropertyString("componentVisibleName",tostring(Tone_Name))

              getModulatorByName expects a const string as an argument, but by passing Fav_Button_Name you are passing a non existent Lua variable.

              The tostring() function is necessary if you are passing an integer, but not necessary in this case.

              You could also do this to write the Fav_Button_Object Visible Name with the name of the button you clicked.

              
              myMethod = function(--[[ CtrlrModulator --]] mod, --[[ number --]] value, --[[ number --]] source)
              
              --panel:getComponent(tostring(x)):setPropertyString("componentVisibleName",tostring(x))
              local mName= L(mod:getName())
              Fav_Button_Name=panel:getModulatorByName("Fav_Button_Name"):getComponent()
              Fav_Button_Name:setPropertyString("componentVisibleName",mName)
              end
              

              Regards,

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

                I dig all through the forum and only find a line to get it when a mousedown on the modulator name but I need to get it when modulator value change

                Do you need the modulator name or the modulator visible name? name is a modulator property, visible name is a component property.

                • This reply was modified 5 years, 9 months ago by Possemo.
                #84680
                Quimquim
                Participant
                  • Topics: 7
                  • Replies: 23
                  • Total: 30

                  Hi Possemo what I need to READ ( get ) is the componentVisibleName. The modulator name is the variable Fav_Button_Name I use to call the modulator I want to read.

                  In my panel there is 12 favorites Tone button for the upper part of the keyboard and 12 others for the lower.

                  Each button (ex: lwr_Fav_1 for favorite lower 1 )have the tone name in the visiblename and the midi messages to send to the keyboard in the midiMessageMultiList (CC00 CC32 PCH)

                  So when I push a fav button it send the midi message and I want to write to a LCD display the tone name present in the visible name of that button

                  Here joined my panel up to now….

                  My panel is 90% finished and it one of the missing link to get it done. Also still have the styles (rhythm) section selection to do.

                  Attachments:
                  You must be logged in to view attached files.

                  Stay tuned. Quimquim

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

                    The easiest way to explain it: demo panel attached.

                    Attachments:
                    You must be logged in to view attached files.
                    #84687
                    human fly
                    Participant
                      • Topics: 124
                      • Replies: 1070
                      • Total: 1194
                      • ★★★★

                      lol that’s quite a ‘terse’ panel Poss’ ;o)
                      it opens up with the job done, you have to delete the
                      label text in properties. may i suggest ticking ‘editing
                      begins with one click’. but yeah that works.
                      ‘setText’ …

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

                        may i suggest ticking ‘editing
                        begins with one click’.

                        What do you mean with that? I am not aware of such feature…

                        #84689
                        human fly
                        Participant
                          • Topics: 124
                          • Replies: 1070
                          • Total: 1194
                          • ★★★★

                          sorry meant UIlabelEditOnSingleClick.
                          don’t know why i phrased it like that … ??duh…
                          (??! …)

                          (and then untick uiLabelEditFocusDiscardsChanges, easier/better)

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

                            ah ok I see. Well, I thought that quimquim gets the idea when he looks at the method. It’s just all about knowing the correct syntax. Btw. quimquim asked why there is no comprehensive tutorial. I think it is because with Ctrlr you are allowed to sell panels. Why would someone invest lots of hours making an extensive documentation when some people would use it to improve their business? I wouldn’t do that and I know that dasfaker would’nt do it either. I already don’t feel very comfortable when expalining things in the forum. But oh well, never mind.

                            I think the community would be much more alive if Ctrlr were strict open source / non-profit but that’s just my opinion.

                            • This reply was modified 5 years, 9 months ago by Possemo.
                            • This reply was modified 5 years, 9 months ago by Possemo.
                            #84693
                            human fly
                            Participant
                              • Topics: 124
                              • Replies: 1070
                              • Total: 1194
                              • ★★★★

                              i take your point.
                              me, i remain, as you know(!) a novice. (an ‘enthusiast’?)
                              but the majority of us here, afaik, are amateur not-for-profit,
                              and what’s the point of a forum if we can’t discuss new tricks?
                              or just common practice? it’s what makes a community interesting.

                              besides, you don’t have to reveal all of your game, and it’s how
                              you discuss things ultimately, and how much you choose to share.

                              as for the ‘manual’ – it would be almost impossible to write the
                              whole book, wouldn’t it? we have reference resources, like other
                              Lua sites, and (erm…) the github pages, now gone. i posted links
                              to zips of their content because they’re useful for knowing what’s
                              at our disposal in Ctrlr.

                              it seems a few people, such as yourself, have a comprehensive
                              overview, so of course we value that input.

                              really, little demo files here and there do more than any
                              explicative text – i learnt synthedit by studying what
                              everyone had done before, parsing zips of examples, keeping
                              the interesting ones. and that’s a much easier platform.

                              personally, i am not a ‘natural’ coder. i few weeks off, and
                              the ‘intuitive’ responses i was developing have dulled. i can’t
                              switch out my other life stuff at the moment, so it’s hard to
                              really focus. need to sort that out and pick things up again.

                              #84695
                              Quimquim
                              Participant
                                • Topics: 7
                                • Replies: 23
                                • Total: 30

                                I Possemo thanks for the example I get it work fine in my panel.

                                One thing I’m wandering is why I get the following error if I try to display the Namevar on console

                                Console(“Name = “..Namevar) give this error but when it’s set in a modulator the name is displayed correctly

                                At line [-1]: [C]

                                Error message: No such operator defined

                                About your opinion I understand your mind but if you look in a reverse way, with documentation to get users easily build panels,

                                  why someone would pay for a panel if he could get the instruction and tools to easily build one himself

                                . Isn’t it the goal of ctrlr?

                                That’s exactly why I use ctrlr, I can do it myself without paying something and I don’t plan to sell my panel. At oppsite I’m proud to share my work to help other to use their instruments. That’s, to my point of view, the minding behind GNU software.

                                Also if I can help someone it would please me. That’s the strengh of a group to complement each others.

                                Thanks Possemo and all others for your help and continuous support to ctrlr.

                                (excuse my not perfect english I a french speaking guy from Quebec in Canada)

                                Stay tuned. Quimquim

                                #84696
                                dnaldoog
                                Participant
                                  • Topics: 4
                                  • Replies: 480
                                  • Total: 484
                                  • ★★

                                  Console("Name = "..Namevar) needs to be Console(String("Name = "..Namevar)) 🙂

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

                                    One thing I’m wandering is why I get the following error if I try to display the Namevar on console

                                    Console(“Name = “..Namevar) give this error but when it’s set in a modulator the name is displayed correctly

                                    At line [-1]: [C]

                                    Error message: No such operator defined

                                    This is a speciality of Ctrlr. In some cases you need to set the L() “converter” when getting the string:

                                    Namevar = L(mod:getComponent():getPropertyString("componentVisibleName"))

                                    AFAIK “L” stands for Lua. It will prepare a string gotten from a component for using within Lua.

                                    #84701
                                    Quimquim
                                    Participant
                                      • Topics: 7
                                      • Replies: 23
                                      • Total: 30

                                      Thanks Dnal and Pos, That’s probably why I never find the good sintax to get the visible name. When the get was passing I got the string error so never know the get was working fine.

                                      I was thinking that the variable would be directly a string with a getPropertyString instead of a simple getProperty. So what is the format of the variable because I read in the Lua doc. the variables format don’t have to be declare and also the console (without string) can directly display text or numbers.

                                      That’s the kind of situation where it become hard to develop things went you don’t know the little details

                                      I agree with human fly bot necessary the write a hole book. It would certainly take more time it took to develop ctrlr itself. But what I was suggesting is having a common forum section to put all these little infos who get out with time so we wont have to scan the thousands of page. An archive of tricks and infos.

                                      before finising that message I took a look at Lua site so I think I found the answer.

                                      There are eight basic types in Lua: nil, boolean, number, string, userdata, function, thread, and table. The type function gives the type name of a given value:

                                      print(type(“Hello world”)) –> string
                                      print(type(10.4*3)) –> number
                                      print(type(print)) –> function
                                      print(type(type)) –> function
                                      print(type(true)) –> boolean
                                      print(type(nil)) –> nil
                                      print(type(type(X))) –> string

                                      so I done console(type(Tone_Name))

                                      and I get LUA>> userdata

                                      It’s a userdata that’s why console can’t display it. userdata is the raw memory content without specifying the format string or number.

                                      So the command getPropertyString should convert the information to string instead just keeping the raw data.

                                      The console(type()) will be very usefull in the futur when we get the At line [-1]: [C] error to clarify some situation with variables.

                                      Stay tuned. Quimquim

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

                                        Your finding about type() ist interesting.
                                        getPropertyString seems to do the same thing as getProperty, it probably doesnt matter which one you use. In most cases Lua error messages will tell you when it gets userdata (something like ..got userdata etc..). On the other hand setPropetyString and setPropertyInt seem to do what it’s suposed to do. getPropertyInt works fine too. It will get an integer number which you can do calcualtions with.

                                        Edit: no getProperty is a bit different. I think it recognizes a number and you will be able to calc with the variable.

                                        • This reply was modified 5 years, 9 months ago by Possemo.
                                      Viewing 18 posts - 1 through 18 (of 18 total)
                                      • The forum ‘Programming’ is closed to new topics and replies.
                                      There is currently 0 users and 92 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