window.paint timing

in the WINDOW.PAINT event I draw a simple grid

		g.ForeColor=color.red
		dim x as integer
		dim y as integer
		for x=20 to g.width-20 step 20
				g.drawline x,0,x,g.Height
		next x
		
		for y=20 to g.height-20 step 20
				g.drawline 0,y,g.width,y
		next y

The question is… when does this get called in relation to all the controls that are on the window. My window has basically one or more of each control in the Xojo arsenal… yet the above code draws OVER some controls, and UNDER others… I would have expected it to be UNDER everything

I’ve not tested this theory, but one SWAG would be that you have some controls repainting due to changes made in the window.open event – such as restoring previous content or other dynamic decisions.

Can you tell which controls are ‘diving’ under the grid because i don’t see this on windows with the controls:
bevelbutton, checkbox, combobox, disclosuretriangle, groupbox, label, oval, pushbutton, rectangle, textarea and textfield.

Also, I would suggest sprinkling System.DebugLog() statements in the code and in the window.paint() plus some control level events so you can see the log of what sequence they get listed. I’d do that for sample controls that appear under and others that appear over the grid. Especially those over the grid since you were not expecting them.

You can’t use MsgBox for this since it alters the flow of events.

Turns out its a macOS thing. I created a similar window in Swift just to see what it did, and the results were the same.
it does draw UNDER most controls

EXCEPT FOR

  • Progressbar
  • ProgressWheel
  • GroupBox
  • the panel area of Tabpanel (but not the tab buttons)
  • the panel area of a Pagepanel
  • slider controls
  • “rounded” pushbuttons (all other buttons is under)

Not only a Mac-only thing, i just saw some controls in Ubuntu Mate on my Pine64 (rpi-clone) doing the same.