MrChiliCheese Posted February 4, 2013 Share Posted February 4, 2013 Hello! How do i manage that my edit control receives the press of the tab-key actually as tabulator-sign? Thanks! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2013 Moderators Share Posted February 4, 2013 yetrael,As far as I know you cannot use the Tab key directly in an edit control - you need to use Ctrl-Tab to insert a @TAB character into the text. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MrChiliCheese Posted February 4, 2013 Author Share Posted February 4, 2013 Seems you like answering my question. Well, some easy things are always quite hard with AutoIT, but I'll figure a nice way to get it working. Thanks, melba! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2013 Moderators Share Posted February 4, 2013 yetrael,This is a Windows limitation - not AutoIt - as Windows uses the TAB key to change the keyboard focus to the next control in the TABSTOP list. So I doubt you will find an easier workaround than you already have in Ctrl-TAB. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MrChiliCheese Posted February 4, 2013 Author Share Posted February 4, 2013 (edited) Don't doubt me! :-D Func _GUICtrlEdit_InsertTab() If Not $bHotKeyFunctionRunning Then $bHotKeyFunctionRunning = True $iCharIndex = _GUICtrlEdit_GetSel($hEdit)[0] _GUICtrlEdit_InsertText($hEdit, Chr(9), $iCharIndex) $bHotKeyFunctionRunning = False EndIf EndFunc ;==>_GUICtrlEdit_InsertTab Ans that is for the While...WEnd loop of the GUI: Dim $bHotkeySet = False While 1 $cFocus = ControlGetHandle($mGUI, "", ControlGetFocus($mGUI)) If $cFocus = $hwndEdit And $bHotkeySet = False Then $bHotkeySet = True HotKeySet("{TAB}", "_GUICtrlEdit_InsertTab") ElseIf $cFocus <> $hwndEdit And $bHotkeySet = True Then $bHotkeySet = False HotKeySet("{TAB}") EndIf WEnd Can still be improved! Edited February 4, 2013 by yetrael Link to comment Share on other sites More sharing options...
BrewManNH Posted February 4, 2013 Share Posted February 4, 2013 You'd be better off using GUISetAccelerator than using HotKeySet. Although, typing CTRL-Tab is still just as easy. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 4, 2013 Moderators Share Posted February 4, 2013 BrewManNH, + 1 M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
MrChiliCheese Posted February 4, 2013 Author Share Posted February 4, 2013 You sure? I always thought GUISetAccelerator would create an event for a button etc. Of course, I could create a dummy control and use it within this one. I'll will check which one is faster and more usable. And yes, CTRL-TAB is still handy. But I'm used to just Tab... Link to comment Share on other sites More sharing options...
BrewManNH Posted February 4, 2013 Share Posted February 4, 2013 BTW, your code doesn't run. This line "$iCharIndex = _GUICtrlEdit_GetSel($hEdit)[0]" is formatted incorrectly. This might work better for what you're attempting. #include <GUIConstantsEx.au3> #include <guiedit.au3> Local $iEditID Example() Func Example() GUICreate("Custom MsgBox", 225, 80) $iEditID = GUICtrlCreateEdit("", 10, 10, 210, 20) Local $aAccelKeys[1][2] = [["{Tab}", $iEditID]] GUISetAccelerators($aAccelKeys) GUISetState() ; Display the GUI. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE MsgBox(4096, "You selected", "Close") ExitLoop Case $iEditID _GUICtrlEdit_InsertTab() EndSwitch WEnd GUIDelete() ; Delete the GUI. EndFunc ;==>Example Func _GUICtrlEdit_InsertTab() Local $iIndex = _GUICtrlEdit_GetSel($iEditID) _GUICtrlEdit_InsertText($iEditID, Chr(9), $iIndex[0]) EndFunc ;==>_GUICtrlEdit_InsertTab If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
MrChiliCheese Posted February 4, 2013 Author Share Posted February 4, 2013 Thanks BrewManNH, I like the solution with the GUISetAccelerators, updated my script. And yes, if you use the AutoIt beta, you can do it like I did! 3.3.9.3 (8th April, 2012) (Beta) AutoIt: - Added #1191: Explicit size of arrays optional for explicit initialization. - Added: Array access on expression: StringSplit("a,b", ",")[1] Link to comment Share on other sites More sharing options...
BrewManNH Posted February 4, 2013 Share Posted February 4, 2013 But, it won't run on the non-beta version of AutoIt, and that should have been mentioned in the post that you were using it on the Beta. Someone coming across this wouldn't know that, and using it on the production version throws an error. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
MrChiliCheese Posted February 4, 2013 Author Share Posted February 4, 2013 You're right. I'll keep this in mind for further posts! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now