Solved

Scrolling ListBox problem!

Posted on 2000-03-18
12
786 Views
Last Modified: 2013-11-20
I have owner-draw ComboBox! I try to control scrolling with my code.
Window is scrolled normally, but WM_DRAWITEM message doesn't know that window was scrolled!!!!
How to "explain" to WM_DRAWITEM that windows was scrolled!!!! SetScrollPos
doesn't help!
I can't use SetTopIndex function, because only part of window is scrolled
(because of header)!

I have this code in my WM_VSCROLL message: (only for LINEDOWN)
****************************************
 CRect rect;

 switch(nSBCode)
 {
  case SB_LINEDOWN:
     GetClientRect(&rect);
     rect.top=rect.top+30;
     ScrollWindow(0,-15,rect,NULL);
     SetScrollPos(SB_VERT,nPos+1,TRUE);
     break;
  case SB_ENDSCROLL:
     break;
 }
****************************************

Thank you for your help!!!!

Simon

0
Comment
Question by:si124
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 2
12 Comments
 
LVL 5

Expert Comment

by:Wyn
ID: 2631243
Try call UpdateWindow() after ScrollWindow.
Also try check the DRAWITEMSTRUCT or WM_DRAWITEM.
Btw:not very clear with your problem.

Regards
W.Yinan
0
 

Author Comment

by:si124
ID: 2631312
Edited text of question.
0
 

Author Comment

by:si124
ID: 2631314
Edited text of question.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:si124
ID: 2631318
I have tried with UpdateWindow, but without success!!
What can I check in WM_DRAWITEM?

Thanks
0
 
LVL 5

Expert Comment

by:Wyn
ID: 2631481

0
 

Author Comment

by:si124
ID: 2631650
In WM_DRAWITEM message
lpDrawItemStruct->rcItem and lpDrawItemStruct->itemData
are still connected like window woudn't be scrolled!
If I use scrolling by default everything works OK! How to fix this by manual scrolling?
0
 

Author Comment

by:si124
ID: 2631652
Adjusted points from 50 to 80
0
 
LVL 12

Expert Comment

by:migel
ID: 2635102
Hi!
1 solution: call Defult() in the OnHScroll
2. manually add current scroll pos to the
pDrawItemStruct->rcItem while you handle WM_DRAWITEM message.

IMHO handling WM_VSCROLL msg in the ownerdraw wnd so unusial. What reason to do it?
0
 

Author Comment

by:si124
ID: 2635153
Reason is very simple.
I put a header control on the top of the listbox. So I have to scroll only part of Listbox, that header control is always on the top!
0
 
LVL 12

Expert Comment

by:migel
ID: 2635170
hmm,
so you must manually ajust items rectangle (and index too) based on the current scroll position
0
 

Author Comment

by:si124
ID: 2635175
I know this solution. I thought that it could be a way to do this automatically!
0
 
LVL 12

Accepted Solution

by:
migel earned 80 total points
ID: 2635282
hm
you can not :-), since you grab scroll messages and do not path them to the default procedure you must work manually all related things :-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to determine file rename from EventLog ? 2 62
sumDigits challenge 9 180
pre4 challenge 19 116
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 659
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question