I have a complex GUI component which is behaving incorrectly in my app, but I have not yet managed to reproduce it in a simple example, nor with the Juce demo. Thought I'd ask in case anyone else has seen this and may know the cause.
When a tabbed component is first drawn, all of the components on the tab are drawn correctly, in the location I want. But when I switch between tabs, the components are redrawn as if their origin is (0, 0) instead of the actual position I've assigned them. As if the tab component didn't know about the initial X and Y offset of the children.
As soon as I resize the top-level window, then it forces a redraw to happen, and the components are redrawn in the correct location! Until I switch tabs again, at which point the cycle starts again.
This behaviour is exactly the same when I build for Linux or Windows. I'm on 3.1.1-242-g2c3c5c7.
My window hierarchy is:
DocumentWindow MultiDocumentPanel Component TabbedComponent Viewport Component Labels, ComboBoxes, lots of content displayed in the viewport.
This is what I do with the viewport:
viewport.setBounds( "10, 40, parent.width, parent.height" ); viewport.setViewedComponent( &canvas, false ); // the "canvas" component is the one that has all of checkboxes, labels, etc.
The 10 gives it a small X margin, and the 40 ensures it shows up below the tabs.
Anyone else trip up on this in the past, or have an idea of what I've done wrong?