Radio Buttons Bug? Please help

Home Forums General Programming Radio Buttons Bug? Please help

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #69261
    iceleben
    Participant
      • Topics: 7
      • Replies: 13
      • Total: 20

      Hello,
      I have a Problem with Radio Buttons. Allthough only one Button is active and the other Display a False Message and even Show in their current Modulator Value a 0 – if I test them in a Lua Script panel:getModulatorByName(“Number1”):getModulatorValue() they still have a value of 1. Attached is an example whats going wrong…
      If you have any Workaround please help – I dont know how to adress the Buttons in a Lua Script

      Attachments:
      You must be logged in to view attached files.
      #69263
      Possemo
      Participant
        • Topics: 14
        • Replies: 638
        • Total: 652
        • ★★★

        it seems to me that radio buttons do not work with uiImagebButtons. With a standard uiButton it works when you leave the on/off values to default 0 and 1. I used them on my Moog Source panel.

        #69269
        goodweather
        Participant
          • Topics: 45
          • Replies: 550
          • Total: 595
          • ★★★

          I didn’t use radio buttons but used classical uiImageButtons (2 images – On and Off states) that are all in the same RadioGroup property number (+ Component is member of a group).
          Name your buttons as for example Bank1 to Bank16.
          When you will toggle one ON, the others are toggled OFF immediately.
          This is when you are acting on the panel.

          Then in Lua, if you need to set one of them ON (for example after recieving and reading a patch dump), I set first all of them to OFF then the desired one to ON by using (I have 2 radiogroups, one for Banks and one for Presets – Moog Sub37):

          -- Illuminate corresponding Bank and Preset buttons
          for i=0,16 do
          	btnBank = panel:getModulatorByName("btnBank"..i)
          	btnBank:setValue(0,false)
          	btnPreset = panel:getModulatorByName("btnPreset"..i)
          	btnPreset:setValue(0,false)
          end
          btnBank = panel:getModulatorByName("btnBank"..PresetBank)
          btnBank:setValue(1,false)
          btnPreset = panel:getModulatorByName("btnPreset"..PresetNumber)
          btnPreset:setValue(1,false)

          To read them, you can have one unique OnChange method for all. The same method will be called but has the changed modulator as argument “mod”. You set a Lua variable iSelectedBank by using

          if value == 1 then
            sName= L(mod:getName())
            iSelectedBank = tonumber(string.sub(sName,1,2))
          end

          As 2 modulators will change their value (one going to 1, the other to 0), you need to test for the one going to 1).

          Please try and let us know… 🙂

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

            Goodweather must be right (as always :-). I just saw that in my panels I did not have to check which radio button is set to 1, so forget my post above – sorry.

            To add something useful: when you use “mod” and “value” in a method attached to OnChange of the buttons it should look like this:

            checkButtons=function(mod,value)
            
             if value == 1 then
               sName= L(mod:getName())
               iSelectedBank = tonumber(string.sub(sName,1,2))
             end
            
            end
          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 74 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