send wxEVT_SCROLL_CHANGED when using mouse wheel as well
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34458 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fa1af598d6
commit
3c96417a09
@ -39,6 +39,7 @@ wxMSW:
|
||||
- Winelib compilation now works.
|
||||
- When converting a wxIcon to a bitmap check if the icon has an alpha
|
||||
channel and set the bitmap to use it.
|
||||
- wxSlider now also sends wxEVT_SCROLL_CHANGED when using mouse wheel
|
||||
|
||||
wxGTK:
|
||||
|
||||
|
@ -46,10 +46,7 @@ change the thumb position, and when clicking next to the thumb (In all these
|
||||
cases the {\tt EVT\_SCROLL\_THUMBRELEASE} event does not happen).
|
||||
|
||||
In short, the {\tt EVT\_SCROLL\_CHANGED} event is triggered when scrolling/
|
||||
moving has finished. The only exception (unfortunately) is that changing the
|
||||
thumb position using the mousewheel does give a {\tt EVT\_SCROLL\_THUMBRELEASE}
|
||||
event but NOT an {\tt EVT\_SCROLL\_CHANGED} event.
|
||||
|
||||
Please see the widgets sample ("Slider" page) to see the difference
|
||||
between {\tt EVT\_SCROLL\_THUMBRELEASE} and {\tt EVT\_SCROLL\_CHANGED} in action.
|
||||
moving has finished independently of the way it had started. Please see the
|
||||
widgets sample ("Slider" page) to see the difference between {\tt
|
||||
EVT\_SCROLL\_THUMBRELEASE} and {\tt EVT\_SCROLL\_CHANGED} in action.
|
||||
|
||||
|
@ -130,6 +130,9 @@ protected:
|
||||
int m_lineSize;
|
||||
int m_tickFreq;
|
||||
|
||||
// flag needed to detect whether we're getting THUMBRELEASE event because
|
||||
// of dragging the thumb or scrolling the mouse wheel
|
||||
bool m_isDragging;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxSlider)
|
||||
};
|
||||
|
@ -149,6 +149,8 @@ void wxSlider::Init()
|
||||
m_rangeMax = 0;
|
||||
m_rangeMin = 0;
|
||||
m_tickFreq = 0;
|
||||
|
||||
m_isDragging = false;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -328,10 +330,25 @@ bool wxSlider::MSWOnScroll(int WXUNUSED(orientation),
|
||||
|
||||
case SB_THUMBTRACK:
|
||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||
m_isDragging = true;
|
||||
break;
|
||||
|
||||
case SB_THUMBPOSITION:
|
||||
scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
|
||||
if ( m_isDragging )
|
||||
{
|
||||
scrollEvent = wxEVT_SCROLL_THUMBRELEASE;
|
||||
m_isDragging = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// this seems to only happen when the mouse wheel is used: in
|
||||
// this case, as it might be unexpected to get THUMBRELEASE
|
||||
// without preceding THUMBTRACKs, we don't generate it at all
|
||||
// but generate CHANGED event because the control itself does
|
||||
// not send us SB_ENDSCROLL for whatever reason when mouse
|
||||
// wheel is used
|
||||
scrollEvent = wxEVT_SCROLL_CHANGED;
|
||||
}
|
||||
break;
|
||||
|
||||
case SB_ENDSCROLL:
|
||||
|
Loading…
Reference in New Issue
Block a user