News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Solution to small bug in wxSmith

Started by wxLearner, February 23, 2007, 12:05:39 PM

Previous topic - Next topic

wxLearner

Hello,
the wxStdDialogButtonSizer doesn't work. I've looked into the code and the reason seems to be, that it cannot be converted to a parent:
Quote from: wxsitemfactory.cppcase wxsTContainer:
case wxsTSizer:
    if ( !Item->ConvertToParent() )
    {
        // Fake item
        delete Item;
        return NULL;
    }
    break;
Since wxsStdDialogButtonSizer doesn't inherit wxsSizer (like the other sizers do), but wxsItem, the conversion to parent fails and it isn't returned.
The (maybe not nicest, but quick) solution to this issue could be the following change of the if-statement:if ( !Item->ConvertToParent() && Item->GetClassName() != wxT("wxStdDialogButtonSizer") )

byo

Quote from: wxLearner on February 23, 2007, 12:05:39 PM
Hello,
the wxStdDialogButtonSizer doesn't work. I've looked into the code and the reason seems to be, that it cannot be converted to a parent:
Quote from: wxsitemfactory.cppcase wxsTContainer:
case wxsTSizer:
    if ( !Item->ConvertToParent() )
    {
        // Fake item
        delete Item;
        return NULL;
    }
    break;
Since wxsStdDialogButtonSizer doesn't inherit wxsSizer (like the other sizers do), but wxsItem, the conversion to parent fails and it isn't returned.
The (maybe not nicest, but quick) solution to this issue could be the following change of the if-statement:if ( !Item->ConvertToParent() && Item->GetClassName() != wxT("wxStdDialogButtonSizer") )

Whoops  :oops:. I've added these is-parent extra checking recently and forgot that wxStdDialogButtonSizer in fact isn't a parent. Hmm, and in fact, there's no requirement that wxSizer-like classes must allow adding children. One may create custom class working simillar to wxStdDiaogButtonSizer, so probably removing case wxsTSizer: is best solition.

Thanks for finding this bug :)

Regards
   BYO