nvms
asked on
How can I avoid focus rectangle appearing on click ?
I have an application with small buttons which look wrong when the focus rectangle is also visible. I have seen somewhere an API call (or something) which prevents this being shown
Any ideas?
Stewart
Any ideas?
Stewart
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It is a VB 6.0 application, sorry for not clarifying that... thanks also Jon, I shall hunt down the DrawFocusRect() call unless someone beats me to it !
Public Declare Function DrawFocusRect Lib "user32" Alias "DrawFocusRect" (ByVal hdc As Long, lpRect As RECT) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
I cant find the KillWindowFocus function :-/
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
I cant find the KillWindowFocus function :-/
use the Public Declare Function DrawFocusRect Lib "user32" Alias "DrawFocusRect" (ByVal hdc As Long, lpRect
As RECT) As Long
with a 0,0,0,0 rectangle to remove the focus.
As RECT) As Long
with a 0,0,0,0 rectangle to remove the focus.
ASKER
Hi
I think John Fish has got cloest, but I am a little vague on how to actually employ this function on specific (small) buttons on my form.
Public Declare Function DrawFocusRect Lib "user32" Alias "DrawFocusRect" (ByVal hdc As Long, lpRect
As RECT) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
looks good, and I take Integam's comment to specify 0,0,0,0 which seems logical but where does this fit ? In the Click sub of the button ? or when the form is loaded ? I don't mind losing ALL rectangles on this particular form
Stewart
p.s. sorry for the delay, this project was on the shelf for a few weeks
I think John Fish has got cloest, but I am a little vague on how to actually employ this function on specific (small) buttons on my form.
Public Declare Function DrawFocusRect Lib "user32" Alias "DrawFocusRect" (ByVal hdc As Long, lpRect
As RECT) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
looks good, and I take Integam's comment to specify 0,0,0,0 which seems logical but where does this fit ? In the Click sub of the button ? or when the form is loaded ? I don't mind losing ALL rectangles on this particular form
Stewart
p.s. sorry for the delay, this project was on the shelf for a few weeks
try in the GotFocus() procedure... Also, if you dont want to bother, you can use this:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_KILLFOCUS = &H8
And in form_load:
Private Sub Form_Load()
Me.Show
SendMessage ControlName.hWnd, WM_KILLFOCUS, 0, 0
'... for each control
End Sub
Now, the controls will never receive focus, as far as I can see anyway. No need for code in any other procedure I dont think...
Hope this helps!
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_KILLFOCUS = &H8
And in form_load:
Private Sub Form_Load()
Me.Show
SendMessage ControlName.hWnd, WM_KILLFOCUS, 0, 0
'... for each control
End Sub
Now, the controls will never receive focus, as far as I can see anyway. No need for code in any other procedure I dont think...
Hope this helps!
nvms,
Some of these questions have been open for some time. Please resolve them appropriately as soon as possible.
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20091307
https://www.experts-exchange.com/jsp/qShow.jsp?ta=hardgen&qid=20189857
https://www.experts-exchange.com/jsp/qShow.jsp?ta=fonts&qid=11466658
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20246539
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20169234
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20156218
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20148915
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20144898
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20113147
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20091309
https://www.experts-exchange.com/jsp/qShow.jsp?ta=msoutlook&qid=20185178
Thanks,
Netminder
Community Support Moderator
Experts Exchange
Some of these questions have been open for some time. Please resolve them appropriately as soon as possible.
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20091307
https://www.experts-exchange.com/jsp/qShow.jsp?ta=hardgen&qid=20189857
https://www.experts-exchange.com/jsp/qShow.jsp?ta=fonts&qid=11466658
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20246539
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20169234
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20156218
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20148915
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20144898
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20113147
https://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20091309
https://www.experts-exchange.com/jsp/qShow.jsp?ta=msoutlook&qid=20185178
Thanks,
Netminder
Community Support Moderator
Experts Exchange
There has been no activity in this question in quite some time, and it looks like it has been abandoned. As part of our ongoing mission to clean up the topic areas, a Moderator will finalize this question within the next seven (7) days. At that time, either I or one of the other Moderators will force/accept the comment of JonFish85.
DO NOT ACCEPT THIS COMMENT AS AN ANSWER. If you have further comments on this question or the recommendation, please leave them here.
Thanks,
Netminder
Community Support Moderator
Experts Exchange
DO NOT ACCEPT THIS COMMENT AS AN ANSWER. If you have further comments on this question or the recommendation, please leave them here.
Thanks,
Netminder
Community Support Moderator
Experts Exchange
nvms,
You last logged in on 1/14/2002, and you have disregarded our requests for you to clean up your open questions. I am therefore force/accepting a comment to close this question.
Netminder
Community Support Moderator
Experts Exchange
You last logged in on 1/14/2002, and you have disregarded our requests for you to clean up your open questions. I am therefore force/accepting a comment to close this question.
Netminder
Community Support Moderator
Experts Exchange
<a href="a.htm" Onfocus="blur()">Click</a>
or if it is a button:
<input type="button" value="Click" Onfocus="blur()">
enjoy it.