Hello Rory,
I am struggling with the behaviour of widget inside groupbox when the group box property is changed from visible(0) to visible(1).
When the state of the group box is changed, the children state is also changed… which is strange. Once would expect the children widget to remain within their previous state. (I must say I spent hours today to understand why my synth was resetting the GEN table when I was switching between groupboxes)
Is this a bug or a feature ?
Here is an ugly demo showing that.
<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginID("def1")
groupbox bounds(40, 18, 100, 100) {
button bounds(0, 20, 80, 20) channel("but0") value(1) text("Push me", "Push me") colour:1(51, 214, 13, 255) colour:0(161, 17, 17, 255) radiogroup(1)
button bounds(0, 50, 80, 20) channel("but1") text("Push me", "Push me") colour:1(51, 214, 13, 255) colour:0(161, 17, 17, 255) radiogroup(1)
}
groupbox bounds(140, 40, 100, 100) identchannel("gb1") visible(1) {
checkbox bounds(0, 20, 20, 20) channel("chk0")value(1) radiogroup(2)
checkbox bounds(40, 20, 20, 20) channel("chk1") radiogroup(2)
}
keyboard bounds(8, 158, 381, 95) mouseoeverkeycolour(255, 255, 0, 128)
</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 2
k_active active "chk_change"
if changed:k(chnget:k("but0"))==1 then
if chnget:k("but0")==1 then
chnset "visible(1)", "gb1"
if k_active=0 then
event "i","chk_change",0,-3600
endif
else
turnoff2 "chk_change",0,0
chnset "visible(0)", "gb1"
endif
endif
endin
instr chk_change
k_Changed = changed:k(chnget:k( "chk0"))
printk2 k_Changed
endin
;instrument will be triggered by keyboard widget
instr 1
kEnv madsr .1, .2, .6, .4
aOut vco2 p5, p4
outs aOut*kEnv, aOut*kEnv
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
i 2 0 z
</CsScore>
</CsoundSynthesizer>