Combobox with empty item

Started by Marc van Cauwenberghe, September 27, 2012, 05:47:23 AM

Previous topic - Next topic

Marc van Cauwenberghe

Hi Paul,

I would like to add an empty string to a combobox as the first item so that one can undo the changes that one has made to a combobox. I tried to do this via the custom property of a combobox but this does nog work. Is this something related to the combobox itself or to FF.

Regards,
Marc

Rudolf Furstauer

Is this what you are looking for?

'--------------------------------------------------------------------------------
FUNCTION FORM1_WM_CREATE ( _
                         hWndForm AS DWORD, _      ' handle of Form
                         BYVAL UserData AS LONG _  ' optional user defined Long value
                         ) AS LONG

    LOCAL lIndex            AS LONG
'----------------------------------------   

    'Insert Item_00
    lIndex = FF_ComboBox_AddString(HWND_FORM1_COMBO1, "")
    FF_ComboBox_SetItemData(HWND_FORM1_COMBO1, lIndex, 0)

    'Insert Item_01
    lIndex = FF_ComboBox_AddString(HWND_FORM1_COMBO1, "Item_01")
    FF_ComboBox_SetItemData(HWND_FORM1_COMBO1, lIndex, 1)

    'Insert Item_02
    lIndex = FF_ComboBox_AddString(HWND_FORM1_COMBO1, "Item_02")
    FF_ComboBox_SetItemData(HWND_FORM1_COMBO1, lIndex, 2)
   
    'select first item
    FF_ComboBox_SetCurSel(HWND_FORM1_COMBO1, 0)   

END FUNCTION



'--------------------------------------------------------------------------------
FUNCTION FORM1_COMBO1_CBN_SELCHANGE ( _
                                    ControlIndex  AS LONG,  _  ' index in Control Array
                                    hWndForm      AS DWORD, _  ' handle of Form
                                    hWndControl   AS DWORD, _  ' handle of Control
                                    idComboBox    AS DWORD  _  ' identifier of combobox
                                    ) AS LONG


    MsgBox Str$(FF_ComboBox_GetCurSel(HWND_FORM1_COMBO1))
END FUNCTION



Rudolf Fuerstauer

Marc van Cauwenberghe

#2
Thx Rudolf. Did it that way.
Still, I have not been able to add an empty item in the (custom) property of the combobox.

Paul Squires

Hi Marc,

I had the "Custom" editor coded not to allow null strings. I have now removed that restriction so blank strings can be used. Fix will be in the next update.
Paul Squires
PlanetSquires Software

Paul Squires

Paul Squires
PlanetSquires Software

Marc van Cauwenberghe