Solved

Virtual ListBox derived from CListBox

Posted on 1997-06-07
6
856 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 86
Replacement selected text 2 58
no14 challenge 14 62
Problem to event 3 79
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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

862 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

23 Experts available now in Live!

Get 1:1 Help Now