Get rid of the Button Focus Rectangle [SOLVED]
-
SkyManager
- Enthusiast

- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
Get rid of the Button Focus Rectangle [SOLVED]
Does anybody know how to get rid of the button's focus dotted rectangle 
Last edited by SkyManager on Sat Mar 03, 2007 12:44 am, edited 1 time in total.
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
It is possible to avoid the focus rectangles using ownerdraw techniques, which is quite involved, also there are existing "patched" user32.dll's floating around the internet which accomplish it. However, it is generally considered to be a mistake for a programmer to defeat them, as your app is useless to anyone who is forced (usually temporarily, for any number of unforeseen reasons) to navigate your dialogs via the keyboard alone. He just can't tell where the heck the focus is.
BERESHEIT
Code: Select all
If GetActiveGadget(#Button)
ActivateGadget(#AnotherGadget)
EndIfPB 4.30
Code: Select all
onErrorGoto(?Fred)- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
-
SkyManager
- Enthusiast

- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong
- Fluid Byte
- Addict

- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
You tried subclassing yet?
Code: Select all
OpenWindow(0,0,0,400,300,"untitled",#WS_OVERLAPPEDWINDOW | 1)
CreateGadgetList(WindowID(0))
ButtonGadget(0,10,10,100,25,"nofocus1")
ButtonGadget(1,10,40,100,25,"nofocus2")
ButtonGadget(2,10,70,100,25,"nofocus3")
ButtonGadget(3,10,100,100,25,"standard")
Global lpPrevFunc.l
Procedure ButtonProc(hWnd.l,uMsg.l,wParam.l,lParam.l)
If uMsg = #WM_SETFOCUS : ProcedureReturn 0 : EndIf
ProcedureReturn CallWindowProc_(lpPrevFunc,hWnd,uMsg,wParam,lParam)
EndProcedure
For i=0 To 2
lpPrevFunc = SetWindowLong_(GadgetID(i),#GWL_WNDPROC,@ButtonProc())
Next
While WaitWindowEvent() ! 16 : WendWindows 10 Pro, 64-Bit / Whose Hoff is it anyway?
-
SkyManager
- Enthusiast

- Posts: 339
- Joined: Tue Jan 30, 2007 5:47 am
- Location: Hong Kong