Skip to content

Commit

Permalink
Avoid assert failure in shaped sample
Browse files Browse the repository at this point in the history
wxBG_STYLE_TRANSPARENT cannot be changed after creation
  • Loading branch information
paulcor committed Apr 7, 2021
1 parent 26bc2c0 commit 4faf7d4
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions samples/shaped/shaped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ class SeeThroughFrame : public wxFrame

private:
// event handlers (these functions should _not_ be virtual)
void OnDoubleClick(wxMouseEvent& evt);
void OnPaint(wxPaintEvent& evt);

// any class wishing to process wxWidgets events must use this macro
Expand Down Expand Up @@ -472,14 +471,13 @@ void ShapedFrame::OnPaint(wxPaintEvent& WXUNUSED(evt))
// ----------------------------------------------------------------------------

wxBEGIN_EVENT_TABLE(SeeThroughFrame, wxFrame)
EVT_LEFT_DCLICK(SeeThroughFrame::OnDoubleClick)
EVT_PAINT(SeeThroughFrame::OnPaint)
wxEND_EVENT_TABLE()

void SeeThroughFrame::Create()
{
SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
wxFrame::Create(NULL, wxID_ANY, "Transparency test: double click here",
wxFrame::Create(NULL, wxID_ANY, "Transparency test",
wxPoint(100, 30), wxSize(300, 300),
wxDEFAULT_FRAME_STYLE |
wxFULL_REPAINT_ON_RESIZE |
Expand Down Expand Up @@ -517,13 +515,3 @@ void SeeThroughFrame::OnPaint(wxPaintEvent& WXUNUSED(evt))
}
}
}

void SeeThroughFrame::OnDoubleClick(wxMouseEvent& WXUNUSED(evt))
{
SetBackgroundStyle(wxBG_STYLE_PAINT);
SetTransparent(255);
SetTitle("Opaque");

Refresh();
}

0 comments on commit 4faf7d4

Please sign in to comment.