1. corrected (but the fix is ugly) the multiple def button problem

2. corrected a bug which disabled all accels for MSW (sic)
3. added SetValue/GetValue to wxSpinCtrl
4. modified wxGetNumberFromUser to use wxSpinCtrl


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4234 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-10-28 01:17:35 +00:00
parent baccb51431
commit 678cd6de66
8 changed files with 87 additions and 20 deletions

View File

@@ -42,6 +42,8 @@
#include <commctrl.h>
#endif
#include <limits.h> // for INT_MIN
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
@@ -69,6 +71,7 @@ static const int MARGIN_BETWEEN = 1;
bool wxSpinCtrl::Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
long style,
@@ -149,9 +152,37 @@ bool wxSpinCtrl::Create(wxWindow *parent,
// associate the text window with the spin button
(void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0);
if ( !value.IsEmpty() )
{
SetValue(value);
}
return TRUE;
}
// ----------------------------------------------------------------------------
// wxTextCtrl-like methods
// ----------------------------------------------------------------------------
void wxSpinCtrl::SetValue(const wxString& text)
{
if ( ::SetWindowText((HWND)m_hwndBuddy, text.c_str()) )
{
wxLogLastError("SetWindowText(buddy)");
}
}
int wxSpinCtrl::GetValue() const
{
wxString val = wxGetWindowText(m_hwndBuddy);
long n;
if ( (wxSscanf(val, wxT("%lu"), &n) != 1) )
n = INT_MIN;
return n;
}
// ----------------------------------------------------------------------------
// when setting font, we need to do it for both controls
// ----------------------------------------------------------------------------