I’m trying to have a combo box allow the user to switch between different background images. I’ve got it working halfway - it does change the image but only once the keyboard is pressed rather than changing when the combo box selection is changed.
I’ve been really confused as to what I’m doing wrong here so any help is appreciated.
Thanks!
Here’s the code:
bounds(0, 0, 0, 0)
form caption(“Chinchilla Image Test”) size(1000, 540), guiMode(“queue”), pluginId(“def1”) bundle("./imgs")
image bounds(0, 0, 1000, 540) channel(“image1”) file("./imgs/Kirby1.jpg") visible(1)
image bounds(0, 0, 1000, 540) channel(“image2”) file("./imgs/Kirby2.jpg") visible(0)
image bounds(0, 0, 1000, 540) channel(“image3”) file("./imgs/Kirby3.jpg") visible(0)
combobox bounds(902, 434, 80, 20) channel(“imagebox”) text(“Kirby1”, “Kirby2”, “Kirby3”)
keyboard bounds(294, 444, 368, 60)
instr 1
kpic chnget “imagebox”
ktrig changed kpic
if ktrig==1 then
reinit RESTART
endif
RESTART:
if chnget:k(“imagebox”) == 1 then
cabbageSet ktrig, “image1”, “visible”, 1
else
cabbageSet ktrig, “image1”, “visible”, 0
endif
if chnget:k(“imagebox”) == 2 then
cabbageSet ktrig, “image2”, “visible”, 1
else
cabbageSet ktrig, “image2”, “visible”, 0
endif
if chnget:k(“imagebox”) == 3 then
cabbageSet ktrig, “image3”, “visible”, 1
else
cabbageSet ktrig, “image3”, “visible”, 0
endif
endin
ImageTest.zip (78.4 KB)