Jump to content

Set cursor on my input


Recommended Posts

Is there any way to always have the cursor set in my sarch input?

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <File.au3>

$RIMTool = GUICreate("RIM Tool", 320, 270,-1, -1, -1, 0x00000010)
GUISetIcon(@WorkingDir & "\bb.ico", 0)
$SearchLabel = GUICtrlCreateLabel("Search String:", 20, 20, 88, 17)
$SearchInput = GUICtrlCreateInput("", 20, 40, 265, 21)


$SearchResultsLabel = GUICtrlCreateLabel("Search Results:", 20, 80, 88, 17)
$SearchResultsInput = GUICtrlCreateEdit("", 20, 100, 280, 100, -1,$ES_MULTILINE)


$Search = GUICtrlCreateButton("&Search",50, 220,100,25)
GuiCtrlSetState(-1, 512)
$Clear = GUICtrlCreateButton("&Clear",170, 220,100,25)

GUISetState(@SW_SHOW)

GUISetState()


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Clear
            GUICtrlSetData($SearchInput,"")
            GUICtrlSetData($SearchResultsInput,"")
        Case $msg = $Search
            $File = @ScriptDir & "\data.txt"
            $NumberOfLines = _FileCountLines($File)
            Dim $aRecords
            If Not _FileReadToArray($File,$aRecords) Then
                MsgBox(4096,"Error", " Error reading file to Array     error:" & @error)
            Exit
            EndIf

            $TempFile = @ScriptDir & "\temp.tmp"
            FileDelete($TempFile)
            GUICtrlSetData($SearchResultsInput,"")

            For $x = 1 to $aRecords[0]
                $FileRead= FileReadLine($File,$x)
                $Exist = StringInStr($FileRead,GUICtrlRead($SearchInput))


            If $Exist <> 0 Then
                FileWriteLine($TempFile,$aRecords[$x])
                FileReadLine($File,$x)
                ;Msgbox(0,'Record:' & $x, $aRecords[$x])
            Else
                ;MsgBox(0,"Error","Search string not found")
                ;ExitLoop
            EndIf
            Next

            $ReadTemp = FileRead($TempFile)
            GUICtrlSetData($SearchResultsInput, $ReadTemp)

            $FileRead2 = FileRead($TempFile)
            $Exist2 = StringInStr($FileRead2,GUICtrlRead($SearchInput))
            If $Exist2 = 0 Then
                MsgBox(0,"Error","Search string not found")
            EndIf
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

    EndSelect
WEnd
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...