Actually i’m working on a customised listbox that is multicolumn and where The final class also has built in models in order to replicate the XOJO way but i realise this breaks the MVC way that juice listboxes operate.
I did it to overcome some limitations in the standard classes - primarily the inability for the listbox class to easily facilitate painting in the area below the last row actually present in the
I’ve found this a lot more painful than just using inheritance, overriding and the like. In the end i’m having to take the route of making customised copies of both ListBox and aTableListBox
ListBox has to be modified because of code in Listbox::ListViewport
void updateVisibleArea (const bool makeSureItUpdatesContent)
hasUpdated = false;
const int newX = getViewedComponent()->getX();
int newY = getViewedComponent()->getY();
const int newW = jmax (owner.minimumRowWidth, getMaximumVisibleWidth());
// OLD const int newH = owner.totalItems * owner.getRowHeight(); // D STENNING
const int newH = getMaximumVisibleHeight(); // D STENNING
if (newY + newH < getMaximumVisibleHeight() && newH > getMaximumVisibleHeight())
newY = getMaximumVisibleHeight() - newH;
getViewedComponent()->setBounds (newX, newY, newW, newH);
if (makeSureItUpdatesContent && ! hasUpdated)
I also had to modify the TableListbox file
It would be much better if the standard classes can just be tweaked a little to handle my needs.
Put simply - the classes need to allow for all the row component instances BEYOND the actual rows in the model to be optionally handled. Whether for a mouse click or for painting the background ( or maybe even foreground )
I will submit my final classes here.
I plan to merge my versions of ListBox and TableListBox into just one class - since its getting far too complicated.
I’m doing all this to replicate the way XOJO ListBoxes work - which are always multi column and allow all the above.