Recently Browsing 0 members
No registered users viewing this page.
Here's my take on an auto completer, work in progress so don't be too harsh with me.
The idea is that after a spacebar press, it learns the word that was previously written, and the next time you write, it gets a list of all words that fit into what you're writing, so if the user writes "com", a word that may appear is "complex", that is, if the user has written it anytime in the past.
A popup will show up whenever the user writes with the list of words, the way to select one of the words from the list is to scroll with the mouse wheel, and middle click. The popup timeout is 2.5 secs.
PS for the next step would be nice to save words as they are, for example emails, as it is it doesn't get @ for example.
This may be a question for @Jos ... I added some user functions to Scite with the User CallTip Manager (very awesome by the way). Everything works great. However, I have a regrettably large list of parameters for some functions (unavoidable because it is an integration to another tech). Because the list is so long I can't see it all in the auto-complete tooltip, Is there a way to wrap that tooltip text?
Is it possible to have more than one combobox using _GUICtrlComboBox_AutoComplete with separate item lists? Say I wanted a GUI with two combo's, one with fruit (apple|orange|tomato) and one with vegetables (celery|Turnip|carrot) and wanted both of them to autocomplete. Is this possible? I like the way the _GUICtrlComboBox_AutoComplete example works, but I am having difficulties understanding the code :/
my first attempt:
#include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work Global $hCombo, $hCombo2 _Main() Func _Main() ; Create GUI GUICreate("ComboBox Auto Complete", 400, 296) $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) GUICtrlSetData(-1, "Apple|Orange|Tomatoe") $hCombo2 = GUICtrlCreateCombo("", 2, 42, 396, 296) GUICtrlSetData(-1, "One|Two|Three") GUISetState() ; Add files ;~ _GUICtrlComboBox_BeginUpdate($hCombo) ;~ _GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe") ;~ _GUICtrlComboBox_EndUpdate($hCombo) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func _Edit_Changed($hCombo) _GUICtrlComboBox_AutoComplete($hCombo) EndFunc ;==>_Edit_Changed Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo, $hWndCombo2 If Not IsHWnd($hCombo) Then $hWndCombo = GUICtrlGetHandle($hCombo) If Not IsHWnd($hCombo2) Then $hWndCombo2 = GUICtrlGetHandle($hCombo2) $hWndFrom = $ilParam $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word $iCode = BitShift($iwParam, 16) ; Hi Word Switch $hWndFrom Case $hCombo, $hWndCombo Switch $iCode Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box _Edit_Changed($hCombo) ; no return value EndSwitch Case $hCombo2, $hWndCombo Switch $iCode Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box _Edit_Changed($hCombo) ; no return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint there must be an easier way..