Check for range on wxSpinCtrl and wxSpinButton's GetValue()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31165 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2004-12-28 15:57:43 +00:00
parent c436b31065
commit ad8ddd1391
2 changed files with 11 additions and 2 deletions

View File

@@ -220,16 +220,22 @@ wxSize wxSpinButton::DoGetBestSize() const
int wxSpinButton::GetValue() const
{
int n;
#ifdef UDM_GETPOS32
if ( wxTheApp->GetComCtl32Version() >= 580 )
{
// use the full 32 bit range if available
return ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0);
n = ::SendMessage(GetHwnd(), UDM_GETPOS32, 0, 0);
}
#endif // UDM_GETPOS32
// we're limited to 16 bit
return (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0));
n = (short)LOWORD(::SendMessage(GetHwnd(), UDM_GETPOS, 0, 0));
if (n < m_min) n = m_min;
if (n > m_max) n = m_max;
return n;
}
void wxSpinButton::SetValue(int val)

View File

@@ -437,6 +437,9 @@ int wxSpinCtrl::GetValue() const
if ( (wxSscanf(val, wxT("%lu"), &n) != 1) )
n = INT_MIN;
if (n < m_min) n = m_min;
if (n > m_max) n = m_max;
return n;
}