Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Disable Tabstop for specific button


  • Please log in to reply
2 replies to this topic

#1 inm101

inm101

    Wayfarer

  • Active Members
  • Pip
  • 55 posts

Posted 23 December 2010 - 04:38 PM

I'm creating a button with the following command:

$shutdown = GUICtrlCreateButton("Shutdown", ($dw - $buw) / 2, 470, $buw, $buh)


How can I disable the tabstop for this button? I want to make it so the users HAVE to click the button to use it.

Thank you!







#2 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 19,879 posts

Posted 23 December 2010 - 04:46 PM

inm101,

You can disable TabStop for a control like this: :x
AutoIt         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <WinAPI.au3> $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("One", 10, 10, 50, 20) GUICtrlCreateLabel("Two", 10, 30, 50, 20) GUICtrlCreateLabel("Three", 10, 50, 50, 20) GUICtrlCreateButton("One", 10, 100, 80, 30) GUICtrlCreateButton("Two", 10, 140, 80, 30) _WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP))) GUICtrlCreateButton("Three", 10, 180, 80, 30) GUISetState() While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE             Exit     EndSwitch WEnd

This way you leave all the other styles in being. :P

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#3 inm101

inm101

    Wayfarer

  • Active Members
  • Pip
  • 55 posts

Posted 23 December 2010 - 05:08 PM

This was the magic line I was looking for:

_WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP)))


Thank you very much.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users