Hi,
Another thought on your program
Changes made to the UI (GraphicsWIndow objects) from within event subroutines only take effect after the event subroutine has ended. Consider the examples below.
Another thought on your program
Changes made to the UI (GraphicsWIndow objects) from within event subroutines only take effect after the event subroutine has ended. Consider the examples below.
Code:
'Main UI thread code
tb = Controls.AddTextBox(50,50)
GraphicsWindow.MouseDown = OnMouseDown
'Event Subroutines
Sub OnMouseDown
Controls.SetTextBoxText(tb,"Hello World")
Program.Delay(3000) 'Time consuming work
EndSub
Code:
'Main UI thread code
tb = Controls.AddTextBox(50,50)
GraphicsWindow.MouseDown = OnMouseDown
'Game loop
While ("True")
If (clicked) Then
Controls.SetTextBoxText(tb,"Hello World")
Program.Delay(3000) 'Other time consuming work
clicked = "" 'Reset handled flag
EndIf
Program.Delay (100) 'Don't mash cpu
EndWhile
'Subroutines
Sub OnMouseDown
clicked = "True"
EndSub