Print Page | Close Window

CXTListBox Horizontal Scroll Problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2864
Printed Date: 29 May 2025 at 6:48am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTListBox Horizontal Scroll Problem
Posted By: AliRafiee
Subject: CXTListBox Horizontal Scroll Problem
Date 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




Replies:
Posted By: AliRafiee
Date 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




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net