Page 1 of 1

Active Gadget

Posted: Fri Feb 05, 2010 1:09 pm
by charvista
Hello!
Normally, in every application, we see the current active gadget (stringGadget with active caret, or buttonGadget surrounded by a dotted frame for example) but in my software made with PureBasic it is not always visible, I mean, that stringGadgets are always visible, but the buttons do *not* receive the dotted frame, when I press the TAB key to jump between the gadgets. What is preventing this, or what may prevent this happening? Sorry that I cannot include an example here as the package has become too large.
Any idea ?

Re: Active Gadget

Posted: Fri Feb 05, 2010 1:22 pm
by srod
Been discussed lots of times! :)

Freak has stated that this should be addressed in PB 4.5. http://www.purebasic.fr/english/viewtop ... logMessage

In the meantime, if you search on #WM_UPDATEUISTATE you might find some remedies.

Re: Active Gadget

Posted: Fri Feb 05, 2010 2:40 pm
by RASHAD
@charvista
In the meantime have a look at
http://www.purebasic.fr/english/viewto ... 2&t=40676

Re: Active Gadget

Posted: Fri Feb 05, 2010 4:47 pm
by charvista
Erm... to me it's my first discussion about this subject :D

As this is not urgent at this time, I will wait for the version 4.5. Glad to know that my programs are okay.
Thank you very much srod & Rashad.

Re: Active Gadget

Posted: Mon Feb 08, 2010 7:45 pm
by ABBKlaus
as it was urgent in my case :twisted: here“s my workaround :

Windows only, PB4.31+

Code: Select all

#UIS_SET        = 1
#UIS_CLEAR      = 2
#UIS_INITIALIZE = 3
#UISF_HIDEFOCUS = 1
#UISF_HIDEACCEL = 2
#UISF_ACTIVE    = 4

Procedure SetUIState(hwnd.i,LoWord.w,HiWord.w)
  SendMessage_(hwnd,#WM_UPDATEUISTATE,(LoWord & $FFFF) | (HiWord<<16),0)
EndProcedure

If OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
  ButtonGadget(0, 10, 10, 200, 20, "Button 1")
  ButtonGadget(1, 10, 40, 200, 20, "Button 2")
  
  SetUIState(WindowID(0),#UIS_CLEAR,#UISF_HIDEFOCUS|#UISF_HIDEACCEL)
  
  SetActiveGadget(0)
  Repeat:Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

Re: Active Gadget

Posted: Fri Feb 12, 2010 4:09 pm
by charvista
Many thanks ABBKlaus for your temporary solution.
Hope however that PB 4.50 will come soon :D