Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTListBox Horizontal Scroll Problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTListBox Horizontal Scroll Problem

 Post Reply Post Reply
Author
Message
AliRafiee View Drop Down
Groupie
Groupie


Joined: 06 May 2004
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote AliRafiee Quote  Post ReplyReply Direct Link To This Post Topic: CXTListBox Horizontal Scroll Problem
    Posted: 09 September 2005 at 1:06pm

I am trying to get CXTListBox to work correctly with Horizontal scroll. 

What I did was create my CXTListBox with the WS_HSCORLL and then called SetHorizontalExtent(some large number).  When I scroll the listbox horizontally it leaves garbege on the screen, and if there not enough items to fill the list vertically it will leave a black area below the last item.  Any ideas?

Thanks

Ali

Back to Top
AliRafiee View Drop Down
Groupie
Groupie


Joined: 06 May 2004
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote AliRafiee Quote  Post ReplyReply Direct Link To This Post Posted: 09 September 2005 at 1:38pm

What do you know I got it fixed.   Of course I had to change the code in CXTListBox.  The CRect that is being passed to CXTMemDC needed to be adjusted for the horizontal scroll to work correctly.

void CXTListBox::OnPaint()

{

CPaintDC dc(this);

// Get the client rect.

CRect r;

GetClientRect(&r);

//adjust the rect for the horizontal scroll

r.right += GetScrollPos(SB_HORZ);

r.OffsetRect(-GetScrollPos(SB_HORZ),0);

// determine the background color.

COLORREF clrWindow = IsWindowEnabled() ?

xtAfxData.clrWindow : xtAfxData.clr3DFace;

// Paint to a memory device context to reduce screen flicker.

CXTMemDC memDC(&dc, r, clrWindow);

// Let the window do its default painting...

CListBox::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 );

}

 

Well that fixes the horizontal scroll in general.

Now to fix the black area showing up under the last item.

Change the SetRedraw calls in the SetRedrawEx to LockWindowUpdate and UnlockWindowUpdate calls. Obviously need a condition statment.

Ali



Edited by AliRafiee
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.078 seconds.