I have ribbon tabs, and there are buttons, textboxes,comboboxes in each tab. My problem is, I want to be able to scroll down and up with my mouse wheel (for the combobox), but instead, my mouse wheel changes the tabs. It doesn't affect the combobox in it. Is there a way to fix this? It is really annoying.
Asked
Active
Viewed 1,229 times
2
-
Traditionally, the mouse wheel only works on the control that has the focus. Try clicking on the ComboBox *before* using the wheel to select an item. – LarsTech Jul 26 '12 at 12:12
-
I did that too. Clicked an item on the combobox, and did the scrolling inside the combobox but it still changes the tab page. – Ada Jul 26 '12 at 12:19
-
1Can I remove the MouseWheelEvent when the combobox got focus and give it back when combobox lost focus? – Ada Jul 26 '12 at 12:20
-
1Something is seriously broken about components that steal mouse input events *when they don't have the focus*. I suggest using a different component library, like maybe the built-in one that doesn't have serious bugs. – Cody Gray - on strike Jul 26 '12 at 12:21
-
You may have to try replacing the ribbon with one that you inherit so that you can override the MouseWheel event to only run if the Ribbon has the focus. – LarsTech Jul 26 '12 at 12:22
-
I can't change it now it is an ongoing project used by many labs. Also I am not the boss :) I am just a new grad. worker but I need to fix this. Can you think of a way – Ada Jul 26 '12 at 12:23
-
In the relase notes, It says "- The Ribbon changes the selected tab when the mouse wheel moves while the mouse pointer is within the Ribbon." So it doesn't check the focus? Now I tried, It does scroll right only if my cursor is on somewhere else. But It is stupid. I can't tell the clients to move their cursor away about 6 inches down to scroll right. – Ada Jul 26 '12 at 12:24
-
1That component is seriously broken, notify your boss about it – Alex Jul 26 '12 at 12:41
1 Answers
1
Too long for a comment, so I will post it here.
Try creating your own class that inherits from that Ribbon control. I don't have a ComponentOne library, so for this example, I am just calling the control "Ribbon":
public class MyRibbon : Ribbon {
public bool DisableMouseWheel { get; set; }
protected override void OnMouseWheel(MouseEventArgs e) {
if (!this.DisableMouseWheel) {
base.OnMouseWheel(e);
}
}
}
Rebuild your solution. Click on the "Show All Files" button from the Solution Explorer and open your designer file for your form. There should be two lines in the file that reference your Ribbon type, replace the type with your new MyRibbon class.
Now subscribe to the ComboBox's Enter and Leave events where you change the DisableMouseWheel
property.
Make a backup of your work before trying this.

LarsTech
- 80,625
- 14
- 153
- 225
-
My combobox leave and enter events don't fire and I have no idea why. I put breakpoints there. But if fires the selectedValueChanged. I don't know what I am doing wrong. Since it doesn't fire, the DisableMouseWheel is always false. – Ada Jul 26 '12 at 13:23
-
I couldn't make it work. It gires enter and immediately fires leave. I guess I can't do it – Ada Jul 26 '12 at 13:48
-
@Ada According to this [ComponentOne Support Page](http://helpcentral.componentone.com/nethelp/c1ribbon/#!XMLDocuments/RibbonReference/html/AllMembers_T_C1_Win_C1Ribbon_RibbonComboBox.htm), there isn't an enter and leave event for the RibbonComboBox, but there is a GotFocus and LostFocus events. Try using those. – LarsTech Jul 26 '12 at 13:59