?
Solved

Virtual ListBox derived from CListBox

Posted on 1997-06-07
6
Medium Priority
?
895 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
[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
  • 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 360 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
Industry Leaders: 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: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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 …
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

752 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