uiCustomComponent parent

Home Forums General Programming uiCustomComponent parent

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #27061
    dasfaker
    Keymaster
      • Topics: 80
      • Replies: 793
      • Total: 873
      • ★★★

      Hi Atom

      I try to get the parent of a uiCustomComponent to get the modulator value, but what I get using getParentComponent() is Object type [CtrlrPanelCanvasLayer] instead of the modulator.

      How can I get the modulator? Thx

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

        getting the parent component will always return the COMPONENT (that is the UI object that the current component belongs to), so that’s 100% ok the parent of any Component on a panel is the Layer that component is on.

        Modulators are not UI objects

        #27063
        dasfaker
        Keymaster
          • Topics: 80
          • Replies: 793
          • Total: 873
          • ★★★

          So how do I do to get access to Modulator and MIDI sections of a modulator from the drawing function of a uiCustomComponent for instance, where I only have comp?

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

            I thought we had that discussion, you use the getOwner() method on that Component, the owner of the component is always it’s modulator, the components parent is always some other component (in case it’s the topmost component, the Desktop is it’s parent)

            #27066
            dasfaker
            Keymaster
              • Topics: 80
              • Replies: 793
              • Total: 873
              • ★★★

              Oh shit, I forgot that, sorry for wasting your time. Thx.

              #27071
              zeoka
              Participant
                • Topics: 73
                • Replies: 466
                • Total: 539
                • ★★★

                Not followed this discussion
                Thank you
                I will try found it
                Needed this for the pattern editor

                #29167
                zeoka
                Participant
                  • Topics: 73
                  • Replies: 466
                  • Total: 539
                  • ★★★
                  -- Called when a component needs repainting
                  -- @comp
                  -- @g    http://ctrlr.org/api/class_ctrlr_lua_graphics.html
                  --              see also http://www.rawmaterialsoftware.com/juce/api/classGraphics.html
                  --
                  paintclass = function(comp,g)
                  clval = comp:getOwner():getValue() 
                  g:setColour(Colour(0x40000000))
                  g:fillRoundedRectangle(11,13,clval,69,4)  
                  end

                  I’ve added modulatorValue property

                  -- Called when a mouse DOWN (any mouse button) event happens on a component
                  -- @comp
                  -- @event   http://www.rawmaterialsoftware.com/juce/api/classMouseEvent.html
                  --
                  createclassval = function(comp, event)
                  
                  classX = event.x 
                  classY = event.y
                  if classX <= 127 then
                  comp:getOwner():setModulatorValue(classX,false,true,false)
                  comp:repaint()
                  end
                  end
                  --
                  -- Called when a modulator value changes
                  -- @mod   http://ctrlr.org/api/class_ctrlr_modulator.html
                  -- @value    new numeric value of the modulator
                  --
                  mod2paint = function(mod, value)
                  mod:getComponent():repaint()
                  end

                  I’ve linked a modulator to the custom comp and it sends the sysex
                  when I move this modulator
                  but when I click on the cusom component it doesn’t send the sysex
                  A property I missed ?

                  #29168
                  zeoka
                  Participant
                    • Topics: 73
                    • Replies: 466
                    • Total: 539
                    • ★★★

                    I forgot to set MIDI meesage type

                    all good

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