[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Virtual ListBox derived from CListBox

Posted on 1997-06-07
6
Medium Priority
?
907 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 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

830 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