'Beep' when calling "TrackPopupMenu"??
-
Hello, I respond to a LVN_KEYDOWN event (List View in column mode) and if the user presses enter, I call another function with the following code. When this occurs, there is the audible beep. I don't want the beep. When I call this same code from the OnRButtonDown() (user presses right mouse button) there is no audible beep. I didn't find any documentation in CMenu that would help me determine why there is a beep. My assumption is that the "enter" key is still in some buffer, and the TrackPopupMenu thought it was an invalid selection?? Any thoughts on how to get rid of the beep? menu.CreatePopupMenu(); int levels = GetDocument()->m_nPriorityLevels-1; for (i=levels;i>=0; i--) { menu.AppendMenu(0, IDC_PRI_0+i, GetDocument()->m_sPriority[i]); } menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this); thanks! JennyP
-
Hello, I respond to a LVN_KEYDOWN event (List View in column mode) and if the user presses enter, I call another function with the following code. When this occurs, there is the audible beep. I don't want the beep. When I call this same code from the OnRButtonDown() (user presses right mouse button) there is no audible beep. I didn't find any documentation in CMenu that would help me determine why there is a beep. My assumption is that the "enter" key is still in some buffer, and the TrackPopupMenu thought it was an invalid selection?? Any thoughts on how to get rid of the beep? menu.CreatePopupMenu(); int levels = GetDocument()->m_nPriorityLevels-1; for (i=levels;i>=0; i--) { menu.AppendMenu(0, IDC_PRI_0+i, GetDocument()->m_sPriority[i]); } menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this); thanks! JennyP
In the function that handles LVN_KEYDOWN have you tried changing the return value when Enter is handled by your code. Notification functions use *lParam for this if my memory serves me correctly. Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program
-
In the function that handles LVN_KEYDOWN have you tried changing the return value when Enter is handled by your code. Notification functions use *lParam for this if my memory serves me correctly. Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program
-
Thank you for the suggestion. This doesn't seem to solve the issue. The beep occurs (according to debugger) when I call: menu.TrackPopupMenu(TPM_RIGHTBUTTON, pt.x, pt.y, this); JennyP
It is probably the KeyUp message which is causing the beep. ie. It is going to the Menu. Have you tried using NM_RETURN instead. Failing that you could add a PeekMessage loop and wait for the KeyUp message before calling TrackPopupMenu. Neville Franks, Author of ED for Windows. www.getsoft.com Make money with our new Affilate program