Jump to content

ComboBox keypressed


Valnurat
 Share

Recommended Posts

I have a ComboBox and I want, when I start writting in it, that it will show me what is the first in the list.

Like, is I start writting:

"pe" it  should show me "peter" if that is the first in the list.

How can I do that?

 

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $idClos
            ExitLoop
        Case $idComboBox
            $sComboRead = GUICtrlRead($idComboBox)
            Local $iIdx = _ArraySearch($aResult,$sComboRead,0,0,0,0,1,1)
            Local $aComputerOwner = _AD_GetObjectsInOU("OU=al,DC=AD,DC=AL,DC=ORG","(&(objectclass=computer)(managedby=" & $aResult[$iIdx][0] & "))",Default,"cn")
            _ArrayDelete($aComputerOwner,0)
            _GUICtrlListView_SetItemCount($idMylist,UBound($aComputerOwner))
            If IsArray($aComputerOwner) Then
                For $i = 0 To UBound($aComputerOwner) - 1
                    GUICtrlCreateListViewItem($aComputerOwner[$i], $idMylist)
                Next
            Else
                GUICtrlSetData($idMylist, "No computer|")
            EndIf
    EndSwitch
WEnd

 

Yours sincerely

Kenneth.

Link to comment
Share on other sites

Just BIG speed optimization of your script --> not needed _ArrayDelete():

;~  Local $aComputerOwner = _AD_GetObjectsInOU("OU=al,DC=AD,DC=AL,DC=ORG","(&(objectclass=computer)(managedby=" & $aResult[$iIdx][0] & "))",Default,"cn")
;~             _ArrayDelete($aComputerOwner,0)
;~             _GUICtrlListView_SetItemCount($idMylist,UBound($aComputerOwner))
;~             If IsArray($aComputerOwner) Then
;~                 For $i = 0 To UBound($aComputerOwner) - 1
;~                     GUICtrlCreateListViewItem($aComputerOwner[$i], $idMylist)
;~                 Next
;~             Else
;~                 GUICtrlSetData($idMylist, "No computer|")
;~             EndIf
            
 Local $aComputerOwner = _AD_GetObjectsInOU("OU=al,DC=AD,DC=AL,DC=ORG","(&(objectclass=computer)(managedby=" & $aResult[$iIdx][0] & "))",Default,"cn")
            _GUICtrlListView_SetItemCount($idMylist,UBound($aComputerOwner)-1)
            If IsArray($aComputerOwner) Then
                For $i = 1 To UBound($aComputerOwner) - 1 ; skip first item with index 0 (number of rows in array)
                    GUICtrlCreateListViewItem($aComputerOwner[$i], $idMylist)
                Next
            Else
                GUICtrlSetData($idMylist, "No computer|")
            EndIf

 

Link to comment
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
 Share

×
×
  • Create New...