In this code, i have a strange behaviour
The cursor don't appears at the end of the text in the editorGadget, then i have good write a SetActiveGadget(1)
After one hour to simplify my big code, i have find the problem, but i not understand why
If the SetActiveGadget(1) is into the second thread that not works, and if he is in the main thread, that works
Uncomment the line 36 to show the cursor
Code: Select all
Global a
Procedure Thread(*Value)
Repeat
If a
a = #False
For i = 1 To 10
If Text$ <> ""
Text$ + #CRLF$
EndIf
Text$ + "kcc hello"
Next
SetGadgetText(1, Text$)
SendMessage_(GadgetID(1), #EM_SETSEL, -1, -1)
SetActiveGadget(1) ; <====== This SetActiveGadget not works in the THREAD
EndIf
ForEver
EndProcedure
OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
EditorGadget(1, 10, 10, 492, 364)
CreateThread(@Thread(), 0)
a = #True
; SetActiveGadget(1) ; Uncomment this line, this time the cursor appear at the end of the text
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
Have a good day