name a drawLine?

Home Forums General Programming name a drawLine?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7418
    msepsis
    Participant
      • Topics: 219
      • Replies: 732
      • Total: 951
      • ★★★

      I have a custom component with a drawn element (small square) that moves horizontally depending on the value of a knob (named in lua – “sw1position”).

      I would like the square to be “erased” or hidden if the value of a combobox (named in lua: “waveform”) changes.

      Is there a way to name a drawLine (below) so that you can later set its visibility, or change its color? Here’s a snipit of what is being drawn on the customComponent and how it’s drawn, very basic:


      sw1position = panel:getModulatorByName("Wave 1 Startwave"):getModulatorValue()
      graphics:setColour (Colour(0xff55BBff))
      graphics:drawLine ((sw1position*25)+3, 0, (sw1position*25)+3, 5, 5);

      This works fine, I basically just want to then “hide” the 5×5 “drawLine” (actually a small, blue box) if my “waveform” combobox’s value changes. ..

      Any other suggestions welcome.. I’m giving a few alt workaround a shot right now but being able to name a drawLine would be ideal in this situation so I could manipulate the drawLine depending on the value of various modulators.

      Monstrum Media | Music, Sound & Software Design, Chicago / San Francisco listen

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

        you can’t name lines 🙂 those are not components. you can write a function that will take 2 parameters, one the graphics context and the other one a variable that will determine how the line is drawn, then just call that function with those two parameters wherever you need. have a look at the rendering demo, there is a lot of examples on how to do that.

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