Jump to content

tab stops


iagman
 Share

Recommended Posts

I have two windows on my dialog box that accept numerical input from user. These are the only two items that I wish to be controlled via the Tab key on keyboard. I want to remove the tab stops from all other controls such as buttons and windows that show output data.

I find a lot of stuff regarding tabs but nothing about removing tab stops. I've looked at everything inside Help that has the word TAB associated with it, but do not see or recognize a method of removing tab stops from controls so that they are no longer part of the tabbing order.

Anyone know if this is possible?

iagman

Link to comment
Share on other sites

You can use _WinAPI_SetwindowLong():

#include <Constants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Dim $hGUI = GUICreate('Test', 230, 150)
Dim $Input1 = GUICtrlCreateInput('', 10, 20, 200, 25)
Dim $Input2 = GUICtrlCreateInput('', 10, 60, 200, 25)
Dim $Buttons[3]

For $i = 0 To 2
    $Buttons[$i] = GUICtrlCreateButton('Button&' & $i+1, $i*70 + 10, 100, 60, 25)
    _WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, _
        BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP)))
Next

GUISetState()

Do
    Sleep(20)
Until GUIGetMsg() = -3

GUIDelete()
Link to comment
Share on other sites

To put it in a func:

#include <Constants.au3>
#include <WinAPI.au3>
Func _ModifyStyle($hControl, $Style, $Remove = False)
    If Not IsHWnd($hControl) Then $hControl = GUICtrlGetHandle($hControl)
    Switch $Remove
        Case True
            Return _WinAPI_SetWindowLong($hControl, $GWL_STYLE, _
                BitAND(_WinAPI_GetWindowLong($hControl, $GWL_STYLE), BitNOT($Style)))
        Case False
            Return _WinAPI_SetWindowLong($hControl, $GWL_STYLE, _
                BitOR(_WinAPI_GetWindowLong($hControl, $GWL_STYLE), $Style))
    EndSwitch
EndFunc
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

I ran the code given by Authenticity. It made a dialog box with two windows, then I get error message. Don't understand your code well enough to solve the error.

For the coded function, is this variable ($hControl) an example of one of the controls that will get the tabstop removed? The AND's and Or's make following the logic of what is happening difficult for me. Could you give me some pointers so I can understand better how to set up this function and weave it into my code?

Thanks, guys, for your efforts.

iagman

Link to comment
Share on other sites

I ran the code given by Authenticity. It made a dialog box with two windows, then I get error message. Don't understand your code well enough to solve the error.

For the coded function, is this variable ($hControl) an example of one of the controls that will get the tabstop removed? The AND's and Or's make following the logic of what is happening difficult for me. Could you give me some pointers so I can understand better how to set up this function and weave it into my code?

Thanks, guys, for your efforts.

iagman

Authenticity's example works fine for me. I'm using production version 3.3.0.0. What error message do you get?

Prog@ndy's function has parameters-

$hControl = the handle fo rthe control or the ID as returned by GuiCreate..

$Style = the style to be added or removed from the control

$Remove =True if the control must not have the style, False if the control must have the style.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Yes, you are right. I copied/pasted his code again and this time all went well. Even saw the three buttons I had not gotten before. Probably had a bad copy.

Thanks for your notes. I'll work on it first thing tomorrow. I think I see what to do now. Being new, I sometimes think code examples are written in Japanese.

iagman

Link to comment
Share on other sites

.. I sometimes think code examples are written in Japanese.

iagman

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

The tabstops are now working as I had hoped thanks to the code you provided. I wonder why this simple feature isn't a parameter of a control as it is created instead of requiring such a long line of code?

iagman

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...