assertion on notebook resizing in splitter

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

assertion on notebook resizing in splitter

Post by pvn »

for version 3.1.3, Windows 64 build

I have a notebook inside a splitter made with

Code: Select all

m_splitter = new wxSplitterWindow(this);
 m_splitter->SetSashInvisible(false);
 wxNotebook* notebook = new wxNotebook(m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize,
    wxNB_MULTILINE);
 PanelCurrent* panel_current = new PanelCurrent(m_splitter);
 panel_current->SetMinSize(wxSize(1250, -1));
 m_splitter->SplitVertically(panel_current, notebook);

when I resize it I have an assertion here ( h == 0)

Code: Select all

bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc)
{
    UnRef();
    wxCHECK_MSG( w > 0 && h > 0, false, wxT("invalid bitmap size") );

called by

Code: Select all

void wxNotebook::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    wxPaintDC dc(this);
    wxMemoryDC memdc;
    RECT rc;
    ::GetClientRect(GetHwnd(), &rc);
    wxBitmap bmp(rc.right, rc.bottom);

I can provide more debugging results if needed

basically, this call

Code: Select all

::GetClientRect(GetHwnd(), &rc);
    wxBitmap bmp(rc.right, rc.bottom);
returns rc.bottom == 0
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: assertion on notebook resizing in splitter

Post by pvn »

update

the assertion seems to happen only when a second pane is added to main notebook pane (has a grid and a pane at bottom in image)

Code: Select all

void PanelReport::new_message_panel(wxNotebook* notebook, const wxString& title, const wxString& msg, status_color_t clr)
{
  wxPanel* panel_message = new wxPanel(notebook);
  wxTextCtrl* text = new wxTextCtrl(panel_message, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE | wxTE_RICH);
  text->SetLabelText(msg);
  text->SetMinSize(wxSize(700, 300));
  text->SetBackgroundColour(results_t::get_colour(clr));
  wxSizer* sizer = new wxBoxSizer(wxVERTICAL);
  sizer->Add(text, 1, wxGROW | wxALL, 1);
  panel_message->SetSizerAndFit(sizer);
  notebook->AddPage(panel_message, title);
}
Attachments
Untitled.png
Untitled.png (56.27 KiB) Viewed 835 times
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: assertion on notebook resizing in splitter

Post by pvn »

solved

this is solved by setting

Code: Select all

 PanelAnalysisMatrix* panel_grid = new PanelAnalysisMatrix(m_splitter, table);
  panel_grid->SetMinSize(wxSize(-1, height_grid));  //needed for notebook assertion (invalid bitmap size)
still , it seems like a bug
Attachments
Untitled.png
Untitled.png (45.83 KiB) Viewed 834 times
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: assertion on notebook resizing in splitter

Post by doublemax »

Yes, definitely a bug. The assert checking for 0-size bitmaps is new in wx 3.1.4, that's why it didn't happen before.

Please open a ticket at http://trac.wxwidgets.org ,so it can be fixed.
Use the source, Luke!
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: assertion on notebook resizing in splitter

Post by pvn »

The assert checking for 0-size bitmaps is new in wx 3.1.4, that's why it didn't happen before.
ok, but I'm using version 3.1.3
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: assertion on notebook resizing in splitter

Post by doublemax »

pvn wrote: Thu Aug 06, 2020 5:52 pm
The assert checking for 0-size bitmaps is new in wx 3.1.4, that's why it didn't happen before.
ok, but I'm using version 3.1.3
Yeah, i was wrong, it was introduced a little earlier. But i couldn't find exactly when.
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: assertion on notebook resizing in splitter

Post by PB »

The bitmap assert on MSW was introduced in 2015, so it has been there since 3.1.0:
https://github.com/wxWidgets/wxWidgets/ ... fdafe30a09

Is there a minimal correct compilable code that can reproduce the issue with the splitter? I do not really understand what is in the first screenshot on the bottom. It looks as notebook tabs but without the pages and also the empty place right to the tabs should have a different color...
pvn
Earned some good credits
Earned some good credits
Posts: 105
Joined: Mon Dec 26, 2016 5:21 am
Contact:

Re: assertion on notebook resizing in splitter

Post by pvn »

Is there a minimal correct compilable code that can reproduce the issue with the splitter? I do not really understand what is in the first screenshot on the bottom. It looks as notebook tabs but without the pages and also the empty place right to the tabs should have a different color...
that application is too complex to share, but I'll try to reproduce with a simple example.
On the bottom , yes, it is another notebook that is created later ; it has several panes; it is at the bottom because the size was not set as in the bug workaround; the second image shows with the size set, but the second notebook at bottom was not created at that time
Post Reply