简体   繁体   中英

CScrollBar thumb tracking not working

I'm trying to use a CScrollBar to navigate a list of items in a dialog. I'm catching OnVScroll messages in the dialog, and the scroll bar correctly responds to clicking the arrows at the top and bottom of the bar, and to clicking the bar's range to advance by full pages. The problem is that when you try to drag the thumb, it doesn't respond at all until you release the mouse button, at which point the thumb moves to the correct position.

I used spy++ to look for WM_VSCROLL messages and it seems like they're only being sent with the SB_THUMBTRACK mode when you click on the thumb and when you release it, but not while dragging. The msdn page on CScrollBar however says that these messages should be sent continuously while the thumb is being dragged. Since I'm not getting those messages, I don't know where the thumb is and can't set the current position.

I don't think the messages are being intercepted anywhere else, first because spy++ didn't see them even when I set it to log all messages, and second because the bar does get the two thumbtrack messages when clicking and releasing.

I have this problem whether I give the dialog the WS_VSCROLL style or I create a CScrollBar and place it in the dialog.

Is there something I'm missing?

Make sure you're not confusing SB_THUMBTRACK with SB_THUMBPOSITION. The former is what you want for live scrolling, and the latter is sent only when the user releases the slider.

You might also check the performance settings (Control Panel -> View advanced system settings -> Advanced Tab -> Performance -> Settings... -> Visual Effects. It's possible some of the real-time effects are disabled (like Smooth-scroll list boxes, or others depending on the version of Windows you're using).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM