For the hell of it, I wanted to read some strings from a datasection and set them to a stringgadget with a delay between each string and have tried a few things including timers and nothing works predictably as he rules are different.
In the procedure DoSillyStrings, how do I introduce a delay of a few seconds between each string? Yes, I know the timer doesn't work, I tried it:):)
I know nothing about SB!!! (But am hopeful)
Code: Select all
Define EventID, MenuID, GadgetID, WindowID
Enumeration 1
#Window_Hellotest
EndEnumeration
#WindowIndex = #PB_Compiler_EnumerationValue
Enumeration 1
#Gadget_Hellotest_cHello
#Gadget_Hellotest_lHellotext
#Gadget_Hellotest_Hellotext
#Gadget_Hellotest_cControl
#Gadget_Hellotest_bStart
#Gadget_Hellotest_bExit
EndEnumeration
#GadgetIndex = #PB_Compiler_EnumerationValue
Procedure.i Window_Hellotest()
If OpenWindow(#Window_Hellotest,228,111,320,120,"Android hello test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible)
ContainerGadget(#Gadget_Hellotest_cHello,10,10,300,40,#PB_Container_Flat|#PB_Container_BorderLess)
SetGadgetColor(#Gadget_Hellotest_cHello,#PB_Gadget_BackColor,$C0C0C0)
TextGadget(#Gadget_Hellotest_lHellotext,5,10,80,15,"Silly message",#PB_Text_Center)
SetGadgetColor(#Gadget_Hellotest_lHellotext,#PB_Gadget_BackColor,$C0C0C0)
StringGadget(#Gadget_Hellotest_Hellotext,90,5,200,20,"",#PB_String_ReadOnly|#PB_String_BorderLess)
SetGadgetColor(#Gadget_Hellotest_Hellotext,#PB_Gadget_BackColor,$C0C0C0)
CloseGadgetList()
ContainerGadget(#Gadget_Hellotest_cControl,10,60,300,50,#PB_Container_Flat|#PB_Container_BorderLess)
SetGadgetColor(#Gadget_Hellotest_cControl,#PB_Gadget_BackColor,$D7D7D7)
ButtonGadget(#Gadget_Hellotest_bStart,10,15,130,20,"Start Sillyness")
ButtonGadget(#Gadget_Hellotest_bExit,160,15,130,20,"Exit sillyness")
CloseGadgetList()
HideWindow(#Window_Hellotest,0)
ProcedureReturn WindowID(#Window_Hellotest)
EndIf
EndProcedure
Global Dim GlowColours(11)
GlowColours(0) = $0000FF
GlowColours(1) = $00FF00
GlowColours(2) = $00FFFF
GlowColours(3) = $FF0000
GlowColours(4) = $FF00FF
GlowColours(5) = $FFFF00
GlowColours(6) = $000080
GlowColours(7) = $008000
GlowColours(8) = $800000
GlowColours(9) = $800080
GlowColours(10) = $808000
GlowColours(11) = $000000
Declare DoSillyStrings()
Procedure CloseWindowEvent()
WindowID = EventWindow()
If WindowID = #Window_Hellotest
CloseWindow(#Window_Hellotest)
EndIf
EndProcedure
Procedure GadgetEvent()
GadgetID = EventGadget()
Select GadgetID
Case #Gadget_Hellotest_bStart : DoSillyStrings()
Case #Gadget_Hellotest_bExit : CloseWindow(#Window_Hellotest)
EndSelect
EndProcedure
Procedure DoSillyStrings()
Restore StartSillyStrings
While TempString.s <> "_EndSillyStrings_"
If EventTimer() = 33
Read.s TempString.s
If TempString.s <> "_EndSillyStrings_"
SetGadgetText(#Gadget_Hellotest_Hellotext, TempString.s)
SetGadgetColor(#Gadget_Hellotest_Hellotext, #PB_Gadget_FrontColor, Random(GlowColours()))
EndIf
EndIf
Wend
TempString.s = "<>"
EndProcedure
If Window_Hellotest()
BindEvent(#PB_Event_Gadget, @GadgetEvent())
AddWindowTimer(#Window_Hellotest, 33, 2000)
EndIf
DataSection
StartSillyStrings:
Data.s "You"
Data.s "are"
Data.s "a"
Data.s "hairy"
Data.s "smeg"
Data.s "brained"
Data.s "mongoose"
Data.s "biter"
Data.s "with"
Data.s "a"
Data.s "lizard"
Data.s "extension"
Data.s "up"
Data.s "ya"
Data.s "hairy"
Data.s "buttcrack"
Data.s "_EndSillyStrings_"
EndDataSection