don't put the windows created with y or height of -1 off screen

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15475 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-05-09 23:01:42 +00:00
parent 64bea2bf57
commit 2a77c8c455

View File

@@ -2828,6 +2828,9 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos,
int& x, int& y, int& x, int& y,
int& w, int& h) const int& w, int& h) const
{ {
static const int DEFAULT_Y = 200;
static const int DEFAULT_H = 250;
bool nonDefault = FALSE; bool nonDefault = FALSE;
if ( pos.x == -1 ) if ( pos.x == -1 )
@@ -2839,8 +2842,11 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos,
} }
else else
{ {
// OTOH, if x is not set to CW_USEDEFAULT, y shouldn't be set to it
// neither because it is not handled as a special value by Windows then
// and so we have to choose some default value for it
x = pos.x; x = pos.x;
y = pos.y == -1 ? CW_USEDEFAULT : pos.y; y = pos.y == -1 ? DEFAULT_Y : pos.y;
nonDefault = TRUE; nonDefault = TRUE;
} }
@@ -2863,14 +2869,15 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos,
*/ */
if ( size.x == -1 ) if ( size.x == -1 )
{ {
// as abobe, h is not used at all in this case anyhow // as above, h is not used at all in this case anyhow
w = w =
h = CW_USEDEFAULT; h = CW_USEDEFAULT;
} }
else else
{ {
// and, again as above, we can't set the height to CW_USEDEFAULT here
w = size.x; w = size.x;
h = size.y == -1 ? CW_USEDEFAULT : size.y; h = size.y == -1 ? DEFAULT_H : size.y;
nonDefault = TRUE; nonDefault = TRUE;
} }