Z-order components and Graphics


#1

Hi,

how can i draw a rectangle and this rectangle will be on top of all my components ?

Paulo


#2

Is Component::paintOverChildren what you are looking for?


#3

Hi cpr, thank you for your answer, perhaps it is, but question is how to use it.

I want to draw some line about some components and i have in MyComponent::paint(....

g.setColour(Colour(0xff7fa52a));
g.fillRect(0, 56 + 56, proportionOfWidth(1.0f), 2);
g.fillRect(0, 56 + proportionOfHeight(1.0f) -56-32-15, proportionOfWidth(1.0f), 2);

I have put Component::paintOverChildren(g); before this and nothing happen. How to use it ?

Thanks,

Paulo


#4

paintOverChildren allows a parent to paint over the top of all it's children. You override paintOverChidlren, and put in the code for the things you want painted over everything else. For example, I have some UI that allows the user to draw lines between components,. first, all of the components get painted, then I draw all of the connecting lines in paintOverChildren.


#5

Thank you cpr