Sign in to follow this  
Followers 0
Efo74

Disable "Tab" focus on buttons

7 posts in this topic

Hello,

Is there a way to disable the ability to focus Buttons. Example: I have a form with 4 buttons, I would like to select (focus) only 2 buttons with "TAB" key.

Thank you


:rolleyes:

Share this post


Link to post
Share on other sites



You should be able to do something with GUICtrlSetState, if I am understanding your question correctly. How about providing a small reproducer to show us what you're trying to do?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Excuse me for the delay ... I'm at work.

Here is an example:

#include 

GUICreate("My GUI Button")

$Button_1 = GUICtrlCreateButton("Botton 1", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("Botton 2", 10, 60,100)
$Button_3 = GUICtrlCreateButton("Botton 3", 10, 90, 100)
$Button_4 = GUICtrlCreateButton("Botton 4", 10, 120,100)

GUISetState()

GUICtrlSetState($Button_2,$GUI_NOFOCUS)
GUICtrlSetState($Button_3,$GUI_NOFOCUS)

While 1
$msg = GUIGetMsg()
if $msg = $GUI_EVENT_CLOSE Then
ExitLoop
EndIf
WEnd

I would like to press "TAB" button on keyboard and the buttons must select "focus" only : button 1 and button 4.

If I utilize the mouse , I can press all the button .... but If I use the "TAB" I would like only button 1 and button 4.

Is that possible ???

Thank you. :ILA2:


:rolleyes:

Share this post


Link to post
Share on other sites

Hello,

Is there a way to disable the ability to focus Buttons. Example: I have a form with 4 buttons, I would like to select (focus) only 2 buttons with "TAB" key.

Thank you

You have to remove the $WS_TABSTOP style

#include <GUIConstantsEx.au3>

GUICreate("My GUI Button")

$Button_1 = GUICtrlCreateButton("Botton 1", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("Botton 2", 10, 60, 100)
$Button_3 = GUICtrlCreateButton("Botton 3", 10, 90, 100)
$Button_4 = GUICtrlCreateButton("Botton 4", 10, 120, 100)

GUISetState()
GUICtrlSetStyle($Button_2, 0) ;$GUI_SS_DEFAULT_BUTTON = 0
GUICtrlSetStyle($Button_3, 0) ;$GUI_SS_DEFAULT_BUTTON = 0


While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    EndIf
WEnd

I see fascists...

Share this post


Link to post
Share on other sites

I have found that $WS_TABSTOP in other forum posts, but I can't make work the script. Can you make me an example ?


:rolleyes:

Share this post


Link to post
Share on other sites

Efo74, did you try the code rover posted? It is exactly what you're requesting.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Ohhh. Excuse me... but I'm not see that you change GUICtrlSetState with GUICtrlSetStyle . This is exactly what I'm looking for.

Thank you , Thank you very much. :guitar:


:rolleyes:

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