Radio group value

Home Forums General Programming Radio group value

This topic contains 3 replies, has 3 voices, and was last updated by goodweather goodweather 1 week, 4 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #62705
    goodweather
    goodweather
    Participant
    • Topics: 38
    • Replies: 326
    • Total: 364
    • ★★

    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
    zeoka
    Participant
    • Topics: 70
    • Replies: 459
    • Total: 529
    • ★★★

    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
    goodweather
    Participant
    • Topics: 38
    • Replies: 326
    • Total: 364
    • ★★

    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 1 week, 4 days ago by goodweather goodweather.
    • This reply was modified 1 week, 4 days ago by goodweather goodweather. Reason: Correction
    • This reply was modified 1 week, 4 days ago by goodweather goodweather. Reason: Added warning
    • This reply was modified 1 week, 4 days ago by goodweather goodweather.
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

There is currently 1 user and 31 guests online
disnilijucel
Forum Statistics
Threads: 2,171, Posts: 15,307, Members: 27,717
Most users ever online was 10 on October 29, 2018 2:54 pm
Do NOT follow this link or you will be banned from the site!