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:
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
|
#include "wx/utils.h" // wxMax()
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/timectrl.h"
|
#include "wx/timectrl.h"
|
||||||
@@ -657,7 +658,7 @@ void wxTimePickerCtrlGeneric::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const int widthBtn = m_impl->m_btn->GetSize().x;
|
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_text->SetSize(0, 0, widthText, height);
|
||||||
m_impl->m_btn->SetSize(widthText + HMARGIN_TEXT_SPIN, 0, widthBtn, height);
|
m_impl->m_btn->SetSize(widthText + HMARGIN_TEXT_SPIN, 0, widthBtn, height);
|
||||||
|
Reference in New Issue
Block a user