Aktonius Posted June 20, 2011 Posted June 20, 2011 (edited) Once you click input control, put something in it and afterwards that inputcontrol loses focus and if you later click on checkbox control in another tab it will turn ON the keyboard focus of the last input control that was focused. Try it yourself and you will see Edited June 20, 2011 by Aktonius
Aktonius Posted June 20, 2011 Author Posted June 20, 2011 (edited) edited: bump #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\Marko\Desktop\2+2scripts\ongame\test.kxf $Form2 = GUICreate("Form2", 405, 294, 302, 218) $Tab1 = GUICtrlCreateTab(8, 8, 369, 273) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Input1 = GUICtrlCreateInput("Input1", 48, 72, 121, 21) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlSetState(-1,$GUI_SHOW) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 48, 64, 97, 17) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited June 20, 2011 by Aktonius
guinness Posted June 20, 2011 Posted June 20, 2011 Firstly don't bump your thread less than 24 hours Secondly, it would be best to have some code where you're getting the problem, because 95% of the someone will try to replicate a supposed problem and funnily enough there isn't one! UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Aktonius Posted June 20, 2011 Author Posted June 20, 2011 (edited) ^ Code was posted, dunno how can you miss it bump reason - topic was changed completely Edited June 20, 2011 by Aktonius
MrMitchell Posted June 21, 2011 Posted June 21, 2011 Once you click input control, put something in it and afterwards that inputcontrol loses focus and if you later click on checkbox control in another tab it will turn ON the keyboard focus of the last input control that was focused.Try it yourself and you will seeSay what now?
Moderators Melba23 Posted June 21, 2011 Moderators Posted June 21, 2011 Aktonius,What you suggest is an AutoIt bug is normal Windows behaviour. When you reselect "TabSheet1" focus is given to the only control on the page - actioning the checkbox on the other tabsheet has nothing to do with it. If you want to prevent the text in the input being selected, then you have to tell Windows that this is what you want to do:#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> $Form2 = GUICreate("Form2", 405, 294, 302, 218) $Tab1 = GUICtrlCreateTab(8, 8, 369, 273) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Input1 = GUICtrlCreateInput("Input1", 48, 72, 121, 21) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlSetState(-1,$GUI_SHOW) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 48, 64, 97, 17) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Tab1 ; Tab clicked <<<<<<<<<<<<< Switch GUICtrlRead($Tab1) Case 0 ; Tabsheet1 was clicked <<<<<<<<<<<<< _GUICtrlEdit_SetSel($Input1, -1, -1) ; Send the cursor to the end of the text <<<<<<<<<<<<< EndSwitch EndSwitch WEndAll clear? 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
GEOSoft Posted June 21, 2011 Posted June 21, 2011 (edited) Another trick to avoid setting focus to a control on a window is to create a 1x1 empty label someplace and set focus to that. I've also been know to create other controls with the position outside the GUI window and set focus to that. EDIT: I've noticed a few times now that you have quickly come to the conclusion that something you don't understand makes you jump to the conclusion that it's a bug. There may still be a couple of bugs floating around from the last release version but you can bet that most actual bugs have been reported by now. You can always look through Trac to see what has been reported and what has been fixed. Edited June 21, 2011 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Aktonius Posted June 25, 2011 Author Posted June 25, 2011 Aktonius, What you suggest is an AutoIt bug is normal Windows behaviour. When you reselect "TabSheet1" focus is given to the only control on the page - actioning the checkbox on the other tabsheet has nothing to do with it. If you want to prevent the text in the input being selected, then you have to tell Windows that this is what you want to do: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Include <GuiEdit.au3> $Form2 = GUICreate("Form2", 405, 294, 302, 218) $Tab1 = GUICtrlCreateTab(8, 8, 369, 273) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Input1 = GUICtrlCreateInput("Input1", 48, 72, 121, 21) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlSetState(-1,$GUI_SHOW) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 48, 64, 97, 17) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Tab1 ; Tab clicked <<<<<<<<<<<<< Switch GUICtrlRead($Tab1) Case 0 ; Tabsheet1 was clicked <<<<<<<<<<<<< _GUICtrlEdit_SetSel($Input1, -1, -1) ; Send the cursor to the end of the text <<<<<<<<<<<<< EndSwitch EndSwitch WEnd All clear? M23 Its clear what you mean, thanks for explaining. But then again even this is not a bug i still think its stupid and pointless Windows behavior. Why would windows focus any control in the entire Tab. So even if you say have only checkboxes in tab2 it will keyboard input-focus control from tab1 when you click checkbox in tab2. Really weird and arrogant by Windows. On the end i had to make invisible dummy control which i focus to avoid this. Another trick to avoid setting focus to a control on a window is to create a 1x1 empty label someplace and set focus to that. I've also been know to create other controls with the position outside the GUI window and set focus to that. EDIT: I've noticed a few times now that you have quickly come to the conclusion that something you don't understand makes you jump to the conclusion that it's a bug. There may still be a couple of bugs floating around from the last release version but you can bet that most actual bugs have been reported by now. You can always look through Trac to see what has been reported and what has been fixed. Say what? This is the first time i ever said i think something in Autoit is a bug and even its not i think this is at least pointless by Windows.
Moderators Melba23 Posted June 25, 2011 Moderators Posted June 25, 2011 Aktonius, stupid and pointless Windows behavior [...] Really weird and arrogant by WindowsJoin the club! 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
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