I'm confussed

Started by Martin Francom, February 02, 2010, 05:28:02 PM

Previous topic - Next topic

Martin Francom

How do I get the ItemValue (name) from a comboBox.   I looked at the function  FF_ComboBox_GetItemData  I don't see where it returns the string value of the item. 
Also, does this function actually SET text ?   From the name I would have thought it would GET text?   I'm confussed.   



Function FF_ComboBox_GetItemData( ByVal hWndControl As Dword, _
                                  ByVal nIndex As Long _
                                  ) As Long
   
    ' Do a check to ensure that this is actually a window handle
    If IsWindow(hWndControl) Then 
       ' Set the text and return the position where the text was added.
       Function = SendMessage( hWndControl, %CB_GETITEMDATA, nIndex, 0)
    Else
       Function = %CB_ERR
    End If 
   
End Function       

Roger Garstang

Two functions are needed.  Use the Combobox GetText and it needs supplied the Combobox GetCurSel for the parameter to get the text from.

Roger Garstang

#2
As for the other function, that is kind of like lparam data in Listviews, extra data you can store in an item, not the text.  It looks commented wrong though...in looking at code for those, listboxes, and textboxes it looks like he copied/pasted when he made them and didn't change the comments.

Rolf Brandt

You might use this:

strVal = FF_ComboBox_GetText( HWND_FORM1_COMBO1, _
      FF_ComboBox_GetCurSel( HWND_FORM1_COMBO1 ) )

Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Martin Francom

Roger & Rolf,   Thank you.
I guess I was confussed.  It seems so simple now.

Rolf Brandt

Marty,

in German we have saying "Sometimes you do not see the forest because of all the trees!"

I tell you I sometime have a lot of trees around me.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)