Colors are not as expected

Home Forums General Programming Colors are not as expected

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8569
    zeoka
    Participant
      • Topics: 73
      • Replies: 466
      • Total: 539
      • ★★★

      Hi
      I would to change color of some elements using LUA and this gives different colors than
      those i want .
      I wanted for “disabe” position same color as “c1” and
      for “enable” same color as outline groups
      I try to build custom buttons i could do an image but i would not use ressource…

      Any idea ?

      • This topic was modified 11 years ago by zeoka.
      Attachments:
      You must be logged in to view attached files.
      #8573
      atom
      Keymaster
        • Topics: 159
        • Replies: 2945
        • Total: 3104
        • ★★★★★

        setProperty sets the property as an INTEGER in your case, notice your notation

        setProperty ("prop", 0xff0000ff, false)
        

        this sets the property to that large number, and colours are STRING representation of an ARGB color, so either

        setProperty ("prop", "0xff0000ff", false)
        

        or

        c = Colour(0xff0000ff)
        setProperty ("prop", c:toString(), false)
        
        #8580
        zeoka
        Participant
          • Topics: 73
          • Replies: 466
          • Total: 539
          • ★★★

          Thank you Atom

          I take care of your second method , useful if the colour is used multiple times in the script

          Is it possible to get multiple components at once
          ex method = panel:getComponent(“mod”,”mod2″…) and later aplly changes

          Each time i must use many lines to do one same thing to many mod

          Is there a way ?

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

            There are multiple ways to do that. First, Lua has tables and you can keep pointers to modulators in a table

            modulatorTable["mod1"] = panel:getModulatorByName("mod1")
            modulatorTable["mod2"] = panel:getModulatorByName("mod2")
            

            etc. Then all the Lua/Table stuff applies, http://lua-users.org/wiki/TablesTutorial You can use that to store your modulators at panel startup and later just access them through the table

            Also there is a special method that returns a table of modulators based on a wildcard applied to theirs name, assuming that your modulator names start with “mod” and you have 2 of them (or more), you could do:

            t = panel:getModulatorsWildcard("mod*", true)
            console ("mods in table: "..#t)
            

            and the “t” will be a table of modulators found.

            I’m sure with Lua you can use loads of other methods to keep modulators. You can index the tables using numbers, string, hell if you have a look at the tutorial you can use other functions as keys. So there is a lot you can do.

            • This reply was modified 11 years ago by atom.
          Viewing 4 posts - 1 through 4 (of 4 total)
          • The forum ‘Programming’ is closed to new topics and replies.
          There is currently 0 users and 97 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