I need to constantly mirror the contents of a listbox to an array so array(x) always contains the very updated stuff of row(x), actually it is supposed to be an array of cRows where cRow is a class containing all the data a row can contain including tags. The idea is to access that array rather than the listbox to read data (from a thread). I have already work on that but I am a bit unsure how to be sure any update (new row, cell update, cell tag update, row tag update…) will be caught so the array will always be 100% accurate… I find weird the Listbox hasn’t any ‘modified’ or so event…
CellTextChanged for cells tells you when they have been changed by you or edited by the user, and use a method to set the other attributes, so you can update the arrays each time you touch the values. Simple.
Well another idea is to use Data-On-Demand Listbox by Kem Tekinay. I have used it on one app of mine, with great results. The pros of using a virtual listbox is that your data-source can by anything you want. My data-source was a class with the data, for which I had some listbox functions (AddRow, etc). You won’t have any ThreadAccess exceptions that way.
Changes from EditCell can be captured in CellAction.
You might also need to implement DragReorderRows and/or DropObject. A hierarchical lb will also need ExpandRow/CollapseRow.
Is there anything else that changes data? Column Sorting?
I wonder if instead of mirroring the Listbox’s data you refactor to have a central Model that the Listbox is a View of and the Thread can access. Sounds like maybe the Data-On-Demand Listbox would fit with this. Your model would BE the array of cRow’s so there’s no repackaging.
When you have a Listbox subclass and you add a method to it the “Method Name” field is actually a combobox. Click on that arrow and it’ll list all the methods to override. Makes it easy to get the signatures correct.