Sign in to follow this  
Followers 0
begin10

Help Input Control

3 posts in this topic

Please need help with this. What I am trying to do is when the user types a letter into the input box the letter that is typed is compared to the items and selects the item the letter starts with If the user types another letter it then uses both letters. Like if I typed s I would see Sam selected then I type i I would see Simon selected. Here is my code so far any ideas would be gladly excepted.

#include <GUIConstants.au3>

#Include <GuiListView.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 633, 447, 193, 125)

$ListView1 = GUICtrlCreateListView("Name", 248, 88, 361, 209, $LVS_EX_TRACKSELECT)

GUICtrlSendMsg(-1, 0x101E, 0, 50)

$ListView1_0 = GUICtrlCreateListViewItem("Allen", $ListView1)

$ListView1_1 = GUICtrlCreateListViewItem("Bob", $ListView1)

$ListView1_2 = GUICtrlCreateListViewItem("Brent", $ListView1)

$ListView1_3 = GUICtrlCreateListViewItem("Dan", $ListView1)

$ListView1_4 = GUICtrlCreateListViewItem("Fred", $ListView1)

$ListView1_5 = GUICtrlCreateListViewItem("Ginger", $ListView1)

$ListView1_6 = GUICtrlCreateListViewItem("Glen", $ListView1)

$ListView1_7 = GUICtrlCreateListViewItem("Glory", $ListView1)

$ListView1_8 = GUICtrlCreateListViewItem("Sam", $ListView1)

$ListView1_9 = GUICtrlCreateListViewItem("Samuel", $ListView1)

$ListView1_10 = GUICtrlCreateListViewItem("Saul", $ListView1)

$ListView1_11 = GUICtrlCreateListViewItem("Simon", $ListView1)

$ListView1_12 = GUICtrlCreateListViewItem("Ted", $ListView1)

$ListView1_13 = GUICtrlCreateListViewItem("Tim", $ListView1)

$ListView1_14 = GUICtrlCreateListViewItem("Tommy", $ListView1)

$ListView1_15 = GUICtrlCreateListViewItem("Waun", $ListView1)

$Input1 = GUICtrlCreateInput("", 88, 88, 137, 21)

GUISetState(@SW_SHOW)

$lastkey = ""

#EndRegion ### END Koda GUI section ###

While 1

_checkinput()

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Func _checkinput()

$win_title = WinGetTitle("")

$con_foc = ControlGetFocus($win_title)

If $con_foc == "Edit1" Then ;checks for input focus

$con_text = GUICtrlRead($Input1)

If $con_text == "" Or $lastkey Then

;

Else

$lastkey = $con_text

$indexeditem = 3

;$indexed item needed help

_GUICtrlListView_SetItemSelected($ListView1, $indexeditem)

EndIf

EndIf

EndFunc

Share this post


Link to post
Share on other sites



Please need help with this. What I am trying to do is when the user types a letter into the input box the letter that is typed is compared to the items and selects the item the letter starts with If the user types another letter it then uses both letters. Like if I typed s I would see Sam selected then I type i I would see Simon selected. Here is my code so far any ideas would be gladly excepted.

#include <GUIConstants.au3>

#Include <GuiListView.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 633, 447, 193, 125)

$ListView1 = GUICtrlCreateListView("Name", 248, 88, 361, 209, $LVS_EX_TRACKSELECT)

GUICtrlSendMsg(-1, 0x101E, 0, 50)

$ListView1_0 = GUICtrlCreateListViewItem("Allen", $ListView1)

$ListView1_1 = GUICtrlCreateListViewItem("Bob", $ListView1)

$ListView1_2 = GUICtrlCreateListViewItem("Brent", $ListView1)

$ListView1_3 = GUICtrlCreateListViewItem("Dan", $ListView1)

$ListView1_4 = GUICtrlCreateListViewItem("Fred", $ListView1)

$ListView1_5 = GUICtrlCreateListViewItem("Ginger", $ListView1)

$ListView1_6 = GUICtrlCreateListViewItem("Glen", $ListView1)

$ListView1_7 = GUICtrlCreateListViewItem("Glory", $ListView1)

$ListView1_8 = GUICtrlCreateListViewItem("Sam", $ListView1)

$ListView1_9 = GUICtrlCreateListViewItem("Samuel", $ListView1)

$ListView1_10 = GUICtrlCreateListViewItem("Saul", $ListView1)

$ListView1_11 = GUICtrlCreateListViewItem("Simon", $ListView1)

$ListView1_12 = GUICtrlCreateListViewItem("Ted", $ListView1)

$ListView1_13 = GUICtrlCreateListViewItem("Tim", $ListView1)

$ListView1_14 = GUICtrlCreateListViewItem("Tommy", $ListView1)

$ListView1_15 = GUICtrlCreateListViewItem("Waun", $ListView1)

$Input1 = GUICtrlCreateInput("", 88, 88, 137, 21)

GUISetState(@SW_SHOW)

$lastkey = ""

#EndRegion ### END Koda GUI section ###

While 1

_checkinput()

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Func _checkinput()

$win_title = WinGetTitle("")

$con_foc = ControlGetFocus($win_title)

If $con_foc == "Edit1" Then ;checks for input focus

$con_text = GUICtrlRead($Input1)

If $con_text == "" Or $lastkey Then

;

Else

$lastkey = $con_text

$indexeditem = 3

;$indexed item needed help

_GUICtrlListView_SetItemSelected($ListView1, $indexeditem)

EndIf

EndIf

EndFunc

Take a look at _GUICtrlListView_FindText() in the help file (User Defined functions)

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!"

Share this post


Link to post
Share on other sites

Take a look at _GUICtrlListView_FindText() in the help file (User Defined functions)

Thanks

Share this post


Link to post
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
Sign in to follow this  
Followers 0