m_windowId = id == -1 ? NewControlId() : id;
SetName(name);
-
- // if the parent window has wxWS_EX_VALIDATE_RECURSIVELY set, we want to
- // have it too - like this it's possible to set it only in the top level
- // dialog/frame and all children will inherit it by defult
- if ( parent && (parent->GetWindowStyle() & wxWS_EX_VALIDATE_RECURSIVELY) )
- {
- style |= wxWS_EX_VALIDATE_RECURSIVELY;
- }
-
SetWindowStyleFlag(style);
SetParent(parent);
SetValidator(validator);
#endif // wxUSE_VALIDATORS
+ // if the parent window has wxWS_EX_VALIDATE_RECURSIVELY set, we want to
+ // have it too - like this it's possible to set it only in the top level
+ // dialog/frame and all children will inherit it by defult
+ if ( parent && (parent->GetExtraStyle() & wxWS_EX_VALIDATE_RECURSIVELY) )
+ {
+ SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY);
+ }
+
return TRUE;
}
// controls are always centered on their parent because it doesn't make
// sense to centre them on the screen
- if ( !(direction & wxCENTRE_ON_SCREEN) || wxDynamicCast(this, wxControl) )
+ if ( !(direction & wxCENTRE_ON_SCREEN) || !IsTopLevel() )
{
- // theo nly chance to get this is to have a wxControl without parent
- wxCHECK_RET( parent, wxT("a control must have a parent") );
+ // the only chance to get this is to have a not top level window
+ // without parent which shouldn't happen
+ wxCHECK_RET( parent, wxT("this window must have a parent") );
// adjust to the parents client area origin
wxPoint posParent = parent->ClientToScreen(wxPoint(0, 0));