Abu Rashid Posted August 15, 2006 Posted August 15, 2006 Hi, I've searched the forums for this question without luck. Is it possible to have auto-complete in a Combobox, so that as you type something into a Combobox it auto-completes the word from the list. Thanks.
blademonkey Posted August 15, 2006 Posted August 15, 2006 Hi,I've searched the forums for this question without luck.Is it possible to have auto-complete in a Combobox, so that as you type something into a Combobox it auto-completes the word from the list.Thanks.good job searching:http://www.autoitscript.com/forum/index.ph...hl=autocompletetry again. ---"Educate the Mind, Make Savage the Body" -Mao Tse Tung
GaryFrost Posted August 15, 2006 Posted August 15, 2006 look in the help _GUICtrlComboAutoComplete SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Abu Rashid Posted August 15, 2006 Author Posted August 15, 2006 Well I guess I only searched for "combobox autocomplete" which doesn't bring up that thread. also that is not exactly the kind of autocomplete I want, as it gives a dropdown rather than just autocompleting the actual text you're typing. Thanks anyway though, it might have to do.
GaryFrost Posted August 15, 2006 Posted August 15, 2006 Well I guess I only searched for "combobox autocomplete" which doesn't bring up that thread.also that is not exactly the kind of autocomplete I want, as it gives a dropdown rather than just autocompleting the actual text you're typing.Thanks anyway though, it might have to do.Look in the help of the latest release. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Abu Rashid Posted August 15, 2006 Author Posted August 15, 2006 gafrost, I didn't find anything in the help on this issue. Also "_GUICtrlComboAutoComplete" I could not find anywhere, can you please elaborate on this?
Moderators SmOke_N Posted August 15, 2006 Moderators Posted August 15, 2006 gafrost,I didn't find anything in the help on this issue.Also "_GUICtrlComboAutoComplete" I could not find anywhere, can you please elaborate on this?Do you have the newest "Released Version" or even the last Beta?Released Version Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Abu Rashid Posted August 15, 2006 Author Posted August 15, 2006 I didn't notice a new version released. I had the latest beta version 3.1.1.133 I think. Will check latest stable release, thanks for your time.
Abu Rashid Posted August 15, 2006 Author Posted August 15, 2006 either I'm just not looking hard enough, or it's really well hidden, but I can't seem to find it anyway in the 3.2 help file.
Abu Rashid Posted August 15, 2006 Author Posted August 15, 2006 ok, it's under the UDF section. thanks.
Moderators SmOke_N Posted August 15, 2006 Moderators Posted August 15, 2006 ok, it's under the UDF section.thanks.Just an FYI, when you see someone refer you or anyone to the Help file for a function, and you see an underscore "_" in front of the Function name, it's going to be in the User Defined Functions (UDF) section. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Abu Rashid Posted August 15, 2006 Author Posted August 15, 2006 Thanks smoke, I gathered that now. I did realise before this was for UDF's, however I wasn't aware there were "official" UDF's actually documented in the helpfile, I assumed they were just contributions of users supported only by the users who created them.
tAKTelapis Posted August 17, 2006 Posted August 17, 2006 hmm, ive just used this UDF in a program. its a list of names, however, i have noticed that if you start to scroll down the list, it automatically moves the item under your cursor into the box. then auto completes for the input, if you keep moving your cursor down the list, the list starts scrolling (i have 680 odd names in the list) any ideas on preventing it automatically moving the information under the cursor into the input part of the combo box?
Abu Rashid Posted August 17, 2006 Author Posted August 17, 2006 I've noticed the same glitch, I was thinking you probably need to catch the event of the combo list being opened and makesure it doesn't do auto-complete in this case. Another question I have which I'm unable to fidn in the help file about combo's is how to set the text to nothing. GUICtrlSetData seems to only be able to set the entire list to nothing, rather than just the control's displayed text.
tAKTelapis Posted August 17, 2006 Posted August 17, 2006 you mean, so that the combo box appears blank, until you bring down the list and choose what you want? there are two spots where this is set: a: GUICtrlCreateCombo ( "text", left, top [, width [, height [, style [, exStyle]]]] ) the "TEXT" part should be left as "" and then it will not display that. b: GUICtrlSetData ( controlID, data [, default] ) the DEFAULT part of this should be left out. that way, the combo box should appear blank. all of mine have so far. and those are the only two things i can see that might affect it.
GaryFrost Posted August 17, 2006 Posted August 17, 2006 I've noticed the same glitch, I was thinking you probably need to catch the event of the combo list being opened and makesure it doesn't do auto-complete in this case. Another question I have which I'm unable to fidn in the help file about combo's is how to set the text to nothing. GUICtrlSetData seems to only be able to set the entire list to nothing, rather than just the control's displayed text. Not a glitch, especially when no code is provided to show how you used it. expandcollapse popup#include <GuiConstants.au3> #include <GuiCombo.au3> Global Const $WM_COMMAND = 0x0111 Global Const $CBN_EDITCHANGE = 5; Global Const $CBN_SELCHANGE = 1; Global Const $CBN_EDITUPDATE = 6; Global Const $DebugIt = 1 Global $old_string = "" GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered $Combo = GUICtrlCreateCombo("", 10, 10) GUICtrlSetData($Combo, "AutoIt|v3|is|freeware|BASIC-like|scripting|language|Autobot|Animal") $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState() GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn ExitLoop EndSelect WEnd Func _Combo_Changed() ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite (_DebugHeader("Combo Changed:" & GUICtrlRead($Combo))) ;---------------------------------------------------------------------------------------------- _GUICtrlComboAutoComplete($Combo, $old_string) EndFunc ;==>_Combo_Changed Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $nNotifyCode = _HiWord($wParam) Local $nID = _LoWord($wParam) Local $hCtrl = $lParam Switch $nID Case $Combo Switch $nNotifyCode Case $CBN_EDITUPDATE, $CBN_EDITCHANGE ; when user types in new data _Combo_Changed() Case $CBN_SELCHANGE ; item from drop down selected _Combo_Changed() EndSwitch EndSwitch ; Proceed the default Autoit3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default Autoit3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_COMMAND Func _DebugHeader($s_text) Return _ "!===========================================================" & @LF & _ "+===========================================================" & @LF & _ "-->" & $s_text & @LF & _ "+===========================================================" & @LF EndFunc ;==>_DebugHeader Func _HiWord($x) Return BitShift($x, 16) EndFunc ;==>_HiWord Func _LoWord($x) Return BitAND($x, 0xFFFF) EndFunc ;==>_LoWord SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Abu Rashid Posted August 17, 2006 Author Posted August 17, 2006 The control is created with a blank text field, but the problem is after an item is selected, there is a "Clear" button which should clear the combo, but not clear the list items. GUICtrlSetData replaces the list items.
tAKTelapis Posted August 17, 2006 Posted August 17, 2006 (edited) the combo box in that example does not get affected. my combo box has 680 options in it... which requires the combo box to have a scroller on it, here is my code: i know its rough, but it does the job i need, i have a habit of making do with what i already know whenever i can. now, couple it up with a text document... (called "users.txt", and in the same directory as the script) containing upto 100 records.. and you will see the issue that has arisen. its designed as a way to get a password back for a users account, users dont have access to change there own password, so they are pre-set. btw, my text doco is in the following format: codefirstnam last name ie: 123456tak telapis it works for my purposes.. but its the way the drop down list behaves thats the issue. expandcollapse popup#include <GUIConstants.au3> #Include <GuiCombo.au3> #include <file.au3> GUICreate("ICDL Passwords", 200, 200) GUISetState (@SW_SHOW) GUICtrlCreateLabel("Students Name:", 15, 15) $Username = GUICtrlCreateCombo("", 15, 35, 170, 20) $old_string = "" GUICtrlCreateLabel("Type the students name in full", 15, 65) GUICtrlCreateLAbel("ie: firstname lastname", 15, 80) $GetPassword = GUICtrlCreateButton("Get Password", 50, 160, 100) $file = FileOpen(@ScriptDir&"\"&"users.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file containing passwords") Exit EndIf $NumberOfLines = _FileCountLines(@ScriptDir&"\"&"users.txt") $LineNumber = 1 $EndOfFile = ("EndOfFile") While 1 $Line = FileReadLine($File, $LineNumber) If @error = -1 Then ExitLoop $Line1 = Stringlen($Line) $Line2 = $line1 - 6 $Line3 = StringRight($Line, $line2) _GUICtrlComboAddString($Username, $line3) $LineNumber = $lineNumber + 1 WEnd While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GetPassword $UName = StringUpper(GUICtrlRead($Username)) For $i = 0 To $NumberOfLines Step 1 $line = FileReadLine($file, $i) If @error = -1 Then ExitLoop $UsernameAndPassword = StringRegExp($line, $Uname, 0) If @extended = 1 then $Password = StringLeft($line, 6) MsgBox(0, "Password Is", "The password for "&GUICtrlRead($Username)&" is: " &$Password) EndIF Next Case $msg = $Username MsgBox(0, "test", "case 4 was called") Case Else _GUICtrlComboAutoComplete ($USername, $old_string) EndSelect WEnd Edited August 17, 2006 by tAKTelapis
Abu Rashid Posted August 17, 2006 Author Posted August 17, 2006 gafrost, Apologies for using the term glitch. I used it exactly as it is, in the example code shown under the UDF section in the help file.
GaryFrost Posted August 17, 2006 Posted August 17, 2006 the combo box in that example does not get affected.my combo box has 680 options in it...which requires the combo box to have a scroller on it,here is my code:i know its rough, but it does the job i need, i have a habit of making do with what i already know whenever i can.now, couple it up with a text document... (called "users.txt", and in the same directory as the script) containing upto 100 records.. and you will see the issue that has arisen.its designed as a way to get a password back for a users account, users dont have access to change there own password, so they are pre-set.btw, my text doco is in the following format:codefirstnam last nameie:123456tak telapisit works for my purposes.. but its the way the drop down list behaves thats the issue.I gave you a different example above, just adapt that to what you have. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
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