PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on February 02, 2010, 05:28:02 PM

Title: I'm confussed
Post by: Martin Francom on February 02, 2010, 05:28:02 PM
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       
Title: Re: I'm confussed
Post by: Roger Garstang on February 02, 2010, 05:39:42 PM
Two functions are needed.  Use the Combobox GetText and it needs supplied the Combobox GetCurSel for the parameter to get the text from.
Title: Re: I'm confussed
Post by: Roger Garstang on February 02, 2010, 05:45:06 PM
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.
Title: Re: I'm confussed
Post by: Rolf Brandt on February 02, 2010, 07:19:47 PM
You might use this:

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

Title: Re: I'm confussed
Post by: Martin Francom on February 02, 2010, 09:10:28 PM
Roger & Rolf,   Thank you.
I guess I was confussed.  It seems so simple now.
Title: Re: I'm confussed
Post by: Rolf Brandt on February 03, 2010, 04:03:20 AM
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.