estimate size of multiline text controls more accurately (bug 873277)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25647 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1963,13 +1963,17 @@ wxSize wxTextCtrl::DoGetBestSize() const
|
|||||||
|
|
||||||
int wText = DEFAULT_ITEM_WIDTH;
|
int wText = DEFAULT_ITEM_WIDTH;
|
||||||
|
|
||||||
int hText = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
|
int hText = cy;
|
||||||
if ( m_windowStyle & wxTE_MULTILINE )
|
if ( m_windowStyle & wxTE_MULTILINE )
|
||||||
{
|
{
|
||||||
hText *= wxMax(GetNumberOfLines(), 5);
|
hText *= wxMax(GetNumberOfLines(), 5);
|
||||||
}
|
}
|
||||||
//else: for single line control everything is ok
|
//else: for single line control everything is ok
|
||||||
|
|
||||||
|
// we have to add the adjustments for the control height only once, not
|
||||||
|
// once per line, so do it after multiplication above
|
||||||
|
hText += EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy) - cy;
|
||||||
|
|
||||||
return wxSize(wText, hText);
|
return wxSize(wText, hText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user