Skip to content

Commit 588c811

Browse files
committed
Trackbar scroll events check.
1 parent 5eeaabc commit 588c811

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

ui/ctl_Trackbar.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func (me *Trackbar) Range() (int, int) {
116116
//
117117
// [TBM_SETPAGESIZE]: https://learn.microsoft.com/en-us/windows/win32/controls/tbm-setpagesize
118118
func (me *Trackbar) SetPageSize(pageSize int) *Trackbar {
119-
me.Hwnd().SendMessage(co.TBM_SETPAGESIZE, 1, win.LPARAM(int32(pageSize)))
119+
me.Hwnd().SendMessage(co.TBM_SETPAGESIZE, 0, win.LPARAM(int32(pageSize)))
120120
return me
121121
}
122122

@@ -252,20 +252,28 @@ func (me *EventsTrackbar) ThumbPosChanging(fun func(p *win.NMTRBTHUMBPOSCHANGING
252252

253253
// [WM_HSCROLL] message handler.
254254
//
255-
// [WM_HSCROLL]: https://learn.microsoft.com/en-us/windows/win32/controls/wm-hscroll
255+
// [WM_HSCROLL]: https://learn.microsoft.com/en-us/windows/win32/controls/wm-hscroll--trackbar-
256256
func (me *EventsTrackbar) WmHScroll(fun func(p WmScroll)) {
257257
me.parentEvents.Wm(co.WM_HSCROLL, func(p Wm) uintptr {
258-
fun(WmScroll{p})
258+
hs := WmScroll{p}
259+
incomingId, _ := hs.HwndScrollbar().GetDlgCtrlID()
260+
if me.ctrlId == incomingId {
261+
fun(hs)
262+
}
259263
return me.parentEvents.defProcVal
260264
})
261265
}
262266

263267
// [WM_VSCROLL] message handler.
264268
//
265-
// [WM_VSCROLL]: https://learn.microsoft.com/en-us/windows/win32/controls/wm-vscroll
269+
// [WM_VSCROLL]: https://learn.microsoft.com/en-us/windows/win32/controls/wm-hscroll--trackbar-
266270
func (me *EventsTrackbar) WmVScroll(fun func(p WmScroll)) {
267271
me.parentEvents.Wm(co.WM_VSCROLL, func(p Wm) uintptr {
268-
fun(WmScroll{p})
272+
vs := WmScroll{p}
273+
incomingId, _ := vs.HwndScrollbar().GetDlgCtrlID()
274+
if me.ctrlId == incomingId {
275+
fun(vs)
276+
}
269277
return me.parentEvents.defProcVal
270278
})
271279
}

0 commit comments

Comments
 (0)