X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/509cf714f80f0da04f9610a05e4bf27481a334d4..7b8373b34f5e25dd93ab297e3f7b9dea11307bc5:/src/msw/spinctrl.cpp?ds=sidebyside diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index a0be1e83d4..a2a61fc04a 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -370,21 +370,22 @@ bool wxSpinCtrl::Create(wxWindow *parent, m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), wxBuddyTextWndProc); - // should have the same font as the other controls - SetFont(GetParent()->GetFont()); - + // set up fonts and colours (This is nomally done in MSWCreateControl) + InheritAttributes(); + if (!m_hasFont) + SetFont(GetDefaultAttributes().font); + // set the size of the text window - can do it only now, because we // couldn't call DoGetBestSize() before as font wasn't set if ( sizeText.y <= 0 ) { int cx, cy; - wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); sizeText.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); } - DoMoveWindow(pos.x, pos.y, - sizeText.x + sizeBtn.x + MARGIN_BETWEEN, sizeText.y); + SetBestSize(size); (void)::ShowWindow(GetBuddyHwnd(), SW_SHOW); @@ -526,7 +527,7 @@ wxSize wxSpinCtrl::DoGetBestSize() const sizeBtn.x += DEFAULT_ITEM_WIDTH + MARGIN_BETWEEN; int y; - wxGetCharSize(GetHWND(), NULL, &y, &GetFont()); + wxGetCharSize(GetHWND(), NULL, &y, GetFont()); y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(y); // JACS: we should always use the height calculated