modulator name in label text (please see my panel pic

Home Forums General Programming modulator name in label text (please see my panel pic

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #28780
    mookai1973
    Participant
      • Topics: 2
      • Replies: 2
      • Total: 4

      Dear Sir,

      when I press my button in red round I would like to show modulator in Label Text 1 and in blue round show modulator name in Label Text 2.
      How can I do for this?

      In label Text 3 I would like to show current date time clock and I try to find LUA scritp but I don’t know how to put it.

      sorry for my english it’s not very well.

      Best Regards,
      Kai
      Phuket Thailand

      #28781
      atom
      Keymaster
        • Topics: 159
        • Replies: 2945
        • Total: 3104
        • ★★★★★

        If you want a label to show the name of the last changed modulator, you can do that by selecting a special property on the label component
        “Label displays last changed modulator”
        and the property
        “When displaying last changed modulator, use this format” describes what should be shown in the label:
        %N – components visible name
        %s – components text (if any)
        %v – modulator value
        %h – modulator value in HEX
        %x – modulator’s midi message in HEX
        %g – modulator’s group name (if any)

        In order to display date and time, you need to write a Lua script and attach it to some atcion, or display it using a timer, this is a bit more complex task to do. Bo to get you started, create a Button component and find the property “Called when the modulator value changes”, click on the “new” icon, give the method a name, selecte the new method from the combo so it’s associated with the component, and then click the edit button. The Lua editor will open up and you can write a piece of Lua that will run when you click this button.

        (assuming you called your method myNewMethod, it could look like this)

        --
        -- Called when a modulator value changes
        -- @mod   http://ctrlr.org/api/class_ctrlr_modulator.html
        -- @value    new numeric value of the modulator
        --
        myNewMethod = function(mod, value)
        	s = Time.getCurrentTime():toString(true,true,true,true)
        	panel:getComponent("timeAndDateLabel"):setText (s)
        end

        Now if you have a label on your panel called “timeAndDaateLabel”, after you click the button it should show the current date and time (something like 10 Sep 2014 12:59:18).

        To get the details on the Time object in Lua, have a look at the Juce docs: http://www.juce.com/juce/api/classTime.html

        I’m attaching an example panel below.

        • This reply was modified 9 years, 7 months ago by atom.
        Attachments:
        You must be logged in to view attached files.
        #28784
        mookai1973
        Participant
          • Topics: 2
          • Replies: 2
          • Total: 4

          Dear Atom,
          thank you for your help i appreciate it.

          Best Regards,
          Kai

          #28787
          mookai1973
          Participant
            • Topics: 2
            • Replies: 2
            • Total: 4

            Dear Atom,

            How can I separate Label text group please see my pic
            modulator-2 and 3 show only “left label text”
            modulator-5 and 6 show only “right label text”

            and now all name show on left label text

            Best Regards,
            Kai

            #28800
            atom
            Keymaster
              • Topics: 159
              • Replies: 2945
              • Total: 3104
              • ★★★★★

              As i understand it, you can’t do that without Lua, and it might be complicated to do. This option to display the last changes modulator was made to be global so it will always show ANY modulator that was last changed.

            Viewing 5 posts - 1 through 5 (of 5 total)
            • The forum ‘Programming’ is closed to new topics and replies.
            There is currently 0 users and 58 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