Solved

Scrolling ListBox problem!

Posted on 2000-03-18
12
780 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
Technology Partners: 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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
Whole sheet autoscrub still needed 19 53
sameEnds challenge 3 187
ffmpeg - "rtsp://...... Operation not permitted" 4 89
Annoying "thing" blocks my view 4 130
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

735 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