Jump to content

Recommended Posts

Posted

I have an edit control. The problem is that when one presses the tab key it selects all the text (due to it being the next control after itself). How do I have the tab key add a tab character.

Posted

  Quote

CTRL+TAB

Wow, nice, i didn't knew this, thanks!

MISIIM

  Quote

How do I have the tab key add a tab character.

See this example (wich is corrected using Siao's tip):

#include <GuiConstants.au3>

$GUI = GUICreate("Test Edit")

$Edit = GUICtrlCreateEdit("", 20, 50, 150, 150)

$Button = GUICtrlCreateButton("Button", 20, 210)
GUICtrlSetState(-1, $Gui_Focus)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
    EndSwitch
    If _IsFocused($GUI, $Edit) Then
        Sleep(20)
        HotKeySet("{TAB}", "TabPress")
    Else
        HotKeySet("{TAB}")
    EndIf
WEnd

Func TabPress()
    ;$OldClip = ClipGet()
    ;ClipPut(@TAB)
    ;Send("+{INSERT}")
    ;ClipPut($OldClip)
    
    Send("^{TAB}") ;This is the tip from Siao - Thanks!
EndFunc

Func _IsFocused($hWnd, $nCID)
    Return ControlGetHandle($hWnd, '', $nCID) = ControlGetHandle($hWnd, '', ControlGetFocus($hWnd))
EndFunc

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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
  • Recently Browsing   0 members

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