// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "spinctrl.h"
-#endif
-
-#include "wx/defs.h"
+#include "wx/wxprec.h"
#if wxUSE_SPINCTRL
// the focus rect around a text may have 4 pixels in each direction
// we handle these problems right now in an extended vis region of a window
-static const wxCoord TEXTBORDER = 0 ;
+static const wxCoord TEXTBORDER = 4 ;
// the margin between the text control and the spin
static const wxCoord MARGIN = 8 - TEXTBORDER;
if ( m_spin->GetTextValue(&val) )
{
m_spin->GetSpinButton()->SetValue(val);
+
+ // If we're already processing a text update from m_spin,
+ // don't send it again, since we could end up recursing
+ // infinitely.
+ if (event.GetId() == m_spin->GetId())
+ {
+ event.Skip();
+ return;
+ }
+
+ // Send event that the text was manually changed
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_spin->GetId());
+ event.SetEventObject(m_spin);
+ event.SetInt(val);
+
+ m_spin->GetEventHandler()->ProcessEvent(event);
}
event.Skip();
//SetSize(csize);
- MacPostControlCreate(pos, csize);
+ //MacPostControlCreate(pos, csize);
SetInitialBestSize(csize);
return TRUE;
return TRUE;
}
+void wxSpinCtrl::SetFocus()
+{
+ if ( m_text != NULL) {
+ m_text->SetFocus();
+ }
+}
+
// ----------------------------------------------------------------------------
// value and range access
// ----------------------------------------------------------------------------