Repaint can't be called from within paint

I have a tree control and a header control. I want the header to repaint everytime the tree scrolls. I couldn’t figure out a good way to do this, so I just put a call to repaint() inside the call to paint(). This works on the pc, not the mac.

void Tree::paint(Graphics& g)
// drawing code

On the mac, this will cause the header control to be a black rectangle.

It would be nice if listeners could be added to a Viewport, I know you can subclass it, but this isn’t always possible, like in the case where the TreeView creates the viewport.

hmm - putting a repaint() inside paint()… not entirely surprising that it doesn’t work! I ought to put an assertion in there to catch silliness like that!

Best thing is to get pointers to the scrollbars from the viewport class, and add a changelistener to see when they move.