Autobusqueda Input
Publicado: 19 Mar 2013, 21:49
Buenas acabo de hacer un scrip para realizar una autobusqueda de las posibles palabras que estas escribiendo en un input.
Me gustaría que me corrigieses lo máximo posible, ya que seguro que hay mejores formas de hacerlo. Pero bueno partiendo de este scrip creo que se puede hacer muy bien.
Ya me contáis que tal os va.
Me gustaría que me corrigieses lo máximo posible, ya que seguro que hay mejores formas de hacerlo. Pero bueno partiendo de este scrip creo que se puede hacer muy bien.
Código: Seleccionar todo
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GuiListView.au3>
$possibles = StringSplit("Tribal 1|Tribal 2|tetrix|tracmania|dragon|dragon 4", '|')
;AdlibEnable("highlightIP", 400)
Dim $IPList[3];the inputs
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
$gui = GUICreate("My GUI edit",625, 495, 192, 124); will create a dialog box that when displayed is centered
$IP = GUICtrlCreateInput("", 160, 8, 377, 21)
$Combo1 = GUICtrlCreateCombo("Combo1", 8, 8, 145, 25)
$Button1 = GUICtrlCreateButton("Button1", 544, 8, 75, 25, $WS_GROUP)
$lab = GUICtrlCreateListView("Group1", 8, 40, 609, 137)
GUISetState()
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Func WM_COMMAND($hWnd, $msg, $wParam, $lParam)
$nNotifyCode = BitShift($wParam, 16)
$nID = BitAND($wParam, 0x0000FFFF)
If $nID = $IP Then
$hCtrl = $lParam
If $nNotifyCode = $EN_CHANGE Then
_GUICtrlListView_DeleteAllItems($lab)
$txt = GUICtrlRead($IP)
Select
Case $txt <> ""
For $n = 1 To UBound($possibles) - 1
If StringCompare(StringLeft($possibles[$n], StringLen($txt)), $txt) = 0 Then
GUICtrlCreateListViewItem($possibles[$n], $lab)
;~ ExitLoop
EndIf
Next
EndSelect
EndIf
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND