Ensure wxChoice reported width never becomes negative in wxMSW.
Don't set the pending size to (-1, valid-height) as it is always supposed to be either fully valid or fully invalid (meaning there is no pending size change). Closes #15723. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75654 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -533,15 +533,16 @@ void wxChoice::DoSetSize(int x, int y,
|
|||||||
int width, int height,
|
int width, int height,
|
||||||
int sizeFlags)
|
int sizeFlags)
|
||||||
{
|
{
|
||||||
const int heightBest = GetBestSize().y;
|
// The height of the control itself, i.e. of its visible part.
|
||||||
|
int heightVisible = height;
|
||||||
|
|
||||||
// we need the real height below so get the current one if it's not given
|
// we need the real height below so get the current one if it's not given
|
||||||
if ( height == wxDefaultCoord )
|
if ( height == wxDefaultCoord )
|
||||||
{
|
{
|
||||||
// height not specified, use the same as before
|
// height not specified, use the same as before
|
||||||
DoGetSize(NULL, &height);
|
DoGetSize(NULL, &heightVisible);
|
||||||
}
|
}
|
||||||
else if ( height == heightBest )
|
else if ( height == GetBestSize().y )
|
||||||
{
|
{
|
||||||
// we don't need to manually manage our height, let the system use the
|
// we don't need to manually manage our height, let the system use the
|
||||||
// default one
|
// default one
|
||||||
@@ -585,7 +586,7 @@ void wxChoice::DoSetSize(int x, int y,
|
|||||||
// The extra item (" + 1") is required to prevent a vertical
|
// The extra item (" + 1") is required to prevent a vertical
|
||||||
// scrollbar from appearing with comctl32.dll versions earlier
|
// scrollbar from appearing with comctl32.dll versions earlier
|
||||||
// than 6.0 (such as found in Win2k).
|
// than 6.0 (such as found in Win2k).
|
||||||
heightWithItems = height + hItem*(nItems + 1);
|
heightWithItems = heightVisible + hItem*(nItems + 1);
|
||||||
else
|
else
|
||||||
heightWithItems = SetHeightSimpleComboBox(nItems);
|
heightWithItems = SetHeightSimpleComboBox(nItems);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user