]> git.saurik.com Git - wxWidgets.git/commitdiff
added a check for allowed id value (bug 690910)
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 24 Mar 2003 19:21:08 +0000 (19:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 24 Mar 2003 19:21:08 +0000 (19:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19761 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/wincmn.cpp

index c58341994f662aba9bfae950c497a1bf69d3ebb2..14c2493d7d66e5e64d0747be5b7615f97bcf65d7 100644 (file)
@@ -224,8 +224,14 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent,
                   _T("wxStaticBox can't be used as a window parent!") );
 #endif // wxUSE_STATBOX
 
+    // ids are limited to 16 bits under MSW so if you care about portability,
+    // it's not a good idea to use ids out of this range (and negative ids are
+    // reserved for wxWindows own usage)
+    wxASSERT_MSG( id == wxID_ANY || (id >= 0 && id < 32767),
+                  _T("invalid id value") );
+
     // generate a new id if the user doesn't care about it
-    m_windowId = id == -1 ? NewControlId() : id;
+    m_windowId = id == wxID_ANY ? NewControlId() : id;
 
     SetName(name);
     SetWindowStyleFlag(style);