PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Marc van Cauwenberghe on September 27, 2012, 05:47:23 AM

Title: Combobox with empty item
Post by: Marc van Cauwenberghe on September 27, 2012, 05:47:23 AM
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
Title: Re: Combobox with empty item
Post by: Rudolf Furstauer on September 27, 2012, 01:58:39 PM
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
Title: Re: Combobox with empty item
Post by: Marc van Cauwenberghe on September 27, 2012, 02:23:46 PM
Thx Rudolf. Did it that way.
Still, I have not been able to add an empty item in the (custom) property of the combobox.
Title: Re: Combobox with empty item
Post by: Paul Squires on September 27, 2012, 07:09:04 PM
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.
Title: Re: Combobox with empty item
Post by: Paul Squires on September 27, 2012, 07:16:05 PM
New EXE can be found at:
http://www.planetsquires.com/protect/forum/index.php?topic=3097.msg23133#msg23133
Title: Re: Combobox with empty item
Post by: Marc van Cauwenberghe on September 28, 2012, 03:23:40 AM
Thank you Paul.