Creating table using List Control and List View - Programmer

This is a discussion on Creating table using List Control and List View - Programmer ; Hello, I am very new to MFC gui desinger and having hard time creating something that I thought will be very simple. I am trying to make a simple table with mulitple columns and rows(like jtable). I created List Control ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Creating table using List Control and List View

  1. Creating table using List Control and List View

    Hello,

    I am very new to MFC gui desinger and having hard time creating
    something that I thought will be very simple. I am trying to make a
    simple table with mulitple columns and rows(like jtable).

    I created List Control module in my gui(BTW, I can't find that variable
    anywhere in the code!). In OnInitDialog(), I am trying to add columns
    and load data into the table.

    BOOL CTaskManagerDlg::OnInitDialog()
    {
    ....
    GetListCtrl().InsertColumn(0, "Name1") ;
    GetListCtrl().InsertColumn(1, "Name2");
    ....
    }

    I get compile error from using GetListCtrl(). Since I can't find the
    variable/object for the List Control, how should I do this?

    Thanks in advance,

    Semi


  2. Re: Creating table using List Control and List View

    semi wrote:

    > Hello,
    >
    > I am very new to MFC gui desinger and having hard time creating
    > something that I thought will be very simple. I am trying to make a
    > simple table with mulitple columns and rows(like jtable).
    >
    > I created List Control module in my gui(BTW, I can't find that variable
    > anywhere in the code!). In OnInitDialog(), I am trying to add columns
    > and load data into the table.
    >
    > BOOL CTaskManagerDlg::OnInitDialog()
    > {
    > ...
    > GetListCtrl().InsertColumn(0, "Name1") ;
    > GetListCtrl().InsertColumn(1, "Name2");
    > ...
    > }
    >
    > I get compile error from using GetListCtrl(). Since I can't find the
    > variable/object for the List Control, how should I do this?
    >
    > Thanks in advance,
    >
    > Semi
    >


    Putting a control on a dialog in the GUI designer does not create a
    variable. Right click on the control and select class wizard. Use the
    wizard to create a 'control' type of member variable. In this case it
    will default to a CListCtrl variable.

    The CListCtrl is relatively complex. Suggest you start by learning how
    to create control member variables for simple stuff like buttons and
    edit controls first.

    --
    Scott McPhillips [VC++ MVP]


  3. Re: Creating table using List Control and List View

    Thanks a lot~
    I had no idead, you need to creat its control var for gui objects. That
    did it.


  4. Re: Creating table using List Control and List View

    Thanks a lot~
    I had no idea you need to create own control var for gui objects. It is
    working now.


+ Reply to Thread