01-15-2025, 08:43 PM
I don't think there is currently a way to set focus on GW, but there are other ways to get the Return key without Lastkey/SendKey. Here is another one:
Code:
GraphicsWindow.Show()
mtb = Controls.AddMultiLineTextBox(10,10) 'Multi-line will allow return
Controls.SetSize(mtb,100,21) 'Size to show 1 line only, just big enough to not need vertical scroll bar
LDFocus.SetFocus(mtb)
While ("True")
WaitForReturnKey()
GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor()
EndWhile
Sub WaitForReturnKey
char = ""
While (char <> Text.GetCharacter(10)) 'Ascii 10 is LF (Return)
tb = Controls.LastTypedTextBox
text = Controls.GetTextBoxText(tb)
len = Text.GetLength(text)
char = Text.GetSubText(text,len,1) 'last character will be LF if Return was pressed
Program.Delay(10)
EndWhile
Controls.SetTextBoxText(tb,"") 'Clear text
EndSub