Home Dashboard Directory Help

Using the mouse wheel to scroll in a scrollable CMFCPopupMenu does not work correctly by TOnofre


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 638564
Opened: 1/26/2011 11:50:09 AM
Access Restriction: Public
User(s) can reproduce this bug


It looks like the mouse wheel does not work correctly with a CMFCPopupMenu. You need to have a menu that is long enough to activate the scroll controls (I have reproduced using the VisualStudioDemo sample so my description will be in regards to this sample).

When you use the scroll control to scroll down in the menu - a mouse wheel movement in either direction will automatically jump the menu back to the top.

A larger related issue is when you scroll all the way to the bottom of the menu and move the mouse slightly up from the bottom (out of the coordinates of where the bottom scroll control will appear) and trigger the mouse wheel the menu appears to have jumped to the top but it is not repainted so as you move your mouse up the menu item by item it will repaint...
Sign in to post a comment.
Posted by Microsoft on 2/22/2011 at 3:20 PM

Thanks for the detailed report. This issue has been fixed in MFC for the next major release of Visual Studio.

Pat Brenner
Visual C++ Libraries Development
Posted by TOnofre on 1/27/2011 at 5:03 AM
I went ahead and attached some screen shots just in case... The ApplicationLookDialogSettings shot displays the initial settings on the dialog that pops up when you run the Visual Studio Demo.

The ctrl_N_ForLotsOfWindows just shows what I mean in step 2 of my steps to reproduce - this time I went with 80 "open files". This also shows a red square around the Acive Files icon that I reference in step 3.

The MenuGeneratedWhenArrowClicked shot shows the menu displayed when the Active Files arrow is clicked.

The MenuAfterScrollingToBottom shot shows what type of order the files are in at the bottom of the menu. In this example (with the screen shots) if you now move the mouse to highlight C++ example 9 and then use the mouse wheel in either direction this menu item will become C++ example 47 or 48. Move your mouse up the menu to highlight other items and they will repaint into the 40s as well (This is where the AfterUsingMouseWheel shot comes in). The red outlined areas show where there is a painting problem.

I think the big problem is I would expect the mouse wheel to move the menu scroll position by 1, not jump to the beginning of the menu.... Having this function properly will probably solve the painting issue....

And just taking a stab at this one - in afxpopupmenu.cpp in CMFCPopupMenu::OnVScroll there is a call to get the scroll info (m_wndScrollBarVert.GetScrollInfo(&scrollInfo);) but the m_wndScrollBarVert is never initialized so when the offset is calculated below the nMaxOffset is 0. I think it should probably be == the number of items in the menu... just a guess though.

I hope this all helps!
Posted by TOnofre on 1/27/2011 at 4:41 AM
I just went and re-downloaded the VisualStudioDemo sample project again from here:
http://code.msdn.microsoft.com/vcsamplesmfc - it is located towards the bottom of the list with the heading MFC Samples - Visual C++ 2008 Feature Pack.
Here is a link to the License agreement page before you can download this project:

I can still reproduce this problem with this sample project and can provide screen shots of what I am seeing if needed. When I run the Visual Studio Demo I am selecting the Microsoft Visual Studio 2008 Visual Manager - I don't think any of the other settings on this Application Look dialog matter.
Posted by Microsoft on 1/26/2011 at 6:37 PM
Thanks for reporting this issue. In order to fix the issue, we must first reproduce the issue in our labs. We are unable to reproduce the issue with the steps you provided.

Could you please upload the project agian because we could not find the demo you provided?

It would be greatly appreciated if you could provide us with that information as quickly as possible. If we do not hear back from you within 5 days, we will close this issue.

Thanks again for your efforts and we look forward to hearing from you.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 1/26/2011 at 11:59 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
MenuAfterScrollingToBottom.jpg 1/27/2011 42 KB
MenuGeneratedWhenArrowClicked.jpg 1/27/2011 44 KB
ctrl_N_ForLotsOfWindows.jpg 1/27/2011 10 KB
AfterUsingMouseWheel.jpg 1/27/2011 46 KB
ApplicationLookDialogSettings.jpg 1/27/2011 35 KB