#112 Using wxListbook under MSW causes assertion on startup

v1.0_(example)
closed-fixed
nobody
None
5
2014-06-04
2012-06-07
dmcminn-iwc
No

If you use a wxListbook the code generated looks like this:

wxListView* m_listbook1ListView = m_listbook1->GetListView();
long m_listbook1Flags = m_listbook1ListView->GetWindowStyleFlag();
m_listbook1Flags = ( m_listbook1Flags & ~wxLC_ICON ) | wxLC_SMALL_ICON;
m_listbook1ListView->SetWindowStyleFlag( m_listbook1Flags );

When executed under MSW (wxWidgets 2.9.2) the generated application execution stops with an assertion from wxListCtrl saying that nModes must be 1. It looks as if the default mode is no wxLC_ICON so that turning it off here and then setting it to wxLC_SMALL_ICON causes 2 mode bits to be set which is an error.

Discussion

  • dmcminn-iwc
    dmcminn-iwc
    2012-06-07

    I forgot to mention: Using wxFB 3.2.3 beta 1.

     
  • dmcminn-iwc
    dmcminn-iwc
    2012-06-07

    It also happens with the latest beta 3.3.3.
    It only happens when the debug builds of the wxWidgets libraries are used.

     
  • Just wanna tell that this is extremely helpful, Thanks for taking your time to write this.
    <a href="http://www.mytripbook.com/index.php/trip/edit/76963/For-the-best-Wedding-Photography-Employ-a-Calgary-Wedding-Photographers" title="Wedding ceremony">Wedding ceremony</a>

     
  • dmcminn-iwc
    dmcminn-iwc
    2014-06-04

    I just came across this bug again in the nightly build of 3.4.2 from 2014-05-26 so I guess it has not been fixed. However, I discovered the source of the problem is that under wxWidgets 2.9+ the default mode for the wxListBook uses wxLC_REPORT so that when wxFormBuilder generates code to turn off the default mode it turns off the wrong bit, resulting in two modes being set and the debug assertion being raised.

    The fix is to clear all mode bits and this is set in the template for plugins/containers/xml/containers.cppcode as shown in the attached patch. Apologies for not doing this against the repository, I cannot access it using subversion from this location.

     
  • should be fixed in wxFB 3.5.0. Btw, IMHO the attached patch is incorrect because there is one missing closing bracket....

     
    • status: open --> closed-fixed
    • Group: --> v1.0_(example)
     
  • dmcminn-iwc
    dmcminn-iwc
    2014-06-04

    Yes, the patch is incorrect. I have removed it to avoid confusion, especially if the code is fixed in 3.5.