Re: component which will behave as detailed view in Win Expl



I am trying to implement a component which will behave as detailed view in Win OS Explorer…

I am partially sucessfull in it…
Suppose there are 3 coloumns in it so I am using 3 layout managers and 2 resizable bars

The code reads as follows…
In constructor



this will make sure all 3 coloumns take equal share in the available width

Now in resize I wrote:

	Component *comList[] = {_firstButton,_resizerBar1,0};
	layoutManager1.layOutComponents(comList,3,0,22,getWidth() - 44,21,false,true);
	xOffset += layoutManager1.getItemCurrentPosition(2);
	Component *comList1[] = {_secondButton,_resizerBar2,_thirdButton};	
	layoutManager2.layOutComponents(comList1,3,xOffset,22,layoutManager1.getItemCurrentAbsoluteSize (2),21,false,true);

This work properly except that when to move first resizable bar the other two shrink… which is not expected, instead it should resize the parent component and if it is in a Viewport, scrollbar should come.

Can anyone tell me how to implement this(i.e if you move the first resizable bar the other two components should not resize but it should resize the parent component not allowing other two components to resize)

Thanks in advance



Making a huge canvas is kind of inefficicient. The ideal way of doing things is to simply have a painter that calls virtual list members with a rectangle into wich to draw themselves. The painter can then optimize out regions that are not on screen and handle the scroll effect.

Still, if you want to just use a large canvas (probaby fine as long as the list never gets too big), then I think what I’d probably do, for simplicities sake at least, is to have the resizer bar do something like:

listComponent - forms your visible viewport
|-- canvasComponent - a component that has independent size, and represents the list text extents.
|- horizScrollbar - only visible if canvasComponent is wider than listComponent.

listComponent needs to be notified whenever canvasComponent’s width changes. There is a native JUCE callback (listener) I believe for grabbing component events such as resize. Make your listComponent listen for chnages in size to canvasComponent, and update horizSB accordingly.

Now, when any of the resizerbars resizes:

  • redefine ideal layouts (basically leave two alone, and set the third to larger or smaller depending on new width).

  • resize canvasComponent accordingly I.E. this::setWidthAndHeight() or getParentComponent().setWidthAndHeight() depdning on how you have things set up.

  • do nothing much else because the resize event will now trickle down to the layout managers, and upwards to the listComponent.


That’s what I do in my grid control, only paint what is on screen.