Jump to content
Sign in to follow this  
GaryFrost

ComboBox UDFs

Recommended Posts

For those interested:

Func _GUICtrlComboBoxSelectedIndex($h_combobox)
; An application sends a CB_GETCURSEL message to retrieve the 
; index of the currently selected item, if any, in the list box of a combo box.
    Dim $CB_GETCURSEL = 0x147 
; The return value is the zero-based index of the currently selected item
    Return GUICtrlSendMsg ( $h_combobox, $CB_GETCURSEL , 0, 0 )
EndFunc

Func _GUICtrlComboBoxCount($h_combobox)
; An application sends a CB_GETCOUNT message to retrieve the
; number of items in the list box of a combo box. 
    Dim $CB_GETCOUNT = 0x146
; The return value is the number of items in the list box.
    Return GUICtrlSendMsg ( $h_combobox, $CB_GETCOUNT , 0, 0 )
EndFunc

Func _GUICtrlComboBoxFind($h_combobox,$s_search,$i_exact=0)
; An application sends a CB_FINDSTRING message to search the
; list box of a combo box for an item beginning with the characters
; in a specified string.
    Dim $CB_FINDSTRING = 0x14C 
; An application sends a CB_FINDSTRINGEXACT message to find the first
; list box string in a combo box that matches the string specified in
; the $s_search parameter.
    Dim $CB_FINDSTRINGEXACT = 0x158
; The return value is the zero-based index of the matching item.
    If($i_exact) Then
        Return GUICtrlSendMsg ( $h_combobox, $CB_FINDSTRINGEXACT , -1, $s_search )
    Else
        Return GUICtrlSendMsg ( $h_combobox, $CB_FINDSTRING , -1, $s_search )
    EndIf
EndFunc

Func _GUICtrlComboBoxAddItem($h_combobox, $s_text,$i_location = -1)
; An application sends a CB_INSERTSTRING message to insert a string into
; the list box of a combo box. Unlike the CB_ADDSTRING message, the
; CB_INSERTSTRING message does not cause a list with the CBS_SORT style
; to be sorted. 

; if $i_location is omitted then we append to end of list
    Dim $CB_INSERTSTRING = 0x14A 
; The return value is the index of the position at which the string was inserted.
    Return GUICtrlSendMsg ( $h_combobox, $CB_INSERTSTRING , $i_location, $s_text )
EndFunc

Func _GUICtrlComboBoxClearItems($h_combobox)
; An application sends a CB_RESETCONTENT message to remove all items from
; the list box and edit control of a combo box. 
    Dim $CB_RESETCONTENT = 0x14B
    Return GUICtrlSendMsg ( $h_combobox, $CB_RESETCONTENT , 0, 0 )
EndFunc

Func _GUICtrlCombBoxSelectString($h_combobox,$s_search,$i_StartAt = -1)
; An application sends a CB_SELECTSTRING message to search the list of
; a combo box for an item that begins with the characters in a specified string.
; If a matching item is found, it is selected and copied to the edit control.
    
; if $i_StartAt is omitted then search entire list
; otherwise it Specifies the zero-based index of the item preceding
; the first item to be searched. When the search reaches the bottom
; of the list, it continues from the top of the list back to the item
; specified by the $i_StartAt parameter
    Dim $CB_SELECTSTRING = 0x14D
; If the string is found, the return value is the index of the selected item.
    Return GUICtrlSendMsg ( $h_combobox, $CB_SELECTSTRING , $i_StartAt, $s_search )
EndFunc

Func _GUICtrlComboBoxSetSel($h_combobox,$i_index)
; An application sends a CB_SETCURSEL message to select a string in the list
; of a combo box. If necessary, the list scrolls the string into view. The text
; in the edit control of the combo box changes to reflect the new selection, and
; any previous selection in the list is removed.
    Dim $CB_SETCURSEL = 0x14E
; If the message is successful, the return value is the index of the item selected.
    Return GUICtrlSendMsg ( $h_combobox, $CB_SETCURSEL , $i_index, 0 )
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...