Hi Rory,
I’d like to change the text and colour for e.g. the label
and the rslider
widgets independently in two separate steps. There seems to be a little bug or I am doing something wrong? It seems I can’t chnset
text and colour in two steps (sequentially). Further minor thing: it seems that rslider
text cannot be changed if the new text contains the “rslider” string. Using Cabbage version: 2.5.13
Example scenario: rslider’s label depends on rslider’s position as well as on the state of a switch (button
) while the rslider’s colour depends on the state of the switch.
My approach: trigger a block on change of rslider
or button
, chnset
text depending on the states of rslider
and button
, chnset
colour depending on the state of the button
.
Alternatively I could use elseif
statements and chnset
both text and colour with single instructions (which works), but it becomes pretty ugly in more complex scenarios.
A simple code to test:
<Cabbage>
form caption("Test_text_colour") size(365, 225), pluginid("tex1")
rslider bounds(132, 32, 40, 68) range(0, 1, 0, 1, 1e-06) channel("IO_rslider") identchannel("ID_rslider") text("slider") textcolour(0, 255, 0, 255) trackercolour(0, 100, 0, 255) popuptext("0")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --displays
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 16;
instr 1
; this doesn't work
;chnset "text(rslider1)", "ID_rslider"
; this works
;chnset "text(slider1) textcolour(255, 255, 0, 255)", "ID_rslider"
; 1. test these two lines only (only the 2nd instruction applies)
;chnset "textcolour(255, 255, 0, 255)", "ID_rslider"
;chnset "text(slider1)", "ID_rslider"
; 2. test these two lines only (only the 2nd instruction applies)
;chnset "text(slider1)", "ID_rslider"
;chnset "textcolour(255, 255, 0, 255)", "ID_rslider"
endin
</CsInstruments>
<CsScore>
f0 z
i 1 0 [3600*24*7]
</CsScore>
</CsoundSynthesizer>
Thanks for your help and all the great work!
Best wishes,
Samo