- wxScrollWinEvent event(scrollType, m_thumbPos,
- IsVertical() ? wxVERTICAL : wxHORIZONTAL);
- event.SetEventObject(this);
- GetParent()->GetEventHandler()->ProcessEvent(event);
+ if ( IsStandalone() )
+ {
+ // we should generate EVT_SCROLL events for the standalone
+ // scrollbars and not the EVT_SCROLLWIN ones
+ //
+ // NB: we assume that scrollbar events are sequentially numbered
+ // but this should be ok as other code relies on this as well
+ scrollType += wxEVT_SCROLL_TOP - wxEVT_SCROLLWIN_TOP;
+ wxScrollEvent event(scrollType, this->GetId(), m_thumbPos,
+ IsVertical() ? wxVERTICAL : wxHORIZONTAL);
+ event.SetEventObject(this);
+ GetParent()->GetEventHandler()->ProcessEvent(event);
+ }
+ else // part of the window
+ {
+ wxScrollWinEvent event(scrollType, m_thumbPos,
+ IsVertical() ? wxVERTICAL : wxHORIZONTAL);
+ event.SetEventObject(this);
+ GetParent()->GetEventHandler()->ProcessEvent(event);
+ }