Avoid using negative width in generic wxTimePickerCtrl.

If there is not enough space for the text, make it of size 0, not negative.

Closes #16960.
This commit is contained in:
Vadim Zeitlin 2015-04-22 14:14:14 +02:00
parent a49a8a3f2f
commit b5ef2ac489

View File

@ -26,6 +26,7 @@
#ifndef WX_PRECOMP
#include "wx/textctrl.h"
#include "wx/utils.h" // wxMax()
#endif // WX_PRECOMP
#include "wx/timectrl.h"
@ -661,7 +662,7 @@ void wxTimePickerCtrlGeneric::DoMoveWindow(int x, int y, int width, int height)
return;
const int widthBtn = m_impl->m_btn->GetSize().x;
const int widthText = width - widthBtn - HMARGIN_TEXT_SPIN;
const int widthText = wxMax(width - widthBtn - HMARGIN_TEXT_SPIN, 0);
m_impl->m_text->SetSize(0, 0, widthText, height);
m_impl->m_btn->SetSize(widthText + HMARGIN_TEXT_SPIN, 0, widthBtn, height);