Radio group value

Home Forums General Programming Radio group value

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #62705
    goodweather
    Participant
      • Topics: 45
      • Replies: 550
      • Total: 595
      • ★★★

      Hi,
      I created a radio group 1 with 16 “Bank” buttons and a radio group 2 with 16 “Preset” buttons.
      I want to send a message like

      	m = CtrlrMidiMessage({0xB0, 0x20, Bank})
      	panel:sendMidiMessageNow(m)
      	m = CtrlrMidiMessage({0xC0, Preset})
      	panel:sendMidiMessageNow(m)
      

      Questions:

      • what is the code / property to retrieve the value of the Bank and Preset radio groups?
      • shall I indicate this method for all buttons in the Preset radio groups? Then identify which one has been pressed OR is it a central place to put the callback for the complete radio group at once?

      Thx in advance for any help!

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

        radio group is just used to have only one button to value 1

        here you have a bunch of 0&1 values

        may be you could use property like cutomIndex

        one method (for bank and another for presets) to aplly to all buttons :
        first get a varaible (value) how? ask to own button wich index it uses
        it is called index x here
        put a stetement like :
        “if value == 1 then send midi (index x as value)”

        a problem : radio button function only works with mousedown not with patch update

        #88060
        zookthespook
        Participant
          • Topics: 1
          • Replies: 3
          • Total: 4

          Can someone point out {a quick tip} on how to create a radio group or where to find in the manual

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

            Hi, here are some instructions:
            – create your different buttons (uiImageButton) with 2 values 0 1 and 2 image frames
            – give them a name including the position of the button (this is only needed if you want to act on the radio group by a lua program). Like Preset1 Preset2…Preset16
            – Put a value in the Radio group property for all the buttons that are in the same radio group. For example 1
            – clicking on one button will set it ON and the others OFF

            To perform some action based on the selected button you need to build a lua program.
            – create a lua method with type luaModulatorValueChange that will be triggered by all the buttons of the same radio group
            – in your PanelLoaded method, add the declaration of all the modulators used in the radio group and put those variables in an array. This will make the scanning easier. So:

            modPreset1 = panel:getModulatorByName("Preset1")
            modPreset2 = panel:getModulatorByName("Preset2")
            modPreset..
            modPreset16 = panel:getModulatorByName("Preset16")
            tPresets = {modPreset1, modPreset2, modPreset.., modPreset16}
            

            – in your modulator change method you can now scan all Presets buttons to find the one which is ON. Use some code like this:

            for i=1,#tPresets do
            	if tPresets[ i ]:getModulatorValue()==1 then do_something end
             end
            

            Hope it will help

            • This reply was modified 5 years, 4 months ago by goodweather.
            • This reply was modified 5 years, 4 months ago by goodweather. Reason: Correction
            • This reply was modified 5 years, 4 months ago by goodweather. Reason: Added warning
            • This reply was modified 5 years, 4 months ago by goodweather.
          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 75 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