SetFocus_(WindowID())

Windows specific forum
Bong-Mong
User
User
Posts: 35
Joined: Sat Jan 03, 2004 6:53 pm

SetFocus_(WindowID())

Post 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,
1.3AMD, 2x 256 sdr, 32 AGP
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post 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]])
Bong-Mong
User
User
Posts: 35
Joined: Sat Jan 03, 2004 6:53 pm

Post 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
1.3AMD, 2x 256 sdr, 32 AGP
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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).
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Post 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
cya,
...Danilo
...:-=< http://codedan.net/work >=-:...
-= FaceBook.com/DaniloKrahn =-
Bong-Mong
User
User
Posts: 35
Joined: Sat Jan 03, 2004 6:53 pm

Post by Bong-Mong »

Thanks, i was using the gadget_EC for Eject/Close cdrom
1.3AMD, 2x 256 sdr, 32 AGP
Post Reply