Editable List - Programmer

This is a discussion on Editable List - Programmer ; I am using MSVS 7.1.3088 on Windows XP and am programming using MFC. I would like a user-editable list of items of variable size. I first tried ListBox but it does not appear to be editable. I then tried ComboBox ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Editable List

  1. Editable List

    I am using MSVS 7.1.3088 on Windows XP and am programming using MFC.

    I would like a user-editable list of items of variable size. I first
    tried ListBox but it does not appear to be editable. I then tried
    ComboBox with the DropDown property and tried to fill it thus.

    cwpEditWnd=(CComboBox *)GetDlgItem(IDC_COMBO);
    for (lIndex=0; lIndex<*spNumEntries; ++lIndex)
    {
    sprintf(caString, "%f", fpComboEntry[lIndex]);
    cwpEditWnd->SetDlgItemText(lIndex, caString);
    }

    When I run this, the ComboBox is just a single line and nothing happens
    when I click on the drop-down arrow. Maybe I am supposed to set the
    number of lines somewhere. However, my version of MFC does not have
    AddString, InsertString or InitStorage. (They do talk about them in
    CComboBox help but do do show up when I type cwpEditWnd-> . If I try
    adding them anyway, the compiler complains that they are not part of
    the CComboBox class.) I looked at the properties window in the dialog
    editor but it had nothing that seemed useful except for Type which I
    set to dropdown.

    Any assistance would be greatly apperciated,
    Peter.


  2. Re: Editable List

    MajorSetback@excite.com wrote:
    > I am using MSVS 7.1.3088 on Windows XP and am programming using MFC.
    >
    > I would like a user-editable list of items of variable size. I first
    > tried ListBox but it does not appear to be editable. I then tried
    > ComboBox with the DropDown property and tried to fill it thus.
    >
    > cwpEditWnd=(CComboBox *)GetDlgItem(IDC_COMBO);
    > for (lIndex=0; lIndex<*spNumEntries; ++lIndex)
    > {
    > sprintf(caString, "%f", fpComboEntry[lIndex]);
    > cwpEditWnd->SetDlgItemText(lIndex, caString);
    > }
    >
    > When I run this, the ComboBox is just a single line and nothing happens
    > when I click on the drop-down arrow. Maybe I am supposed to set the
    > number of lines somewhere. However, my version of MFC does not have
    > AddString, InsertString or InitStorage. (They do talk about them in
    > CComboBox help but do do show up when I type cwpEditWnd-> . If I try
    > adding them anyway, the compiler complains that they are not part of
    > the CComboBox class.) I looked at the properties window in the dialog
    > editor but it had nothing that seemed useful except for Type which I
    > set to dropdown.
    >
    > Any assistance would be greatly apperciated,
    > Peter.
    >


    I would say your installation or project setup is seriously hosed if you
    don't have those functions. Consider doing a new install.

    To fix the immediate problem you probably need to change the dropdown
    height of the control. In the resource editor, click on the combo box's
    drop-down arrow. Then mouse drag the control's bottom edge down a ways.

    A user-editable list is usually a custom control. For example, property
    lists (such as in the VC GUI) can be built with a list box plus a
    dynamic edit control that is created where and when the user double
    clicks. Another common approach is to use a grid control. There is a
    basic but free one at codeproject.com, and numerous commercial grid
    libraries.

    --
    Scott McPhillips [VC++ MVP]


+ Reply to Thread