I have this code as extended from PB help:
Code: Select all
EnableExplicit
Procedure doSomething(P.i)
disablegadget(5, #True)
debug "doSomething"
DisableGadget(5, #False)
SetActiveGadget(5) ; this doesn't work
EndProcedure
If OpenWindow(0, 0, 0, 270, 240, "SetActiveGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget (0, 10, 10, 250, 20, "bla bla...")
ComboBoxGadget(1, 10, 40, 250, 21)
StringGadget (5, 10, 70, 250, 20, "done")
define a
For a = 1 To 5 : AddGadgetItem(1, -1, "ComboBox item " + Str(a)) : Next
SetGadgetState(1, 2) ; set (beginning with 0) the third item as active one
ButtonGadget (2, 10, 100, 250, 20, "Activate StringGadget")
ButtonGadget (3, 10, 130, 250, 20, "Activate ComboBox")
ButtonGadget (4, 10, 160, 270, 20, "do something")
Repeat
define Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
Select EventGadget()
Case 2
SetActiveGadget(0) ; Activate StringGadget
Case 3
SetActiveGadget(1) ; Activate ComboBoxGadget
case 4
CreateThread(@doSomething(), 0)
; SetActiveGadget(5) ; this would work, but I want to await the thread...
EndSelect
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
How can I succeed setting the focus after having called the thread by clicking button "do something"?
In my tool I use a thread to do a database query and keep the GUI responsive.
But, how can I set the focus to a specified gadget?
I tried another thread; no way! (I know, from a thread GUI does not update)
Any ideas?
Thanks a lot in advance,
regards!