Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Solution to small bug in wxSmith
(1/1)
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.cpp ---
--- Code: ---case wxsTContainer:
case wxsTSizer:
if ( !Item->ConvertToParent() )
{
// Fake item
delete Item;
return NULL;
}
break;
--- End code ---
--- End quote ---
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:
--- Code: ---if ( !Item->ConvertToParent() && Item->GetClassName() != wxT("wxStdDialogButtonSizer") )
--- End code ---
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.cpp ---
--- Code: ---case wxsTContainer:
case wxsTSizer:
if ( !Item->ConvertToParent() )
{
// Fake item
delete Item;
return NULL;
}
break;
--- End code ---
--- End quote ---
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:
--- Code: ---if ( !Item->ConvertToParent() && Item->GetClassName() != wxT("wxStdDialogButtonSizer") )
--- End code ---
--- End quote ---
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
Navigation
[0] Message Index
Go to full version