- wxCommandEvent event(wxEVT_COMMAND_SLIDER_UPDATED, GetId());
- event.SetEventObject(this);
- event.SetInt(GetValue());
- return ProcessCommand(event);
+ m_oldPos = GetValue();
+
+ // first thumb event
+ wxScrollEvent eventWxTrack(wxEVT_SCROLL_THUMBRELEASE, GetId());
+ eventWxTrack.SetPosition(m_oldPos);
+ eventWxTrack.SetEventObject(this);
+ bool handled = HandleWindowEvent(eventWxTrack);
+
+ // then slider event if position changed
+ if( m_oldValue != m_oldPos )
+ {
+ m_oldValue = m_oldPos;
+ wxCommandEvent event(wxEVT_COMMAND_SLIDER_UPDATED, GetId());
+ event.SetEventObject(this);
+ event.SetInt(m_oldPos);
+ return ProcessCommand(event);
+ }
+
+ return handled;
+}
+
+bool wxSlider::SendScrollEvent(WXEVENTPTR event)
+{
+ const EventType* palmEvent = (EventType*)event;
+ int newPos = ValueInvertOrNot(palmEvent->data.ctlRepeat.value);
+ if ( newPos == m_oldPos )
+ {
+ // nothing changed since last event
+ return false;
+ }
+
+ m_oldPos = newPos;
+
+ // first track event
+ wxScrollEvent eventWx(wxEVT_SCROLL_THUMBTRACK, GetId());
+ eventWx.SetPosition(newPos);
+ eventWx.SetEventObject(this);
+ return HandleWindowEvent(eventWx);