Jump to content

Recommended Posts

Posted

I have a strange issue with using Ctrl+A to select all the text in an AutoIt edit control. I had always presumed that it was me, because Manadar told me that it works fine for him so I never reported it as a bug. I am still not sure if it is a bug. However I had the same problem on Win 2000, and now XP pro - also using different hardware. I now know it has nothing to do with my coding skills because I have the same issue with the help file examples. I also know it has nothing to do with my typing because it selects all items or text perfectly well in all other applications.

Although I have found a way to work around this by setting Ctrl+A as a hotkey when an edit control has focus on an active window, I still worry about undesirable knock on effects. Has anyone else ever experienced this problem, or can anyone think of something I haven't tried that might help me to solve this mystery?

Posted

Hi czardas,

what exactly is your issue? Doesn't it mark all characters?

So far I have had no such problem. :huh2:

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Posted

I was going to create an Example, but thought it would be easier to search the Example >> :huh2:

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted (edited)

OK, my simplified Example >>

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

#include <GUIConstantsEx.au3>
#include <GUIEdit.au3>
#include <WinAPI.au3>

_Main()

Func _Main()
    Local $hEdit, $hGUI, $iEdit, $iSelectAll
    $hGUI = GUICreate("An Example of using Ctrl+A and GUICtrlCreateEdit()", 500, 500)

    $iEdit = GUICtrlCreateEdit("An Example of using Ctrl+A and GUICtrlCreateEdit()", 10, 10, 480, 480)
    $hEdit = GUICtrlGetHandle(-1)

    $iSelectAll = GUICtrlCreateDummy()

    GUISetState(@SW_SHOW)

    Local $aAccelKeys[1][2] = [["^a", $iSelectAll]] ; Set Accelerator For Ctrl+A.
    GUISetAccelerators($aAccelKeys)
    ControlClick($hGUI, "", $iEdit) ; Click to disable initial highlight.

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit

            Case $iSelectAll ; Capture the HotKey and using _GUICtrlEdit_SetSel() select all the text in GUICtrlCreateEdit()
                Switch _WinAPI_GetFocus()
                    Case $hEdit
                        _GUICtrlEdit_SetSel($hEdit, 0, -1)

                EndSwitch
        EndSwitch
    WEnd
EndFunc   ;==>_Main
Edited by guinness

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted (edited)

OK, my simplified Example >>

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7

#include <GUIConstantsEx.au3>
#include <GUIEdit.au3>
#include <WinAPI.au3>

_Main()

Func _Main()
    Local $hEdit, $hGUI, $iEdit, $iSelectAll
    $hGUI = GUICreate("An Example of using Ctrl+A and GUICtrlCreateEdit()", 500, 500)

    $iEdit = GUICtrlCreateEdit("An Example of using Ctrl+A and GUICtrlCreateEdit()", 10, 10, 480, 480)
    $hEdit = GUICtrlGetHandle(-1)

    $iSelectAll = GUICtrlCreateDummy()

    GUISetState(@SW_SHOW)

    Local $aAccelKeys[1][2] = [["^a", $iSelectAll]] ; Set Accelerator For Ctrl+A.
    GUISetAccelerators($aAccelKeys)
    ControlClick($hGUI, "", $iEdit) ; Click to disable initial highlight.

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit

            Case $iSelectAll ; Capture the HotKey and using _GUICtrlEdit_SetSel() select all the text in GUICtrlCreateEdit()
                Switch _WinAPI_GetFocus()
                    Case $hEdit
                        _GUICtrlEdit_SetSel($hEdit, 0, -1)

                EndSwitch
        EndSwitch
    WEnd
EndFunc   ;==>_Main

Thanks for that example Guiness, it seems to work fine and is probably better than my method, although I am unrgistering the hotkey whenever the GUI loses focus. EDIT => This is much easier and more stable. I was under the impression that hotkeys like Ctrl+A were automatically set when you create the edit control. :huh2:

Ctrl+C, Ctrl+Z, Ctrl+X all work fine. I'm glad I'm not the only one who had this happen.

Edited by czardas

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
×
×
  • Create New...