Page 1 of 1

wxCrafter Stand-alone 2.5, wxWidgets 3.1.0 ^ MSVC 2015

Posted: Fri Jun 17, 2016 1:53 am
by coder99
In trying to convert one of my projects to compile under MSVC 2015 Express and wWidgets 3.1.0 (only wxWidgets 3.1.0 seems to be set up for MSVC 2015 ), I have run into some issues with a wxCrafter 2.5 coded base code using a slider.
The lines which starts this issue:

Code: Select all

m_sliderOptLogVerbosity = new wxSlider(m_panelLog, wxID_ANY, 0, 0, 5, wxDefaultPosition, wxSize(-1,-1), wxSL_BOTTOM|wxSL_LABELS|wxSL_HORIZONTAL);
At this early stage I am mostly curious to find out if wxCrafter can handle the changes in wxWidgets 3.1.0 or if there are some work-arounds if not.
The code compiles without complaints, but fails when I run code to execute the above statement.

TIA
Arnold

Re: wxCrafter Stand-alone 2.5, wxWidgets 3.1.0 ^ MSVC 2015

Posted: Sun Jun 19, 2016 9:07 pm
by eranif
Can you be more specific?
According to wxSlider constructor documentation the generated code is OK
So what is the problem with it?

Eran

Re: wxCrafter Stand-alone 2.5, wxWidgets 3.1.0 ^ MSVC 2015

Posted: Sun Jun 19, 2016 10:52 pm
by coder99
In the debug version it bombs with the assertion in the attached screenshot at

Code: Select all

wxSizerItem *wxBoxSizer::DoInsert(size_t index, wxSizerItem *item)
{
    const int flags = item->GetFlag();
    if ( IsVertical() )
    {
        wxASSERT_MSG
        (
            !(flags & wxALIGN_BOTTOM),
            wxS("Vertical alignment flags are ignored in vertical sizers")
        );

        // We need to accept wxALIGN_CENTRE_VERTICAL when it is combined with
        // wxALIGN_CENTRE_HORIZONTAL because this is known as wxALIGN_CENTRE
        // and we accept it historically in wxSizer API.
        if ( !(flags & wxALIGN_CENTRE_HORIZONTAL) )
        {
            wxASSERT_MSG
            (
                !(flags & wxALIGN_CENTRE_VERTICAL),
                wxS("Vertical alignment flags are ignored in vertical sizers")
            );
        }

        if ( flags & wxEXPAND )
        {
            wxASSERT_MSG   <<<<<<<<<<<<<<<<<<<<<<
The code is taken directly from a project which under MSVC 2010 & wxWidgets 3.02 compiles and runs without issue.

Re: wxCrafter Stand-alone 2.5, wxWidgets 3.1.0 ^ MSVC 2015

Posted: Mon Jun 20, 2016 10:18 am
by eranif
Its not really a wxCrafter issue...
Your UI contains an invalid combination of flags (there is a discussion about this in the wx-dev mailing list to remove this assertion since it is quite annoying)
Just remove the one that the assertion complains about - you can't expect wxCrafter to fix the code for you... (which was _not_ broken in the first place, only now wxWidgets decided that it is broken...)



Eran

Re: wxCrafter Stand-alone 2.5, wxWidgets 3.1.0 ^ MSVC 2015

Posted: Mon Jun 20, 2016 9:14 pm
by coder99
First off, thank you for explaining the issue.
After fixing the flag, I can now open the dialog without a crash.
Normally I don't follow the wx-devl list ansd so I am not up-to-date on the reasons,
but I had noticed there are a couple of other functions which disappeared from 3.1.
Unfortunately, it always is a challenged to move along with the newer versions ;-)