Cabbage Logo
Back to Cabbage Site

Widget value change

Hello All

Here is a little piece of code which I would expect to change the value of combo box value and of the second button when first button is pressed… but it does not work… what am I doing wrong ? Thanks for help.

<Cabbage>
form caption("Untitled") size(800, 600), colour(58, 110, 182), pluginID("def1")
button bounds(24, 36, 80, 40) channel("buttonchan00") identchannel("setbuttonchan00") text("On", "Off") 
groupbox bounds(148, 22, 200, 100)     {
button bounds(10, 20, 80, 40) channel("b1") identchannel("setb1") value(1) text("Push me", "Pushed") colour:0(161, 47, 47, 255) colour:1(21, 161, 106, 255) 
combobox bounds(10, 70, 80, 20) channel("combochan02") identchannel("setcombochan02") value(3) text("Item 1", "Item 2", "Item 3", "Item 4") 
}
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1
    if changed:k(chnget:k("buttonchan00"))==1 then
        if chnget:k("buttonchan00")==1 then
            chnset "value(0)","setb1"
            chnset "value(2)","setcombochan02"
        else    
         chnset "value(1)","setb1"
             chnset " value(1)","setb1"
        endif
    endif 
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
i 1 0 3600
</CsScore>
</CsoundSynthesizer>

Looks like a bug, I’ll look into it. Don’t forget that you don’t need to use identifier channels when changing the values of widgets. They can be changed by sending a value to their channel. Identifier channels should really only be used to change the appearance and position of widgets.

BTW, let’s hope that this bug also covers the bug on combobox not being able to display items when a choice is selected within the source code or when loading a file into soundfiler .
Good luck fixing it ! :slight_smile:

I cant wrap my head around how to send a value to a channel. Any help or codelines?

Do you mean to update a widget?

chnsetTest.csd (687 Bytes)