How do I force a CListCtrl Scrollbar to show? - Programmer

This is a discussion on How do I force a CListCtrl Scrollbar to show? - Programmer ; Hey all- I'm trying to get a vertical scrollbar to show at all times for a CListCtrl. I've tried: m_listQueueLog.EnableScrollBar( SB_VERT, ESB_ENABLE_BOTH ); m_listQueueLog.ModifyStyle(0 ,WS_VSCROLL,0); but neither has worked to force it to show. It will still show up when ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: How do I force a CListCtrl Scrollbar to show?

  1. How do I force a CListCtrl Scrollbar to show?

    Hey all-

    I'm trying to get a vertical scrollbar to show at all times for a
    CListCtrl. I've tried:

    m_listQueueLog.EnableScrollBar( SB_VERT, ESB_ENABLE_BOTH );
    m_listQueueLog.ModifyStyle(0 ,WS_VSCROLL,0);

    but neither has worked to force it to show. It will still show up when
    the list grows, but it wont be there at all times. It looks
    unprofessional (imo) to have the 'gap column' at the end of my list
    that is just taking up space.

    Otherwise, is there a way to check if the vertical scrollbar is being
    displayed? If I could figure that out, I could easily set the width
    ~10px more or less based on that.

    Thanks for reading!


  2. Re: How do I force a CListCtrl Scrollbar to show?

    Hi,

    I've been having the same problem and I don't think there's an easy way
    of always showing the scroll bar.
    And you're right, it does look unprofessional with a gap column.

    It's easy to work out if there's a scroll bar though - just use the
    WS_VSCROLL style, i.e.

    if ((GetStyle() & WS_VSCROLL) == WS_VSCROLL)
    // There's a scroll bar
    else
    // There isn't....

    Then you can just use SetColumnWidth to adjust the width .
    (You probably ought to use ::GetSystemMetrics(SM_CXVSCROLL) for the
    scroll bar width, rather than just "~10px" though... ;-) )

    This scroll bar style seems to be dynamic after I insert a batch of
    items.

    Hope this helps,

    Liam


+ Reply to Thread