Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - Remove focus rect from button
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Remove focus rect from button

 Post Reply Post Reply
Author
Message
JantjeKeizer View Drop Down
Groupie
Groupie


Joined: 12 February 2008
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote JantjeKeizer Quote  Post ReplyReply Direct Link To This Post Topic: Remove focus rect from button
    Posted: 27 February 2008 at 5:26am
Is it possible to remove the focus rect from a pushbutton?
We have an application that uses some small flatstyle buttons with just a 16 pixel image inside.
When the button gains focus, the rectangle is drawn inside the small button temporarily 'destroying' the image.

I've tried to subclass the button to eat the WM_SETFOCUS message. Whilst this works for vb6's native commandbutton, it doesn't seem to be working on the pushbutton.
Back to Top
nighthawk View Drop Down
Senior Member
Senior Member
Avatar

Joined: 11 June 2004
Status: Offline
Points: 167
Post Options Post Options   Thanks (0) Thanks(0)   Quote nighthawk Quote  Post ReplyReply Direct Link To This Post Posted: 02 March 2008 at 7:21am
I've ran into the same situation with other controls where I don't want it to show a focus rectangle.  My solution is to manually move the focus to another control.  So, at the end of the click event, have a line such as:

Button1.SetFocus

You can send the focus to any control that has a "SetFocus" method.  If there aren't any that you want to get focus, create one and move it off-screen so it is never seen.  I don't think it would work to set it to be invisible because I seem to recall that you can't give focus to an invisible control.
Back to Top
Jebo View Drop Down
Senior Member
Senior Member


Joined: 27 October 2005
Location: Germany
Status: Offline
Points: 318
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jebo Quote  Post ReplyReply Direct Link To This Post Posted: 29 March 2008 at 12:14pm
@Codejock-team
Is there a "DrawFocusRect"-Property in the next release?
 
Because I've the same problem and the focus rectangle is realy nasty!
Back to Top
corpcon View Drop Down
Groupie
Groupie


Joined: 28 June 2007
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote corpcon Quote  Post ReplyReply Direct Link To This Post Posted: 29 March 2008 at 1:43pm
nighthawk's solution is simple and is what has been used by developers for more than the past decade.
Back to Top
Jebo View Drop Down
Senior Member
Senior Member


Joined: 27 October 2005
Location: Germany
Status: Offline
Points: 318
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jebo Quote  Post ReplyReply Direct Link To This Post Posted: 29 March 2008 at 1:52pm
@corporn
no this is no solution it is only a workaround.
 
Because I can't use taborders for my customers. If the user press <Tab> to jump to the next control on form he'll always jump to a special control (what ever one). This "solution" I used before some years - and it is realy bad - the result is a uncontrolled GUI and much more code (U must check if the destination-control is enabled OR U must use "On Error Resume Next" *uaaaa*)
 
And by the way: nighthawk's "solution" works only, if the user "Click" the button!!! If the user focus the button on another way (like TAB-press) U need code for "On_Focus Event" too!!!
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 31 March 2008 at 1:20am
Hi,
 
DrawFocusRect property added for 12.0 release
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.