- SetName(rsName);
-#if wxUSE_VALIDATORS
- SetValidator(rValidator);
-#endif
- if (pParent)
- pParent->AddChild(this);
-
- SetBackgroundColour(pParent->GetBackgroundColour());
- SetForegroundColour(pParent->GetForegroundColour());
- m_windowStyle = lStyle;
-
- wxString sLabel = rsLabel;
-
- if (sLabel == wxT(""))
- sLabel = wxT(" "); // Apparently needed or checkbox won't show
-
- if (vId == -1 )
- m_windowId = NewControlId();
- else
- m_windowId = vId;
-
- int nX = rPos.x;
- int nY = rPos.y;
- int nWidth = rSize.x;
- int nHeight = rSize.y;
- long lSstyle = 0L;
-
- lSstyle = BS_AUTOCHECKBOX |
- WS_TABSTOP |
- WS_VISIBLE;
- if (lStyle & wxCLIP_SIBLINGS )
- lSstyle |= WS_CLIPSIBLINGS;
-
- m_hWnd = (WXHWND)::WinCreateWindow ( GetHwndOf(pParent)
- ,WC_BUTTON
- ,rsLabel.c_str()
- ,lSstyle
- ,0, 0, 0, 0
- ,GetWinHwnd(pParent)
- ,HWND_TOP
- ,(HMENU)m_windowId
- ,NULL
- ,NULL
- );
-
- //
- // Subclass again for purposes of dialog editing mode
- //
- SubclassWin(m_hWnd);
-
- LONG lColor = (LONG)m_backgroundColour.GetPixel();
-
+ if (!CreateControl( pParent
+ ,vId
+ ,rPos
+ ,rSize
+ ,lStyle
+ ,rValidator
+ ,rsName
+ ))
+ return false;
+
+
+ long osStyle = BS_AUTOCHECKBOX | WS_TABSTOP | WS_VISIBLE;
+
+ bool bOk = OS2CreateControl( wxT("BUTTON")
+ ,osStyle
+ ,rPos
+ ,rSize
+ ,rsLabel
+ ,0
+ );
+ m_backgroundColour = pParent->GetBackgroundColour();
+
+ LONG lColor = (LONG)m_backgroundColour.GetPixel();