]> git.saurik.com Git - wxWidgets.git/commitdiff
don't put the windows created with y or height of -1 off screen
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 9 May 2002 23:01:42 +0000 (23:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 9 May 2002 23:01:42 +0000 (23:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15475 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index a452a8a00ea9aa247dd5fe249b5ee5ecc50199a6..c633426aba86b02b789e1ae7e00df00431c32d75 100644 (file)
@@ -2828,6 +2828,9 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos,
                                            int& x, int& y,
                                            int& w, int& h) const
 {
+    static const int DEFAULT_Y = 200;
+    static const int DEFAULT_H = 250;
+
     bool nonDefault = FALSE;
 
     if ( pos.x == -1 )
@@ -2839,8 +2842,11 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos,
     }
     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;
-        y = pos.y == -1 ? CW_USEDEFAULT : pos.y;
+        y = pos.y == -1 ? DEFAULT_Y : pos.y;
 
         nonDefault = TRUE;
     }
@@ -2863,14 +2869,15 @@ bool wxWindowMSW::MSWGetCreateWindowCoords(const wxPoint& pos,
      */
     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 =
         h = CW_USEDEFAULT;
     }
     else
     {
+        // and, again as above, we can't set the height to CW_USEDEFAULT here
         w = size.x;
-        h = size.y == -1 ? CW_USEDEFAULT : size.y;
+        h = size.y == -1 ? DEFAULT_H  : size.y;
 
         nonDefault = TRUE;
     }