I have two windows whose coordinates are specified by SetPoint() without using a sizer.
When they overlap, I want to bring the one clicked on to the front. However, the window generated later is always in the foreground.
How can I do this?
I am using wxWidgets3.1.4 on a Raspberry Pi 3 (GTK3).
Thank you in advance for your help.
Code: Select all
class myPanel : public wxPanel
{
public:
myPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize )
:wxPanel( parent, id, pos, size )
{
SetMinSize( wxSize(400, 600) );
m_pnl1 = new wxPanel( this, 0, wxPoint( 0, 40 ), wxSize( 120, 50 ) );
m_pnl2 = new wxPanel( this, 1, wxPoint( 90, 50 ), wxSize( 120, 50 ) );
m_pnl1->SetBackgroundColour( *wxRED );
m_pnl2->SetBackgroundColour( *wxBLUE );
m_pnl1->Bind( wxEVT_LEFT_DOWN, [&]( wxMouseEvent& event )
{
//I want to put m_pnl1 in front.
} );
m_pnl2->Bind( wxEVT_LEFT_DOWN, [&]( wxMouseEvent& event )
{
//I want to put m_pnl2 in front.
} );
}
private:
wxPanel* m_pnl1;
wxPanel* m_pnl2;
};