Cabbage Logo
Back to Cabbage Site

Button not responding

Hello,

I’m fairly new to Cabbage and I’ve been trying rather desperately to get a button to switch the visibility of an image. Sounds like a simple task and I’ve tried the classic chnset and cabbageSet route. But after many different tries without any effect taking place, I decided to see if any input is registered at all.

    <Cabbage>

            form caption("Replicant"), size(1300, 722), guiMode("queue"), pluginId("rSYN"), typeface("PhosphatePro-Inline.otf")
            button bounds(360, 80, 40, 40), channel("wrfo1Retrigger"), value(0), visible(1)

    </Cabbage>
    <CsoundSynthesizer>
            <CsInstruments>
                    ; Initialize the global variables (sample rate, audio channels, reference vol). 
                    ksmps = 32
                    nchnls = 2
                    0dbfs = 1

                    instr 1
    
                    ;GUI
                    kWRFO1Ret cabbageGet "wrfo1Retrigger"
                    printk2 kWRFO1Ret

                    endin
            </CsInstruments>

            <CsScore>
                    ;causes Csound to run for about 7000 years...
                    f0 z
            </CsScore>
    </CsoundSynthesizer>

Massively shortened the code for better readability. What I did is simply try to get Cabbage to print out the button’s value when it’s being pressed. Tried all sorts of print statements and the few solutions to similar issues I’ve already found in this forum. But so far nothing has helped. Cabbage does not seem to register the button being pressed. It also doesn’t throw an error which makes things even weirder.

As you can guess, restarting the IDE doesn’t help. Is it a glitch? A bug? Or am I simply blind, unable to find a very simple mistake in my code? The version I use: 2.9.0.

Thanks for the help!

Cheers!

Hi @paragogia, welcome to the forum :slight_smile: If you want the value of a widget, use cabbageGetValue. The following code:

kWRFO1Ret cabbageGet "wrfo1Retrigger"

is ambiguous because it doesn’t return a value, or an identifier. Another issue with your code is that you never start instrument 1 to play. So even if you had the correct code in there it still wouldn’t run. Add a i1 0 z to your score to start instrument one running for an indefinite duration.

Hey, thanks.

Ah that seems to fix the issue. Thank you very much!