stop event firing for overlapping controls ?

I have two controls partly or maybe full overlapping (see examples). I do not want the listbox to receive mouseDown, mouseMove
ect. events which is triggered from the orange control. Is this possible ? I have clue how can I do this.

Dont overlap controls… you can end up in a ‘Paint event horizon’ where one control causes a paint on another and vice versa.
But to answer your question: return TRUE in the mousedown event of the orange control and it shouldnt bleed through to the listbox.

my fault. I returned FALSE.


Add a MouseDown event handler to your container control and return true from that event.

Just tested that this works in your example.

In my test on Windows, return true in Mousedown event doesn’t work well. If i move the mouse over the orange square to the place where beneath it is the scrollbar from the listbox, the scrollbar pops up covering part of the orange square.

In Windows I would warn against stacking controls anyway because it promotes flicker. Plus indeed some control show through. Most notoriously TextField which pop up through anything covering them as soon as the mouse passes over.

To obtain the same effect as what the OP picture shows, I would instead use a canvas in which the Listbox is Drawinto, then made invisible. Then the orange area would be drawn over. The button would be made child of the Canvas, so it becomes invisible/visible when the canvas does.

Michel, i like the way you always find a solution, but lets be honest, it is something malfunctioning in Xojo and they should fix that.

Not necessarily. I have encountered the same issue on Mac with the traffic lights that pop through anything over.

I made a report for the Windows TextField popping through controls and it appeared that was the normal behavior of the native control.

The ListBox is a custom control, so it is possible Xojo has more possibilities of fix. A bug report seems in order.