- if (!parent)
- return FALSE;
- parent->AddChild(this);
- SetName(name);
-#if wxUSE_VALIDATORS
- SetValidator(validator);
-#endif // wxUSE_VALIDATORS
-
- SetBackgroundColour(parent->GetBackgroundColour()) ;
- SetForegroundColour(parent->GetForegroundColour()) ;
- m_windowStyle = style;
-
- if ( id == -1 )
- m_windowId = (int)NewControlId();
- else
- m_windowId = id;
-
- int x = pos.x;
- int y = pos.y;
- int width = size.x;
- int height = size.y;
-
- if (width == -1)
- {
- if (style & wxHORIZONTAL)
- width = 140;
- else
- width = 14;
- }
- if (height == -1)
- {
- if (style & wxVERTICAL)
- height = 140;
- else
- height = 14;
- }
-
- DWORD wstyle = WS_VISIBLE | WS_CHILD;
-
- if ( m_windowStyle & wxCLIP_SIBLINGS )
- wstyle |= WS_CLIPSIBLINGS;
-
- // Now create scrollbar
- DWORD _direction = (style & wxHORIZONTAL) ?
- SBS_HORZ: SBS_VERT;
- HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(style), wxT("SCROLLBAR"), wxT("scrollbar"),
- _direction | wstyle,
- 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
- wxGetInstance(), NULL);
-
- m_pageSize = 1;
- m_viewSize = 1;
- m_objectSize = 1;
+ if ( !CreateControl(parent, id, pos, size, style, validator, name) )
+ return false;