Page 1 of 1
SetFocus_(WindowID())
Posted: Sun Jan 04, 2004 3:48 am
by Bong-Mong
when i use SetFocus_(WindowID()) it locks my buttons, any ideas
TrackBarGadget(#Gadget_EC, 250, 230, 80, 20, 0, 1, #PB_TrackBar_Ticks)
SetGadgetState(#Gadget_EC, 0)
loaded=#False
Quit=#False
Repeat
EventID.l = WindowEvent()
SetFocus_(WindowID())
Select EventID
Case 0
next question, how do i run a windows command like netstat -n from purebasic,
Posted: Sun Jan 04, 2004 12:15 pm
by Num3
You're buttons are locked beacuse you're using setfocus_ inside a LOOP!
When the window receives the command is generates a window event and executes setfocus_ again...
Better use it before the loop..
To run an external command use RunProgram(FileName$ [, Parameter$, WorkingDirectory$ [, Flags]])
Posted: Sun Jan 04, 2004 2:15 pm
by Bong-Mong
SetFocus_(WindowID()) does'nt work no where else
im tring to hide the border around trackbars.
the command worked where it was but locked button,
when i move the command to outside loop, it does'nt do nothin
Posted: Mon Jan 05, 2004 1:53 am
by PB
> SetFocus_(WindowID()) does'nt work no where else
Try putting WindowEvent() after the SetFocus command (it should flush
the event buffer and stop the loop).
Posted: Mon Jan 05, 2004 2:04 am
by Danilo
@
Bong-Mong:
You have to set the focus after an event for the
TrackbarGadget happened, not for all messages.
Code: Select all
#Gadget_EC = 1
OpenWindow(0,0,0,500,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"")
CreateGadgetList(WindowID())
TrackBarGadget(#Gadget_EC, 250, 230, 80, 20, 0, 1, #PB_TrackBar_Ticks)
SetGadgetState(#Gadget_EC, 0)
ButtonGadget(2,10,10,100,20,"Button")
loaded=#False
Quit=#False
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
End
Case #PB_EventGadget
Select EventGadgetID()
Case #Gadget_EC
SetFocus_(WindowID())
EndSelect
EndSelect
ForEver
Posted: Mon Jan 05, 2004 5:18 pm
by Bong-Mong
Thanks, i was using the gadget_EC for Eject/Close cdrom