Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
Cannot disable mouse wheel in UltraComboEditor.
posted

I want to disable mouse wheel in UltraComboEditor. In other words, I don't want user to select the item by mouse wheel, they can just select item from drop down list. I've tried many ways and all failed. But MS comboBox can handle everything as I want.

Then I made an experiment between MS comboBox and UltraComboEditor. I find that UltraComboEditor can not handle mouse wheel event while MS comboBox can.  I tried 3 ways to debug whether this control can capture mouse wheel event. Blow is the 3 ways of my experiment. I set several breakponts to ensure combobox can handle mouse wheel event. MS combo can enter all the breakponts but UltraCombo can't. Anyone can help me? 

        const int WM_MOUSEWHEEL = 0x020A;

        protected override void WndProc(ref Message m)
        {
            //stop scroll
            if (m.Msg == WM_MOUSEWHEEL)
            {
                //but force next item
                int delta;
                if ((int)m.WParam > 0)
                {
                    //up
                    delta = 1;
                }
                else
                {
                    //down
                    delta = -1;
                }
                this.OnMouseWheel(new MouseEventArgs(MouseButtons.None, 0, 0, 0, delta));

                return;
            }

            base.WndProc(ref m);
        }

        protected override void OnMouseWheel(MouseEventArgs e)
        {
            base.OnMouseWheel(e);
        }

       public Form1()
        {
            this.testUltraCmb1.MouseWheel += new MouseEventHandler(testUltraCmb1_MouseWheel);
        }

        public void testUltraCmb1_MouseWheel(object sender, MouseEventArgs e)
        {
            HandledMouseEventArgs handledArgs = e as HandledMouseEventArgs;
            if (handledArgs != null)
                handledArgs.Handled = true;
        }

Parents
No Data
Reply
  • 520
    Suggested Answer
    posted

    I know this post is ancient but I had a similar problem. In my application, once a selection was made from the Combo. The screen would change quite a bit and the intuitive thing for the user to do was roll the mouse wheel so they could more closely examine a Web Browser control containg color coded SQL. Thing is that would scroll the combo because we human users would consistently fotrget to click the Web Browser contrrol ... first. I tried to get the focus to change to another control but I was unable to get that to happen. That is fine, I personally never trust the Focus method anyways.

    So a quick Google pointed me to this link, also on the Infragistics sight :

    http://es.infragistics.com/community/blogs/andrew_flick/archive/2009/06/22/disabling-wheel-scrolling-in-the-ultracombo.aspx

    It works a treat.

     

Children
No Data