Just starting out? Need help? Post your questions and find answers here.
matalog
Posts: 14 Joined: Fri Dec 04, 2020 6:07 am
Post
by matalog » Thu Mar 06, 2025 11:14 pm
I am trying to write a little Android program that converts numbers or something small to start with.
I am struggling to get Gadgets to continuously update like I would in PureBasic with:
Code: Select all
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
Case 1
; do various things
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
I can get gadgets to appear, but they don't respond when I click on them or type in something, the way I expected after using PureBasic.
Does anyone have a small example of a StringGadget writing to a TextGadget when the StringGadget is updated?
Peter
Posts: 1197 Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:
Post
by Peter » Fri Mar 07, 2025 7:28 am
In SpiderBasic there is no event loop (WaitWindowEvent()). You have to query the events using Bind*Event().
Code: Select all
EnableExplicit
Enumeration
#Window
#TextGadget
#StringGadget
EndEnumeration
Procedure StringGadgetEvent()
SetGadgetText(#TextGadget, GetGadgetText(#StringGadget))
EndProcedure
OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 300, 100, "", #PB_Window_ScreenCentered)
TextGadget(#TextGadget, 10, 10, 200, 30, "", #PB_Text_Border)
StringGadget(#StringGadget, 10, 50, 200, 30, "")
BindGadgetEvent(#StringGadget, @StringGadgetEvent())
SetActiveGadget(#StringGadget)
matalog
Posts: 14 Joined: Fri Dec 04, 2020 6:07 am
Post
by matalog » Fri Mar 07, 2025 9:41 pm
Peter wrote: Fri Mar 07, 2025 7:28 am
In SpiderBasic there is no event loop (WaitWindowEvent()). You have to query the events using Bind*Event().
Code: Select all
EnableExplicit
Enumeration
#Window
#TextGadget
#StringGadget
EndEnumeration
Procedure StringGadgetEvent()
SetGadgetText(#TextGadget, GetGadgetText(#StringGadget))
EndProcedure
OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 300, 100, "", #PB_Window_ScreenCentered)
TextGadget(#TextGadget, 10, 10, 200, 30, "", #PB_Text_Border)
StringGadget(#StringGadget, 10, 50, 200, 30, "")
BindGadgetEvent(#StringGadget, @StringGadgetEvent())
SetActiveGadget(#StringGadget)
Thanks Peter, I have got that working now, and understand a little bit more.