Thread: Embedding a control in a CListView

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    106

    Embedding a control in a CListView

    Hi,
    I'm trying to embed a CProgressCtrl (or a CStatic, or anything) into a column of a listview control. I basically want to display graphically what I have displayed numrically in the column beside it.

    So far, I have:

    bool frmProd::CreateProgress( int Index, int subIndex, int percent )
    {
    CProgressCtrl m_Prog;
    CRect ItemRect;
    CListCtrl *l_ctrl = ( CListCtrl* )GetDlgItem( IDC_PROD_VIEW );
    l_ctrl->GetSubItemRect(Index, subIndex, LVIR_BOUNDS, ItemRect);

    int left = ItemRect.left;
    int top = ItemRect.top;
    int right = ItemRect.right;
    int bottom = ItemRect.bottom;

    if( !m_Prog.Create(PBS_SMOOTH | WS_CHILD | WS_VISIBLE, CRect(left, top, right, bottom), this, 1))
    return false;

    m_Prog.SetRange(0, 100);
    m_Prog.SetPos(percent);

    return true;
    }

    This works, in the sense it doesn't crash, but it also doesn't do anything.

    tia

  2. #2
    Registered User Esss's Avatar
    Join Date
    Aug 2001
    Posts
    133
    Use GetListCtrl() to get a reference to the list view control, and make your progress control's parent the control.
    Ess
    Like a rat in a maze who says,
    "Watch me choose my own direction"
    Are you under the illusion
    The path is winding your way?
    - Rush

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (Multiline) Edit Control Limit
    By P4R4N01D in forum Windows Programming
    Replies: 9
    Last Post: 05-17-2008, 11:56 AM
  2. line number on a rich edit control
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 02-18-2008, 07:58 AM
  3. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 06:23 AM
  4. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 07:55 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM