poisonkiller Posted June 10, 2007 Share Posted June 10, 2007 (edited) A while ago, I read from support section (well, maybe it was GUI section), that some ppl needed a program, that searches text as you type. There was suggested to make it with ListView, but I have used List more and it's easier to use. So here's the code: expandcollapse popup#include <GuiConstants.au3> Dim $buffer $data = StringReplace(FileRead("data.txt"), @CRLF, "|") Opt("GUIDataSeparatorChar", "|") $split = StringSplit($data, "|") GuiCreate("Search as typing", 179, 336,-1, -1) $input = GuiCtrlCreateInput("", 10, 10, 160, 20) $list = GUICtrlCreateList("", 10, 40, 160, 271) GuiCtrlSetData($list, $data) $case = GUICtrlCreateCheckbox("Case sensitive", 10, 311, 160, 20) GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit If GuiCtrlRead($input) <> "" Then $savetext = GuiCtrlRead($input) For $i = 1 to $split[0] If GuiCtrlRead($case) = $GUI_CHECKED Then If StringLeft($split[$i], StringLen(GuiCtrlRead($input))) == $savetext Then $buffer &= $split[$i] & "|" EndIf Else If StringLower(StringLeft($split[$i], StringLen(GuiCtrlRead($input)))) == StringLower($savetext) Then $buffer &= $split[$i] & "|" EndIf EndIf Next $buffer = StringTrimRight($buffer, 1) GuiCtrlSetData($list, "") GuiCtrlSetData($list, $buffer) $buffer = "" ;========================================GUI Main Loop======================================== Do $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case Else ;;; EndSelect Until GuiCtrlRead($input) <> $savetext ;============================================GUI Main Loop End===================================================== If GuiCtrlRead($input) = "" Then GuiCtrlSetData($list, "") GuiCtrlSetData($list, $data) EndIf EndIf WEnd This script gets all words from "data.txt" file, so download it too for running my script. EDIT: Fixed a little mistake in code.data.txt Edited June 10, 2007 by poisonkiller Link to comment Share on other sites More sharing options...
gseller Posted June 16, 2007 Share Posted June 16, 2007 Hey.. That's Way Cool!! I have been looking at making something like that. Thanks for sharing... 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