Solved

Virtual ListBox derived from CListBox

Posted on 1997-06-07
6
845 Views
Last Modified: 2013-11-20
I want to create a Virtual Listbox Class derived from the CListBox Class. In this class I want to be able to browse a large database virtually. I don't want to use the vlist example from Microsoft. I would like to see if posible an example on how I should handle the scrolling as I add new items to the listbox and remove those that are no longer displayed.

Thank you.
0
Comment
Question by:HVAZQUEZ
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:mbhakta
ID: 1302009
Try using the CListCtrl instead. This has added features of showing imagelists , horizontal scrolling , headers etc, which would require owner-draw programming for a Listbox. CListCtrl is an answer to your problems.
0
 

Author Comment

by:HVAZQUEZ
ID: 1302010
I already now this. But I want to use the Listbox because I need to make it generic to be used in both VC++ 1.52 and VC++ 4.2.

0
 

Accepted Solution

by:
umesh053097 earned 120 total points
ID: 1302011
The soln. to this problem is complex and not easily explained.Here is what i would try.First of all use an Owner drawn listbox so that you can have about 16K entries. Now your listbox is a window to 16K records in your database. The problem arises when the number of entries exceeds 16K which is where you have to provide the virtual behaviour. The key to this lies in 2 things.1> Maintaining a  virtual origin.2> Manipulating the scrollbar position so that the user knows wwhen he has reached the end of the database.For ex. if you have 16K + 10 elements and the user wants to see the last 10 elements you would 1> Reset the origin to 102> Invalidate Lisbox.3> Update Window.The drawitem for each row of the litbox used the formulaorigin + itemdata(passed in DrawItemStruct)How to scroll is also something you have to fig. out.I am not sure about the 16K fig. In Win95 it is larger. However you can set it to even lesser number.All the best.
0
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!

 

Author Comment

by:HVAZQUEZ
ID: 1302012
I would have liked to have seen some code but the answer is enough to give me a clear path to my solution.

Thank you,

Hector Vazquez
0
 

Author Comment

by:HVAZQUEZ
ID: 1302013
I would have liked to have seen some code but the answer is enough to give me a clear path to my solution.

Thank you,

Hector Vazquez
0
 

Expert Comment

by:umesh053097
ID: 1302014
Your most welcome Hector.I am unable to give you any code because I have not come across this problem myself. And as I had written earlier, it is a bit complex and would take a couple of days to come up with a reasonably good solution.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

15 Experts available now in Live!

Get 1:1 Help Now