Code: Select all
NewList Fruit.s()
AddElement(Fruit()) : Fruit() = "Apple"
AddElement(Fruit()) : Fruit() = "Banana"
AddElement(Fruit()) : Fruit() = "Orange"
AddElement(Fruit()) : Fruit() = "Peach"
AddElement(Fruit()) : Fruit() = "Pear"
If OpenWindow(0, 0, 0, 140, 70, "SpinGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SpinGadget(0, 20, 20, 100, 20, 1, 5)
SelectElement(Fruit(), 0)
SetGadgetState(0, 0) : SetGadgetText(0, Fruit())
ButtonGadget(1, 20, 45, 100, 20, "Debug")
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
If EventGadget() = 0
SelectElement(Fruit(), GetGadgetState(0) -1)
SetGadgetText(0, Fruit())
ElseIf EventGadget() = 1
Select GetGadgetState(0) -1
Case 0
Debug "Nice and crunchy"
Case 1
Debug "Full of goodness"
Case 2
Debug "Nice and juicy"
Case 3
Debug "Great with cream"
Case 4
Debug "Hmm, not bad"
EndSelect
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf