Sign in to follow this  
Followers 0
CatchFish

Is there a style like "hidefocus" on button controls?

3 posts in this topic

Is there a way to prevent focus marks showing on GUI buttons? Just like the buttons on the toolbar of Word Pad. When you click the PASTE button, it does not have a focus at all, does it? How can I implement this on button controls?

I've used some tricks to emulate it:

#include <GUIConstants.au3>
$MainWindow = GUICreate("Test", 403, 461, -1, -1)
$ButtonNew = GUICtrlCreateButton("N", 6, 5, 23, 22) ; Click this button...
$InputDummy = GUICtrlCreateInput("", -99, -99, 1, 1, $ES_READONLY)

While 1
    $msg = GuiGetMsg()
        Select
            Case $msg = $ButtonNew
                GUICtrlSetState($InputDummy, $GUI_FOCUS) ; ...will move focus to dummy input
            Case Else
            ;;;
        EndSelect
WEnd

But still an imperfection -- I do a click-n-drag on the button, and the focus is not moved! Besides, there's a heavy border left on the button even if a normal click is performed...So I'd prefer a REAL style of button controls which is similar to the "hidefocus" property of a web button. Any suggestions? Thanks.

(ps. I searched the forum and found a method to remove $WS_TABSTOP style of a button. Very useful, but not enough for a toolbar button... ;) )

Share this post


Link to post
Share on other sites



I believe that toolbar buttons are implemented differently to your typical Windows button. Toolbar buttons are designed not to show a focus rectangle because (at least in my experience with standard toolbar buttons) they'll never receive keyboard focus anyway.

I have almost no experience with AutoIt GUIs but you may be able to achieve what you desire with some clever GUICtrlCreatePic() work and create your own custom-drawn 'button'. Since it wouldn't be a standard button you'd no longer need to worry about focus rectangles.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0