drawing layers?

Is it possible to draw something but have it so that it is placed in the background and does not cover what is already there?

I have attributes being called from another widget in an initialization function but need to draw something behind them. Everything I’ve tried resulted in the drawing being placed on top of the other attributes.

It is most definitely possible to order where widgets are, controlling which widget is on top of which. This can also be changed dynamically. Another strategy is to move the the x,y coordinates around, or to change the video port that is displayed.

My question was in regards to layering draw commands within a single custom widget, not about multiple widgets.

Ok, well then how does your request make any sense? If I could draw something behind something else so that it does not cover it, then it would be covered and I would not see it, right? So the answer would be, don’t draw it at all maybe?

Drawing is like painting. Once you paint over something it is covered. There’s no un-draw function as far as I know that would reveal what was drawn before. You can draw something as transparent, but that is transparent so that an underlying widget would show through. I think that there is a bit blit function that would allow something to show though, such as seeing something behind a picket fence. Is that your goal?

Suppose I am making a custom widget with two attributes about 10x10 pixels each being called from another widget and drawn in an initialization function.

I want to draw a outline of a border and fill it a certain color at a later function. I want this background to be behind the two attributes.

The current background color is being declared the other widget as well.

As best I can tell, you visually have two 10x10 squares inside a border. I think you are saying that you want to fill in the area inside the border, but not the two squares. As such my previous comments are relevant. If all three components, the squares, the border and the fill are being drawn by the widget, then the widget is responsible. Your choices are 1) Whenever you change the fill color, redraw the squares, 2) only draw in the fill color inside the border where the squares are not.


If this were your screen, the F (Fill) could be painted in as 5 rectangles.

This situation exists because you are creating a custom widget. If on the other hand, you had two “square” widgets on a simple widget which was placed behind the two squares, you could change the simple widget’s background color and the result would be what you want. What might not be obvious is that in this situation the same type of calculation would have to be made. The background widget would emit a draw event which would be clipped by the photon kernel to take account of the foreground square widgets.