Solved

Scrolling ListBox problem!

Posted on 2000-03-18
12
750 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
  • 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
 

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now