I wanted to send another example, which worked before but no longer. Here I’m updating text only when values change. It works without the condition, but not with. Try to comment out the lines marked with “// --------”.
Another thing. Besides comparing with the behaviour of cabbageChanged
(above), I find it inconsistent also with change:k("channelName")
, which also initializes to 1. Could you please reconsider the behaviour of cabbageGet
? It seems to be causing significant issues and is inconsistent - or I cannot make sense of it.
<Cabbage> bounds(0, 0, 0, 0)
form caption("test cabbageSet in v. 2.9.137") size(300, 200), guiMode("queue"), colour(0,0,0) pluginId("tcs1")
label bounds(18, 20, 25, 14) channel("Display1") text("|") align("left") fontColour(255, 155, 90, 255) _Display(1)
label bounds(58, 20, 25, 14) channel("Display2") text("|") align("left") fontColour(255, 155, 90, 255) _Display(1)
label bounds(98, 20, 25, 14) channel("Display3") text("|") align("left") fontColour(255, 155, 90, 255) _Display(1)
rslider bounds(50, 50, 36, 36) range(1, 23, 12, 1, 1) trackerCentre(0.5) channel("Slider") colour(255, 155, 90, 255) trackerColour(255, 255, 220, 255) markerColour(0, 0, 0, 255) popupText("0")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d
</CsOptions>
<CsInstruments>
instr 1
S_Display[] cabbageGetWidgetChannels "_Display(1)"
kSlider, kSliderChange cabbageGetValue "Slider"
//printk2 kSliderChange
kArray[] init 3
if kSliderChange == 1 then // --------
kind = 0
until kind == 3 do
kArray[kind] = kSlider + kind
if kArray[kind] < 10 then
Sval sprintfk "fontColour(255, 155, 90, 100) text(|%d)", kArray[kind]
else
Sval sprintfk "fontColour(255, 255, 0, 100) text(|%d)", kArray[kind]
endif
cabbageSet 1, S_Display[kind], Sval
kind += 1
od
endif // --------
endin
</CsInstruments>
<CsScore>
f0 z
i 1 0 -1
</CsScore>
</CsoundSynthesizer>