Hello
I’m trying to understand whether is possible to use a widget like texteditor in order to output some text to the user (like a small display area).
I defined it as:
texteditor bounds(176, 16, 400, 121), channel(“debug1”), fontSize(“12”), active(“1”), scrollbars(1), wrap(1), fontColour(124, 210, 0), colour(0, 0, 0, 100)
I’m trying to use it with instruct:
cabbageSet “debug1”, “text”, SText
But nothing happens, except for the first time, the other times the text will not change.
Thank you
Sergio
Hi @idranoels, welcome to the forum. 
As you can see, this can be done, but you need to use the i-rate version of cabbageSet
<Cabbage>
form caption("Test") size(400, 150), colour(58, 110, 182), guiMode("queue")
texteditor bounds(16, 10, 371, 107) fontSize(70), channel("texteditor10000"), readOnly(1), wrap(1),
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 --midi-key=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables.
ksmps = 32
nchnls = 2
0dbfs = 1
instr 1
SWords[] init 5
SWords[0] = "Of "
SWords[1] = "course "
SWords[2] = "this "
SWords[3] = "is "
SWords[4] = "possible."
cabbageSet metro(2), "texteditor10000", sprintfk("text(\"%s\")", SWords[int(random:k(0, 5))])
endin
</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
i1 0 z
</CsScore>
</CsoundSynthesizer>
Thank you Rory
Is there a tutorial that explains in which case I should use k-rate functions and in which case I should use i-rate functions?
Thank you
Sergio
The Csound FLOSS manual is a great resource. Here is the section on init (i-rate) and performance (k-rate) passes. Let me know if you have any further questions after reading this. It’s quite important to get your head around this principal, it pops up in Csound all the time.