Disable UltraGrid ComboBox MouseWheel Event

I’m trying to disable the mouse wheel event when the focus is within a combo box in an UltraGrid.
I can disable the scrolling for the entire grid, which is not what I want, but I cannot figure out how to do it for that specific combo. I can get the column, but UltraGridColumn does not have an event for OnMouseWheel where I can absorb the handler. Any ideas?

If you change the Combo Box Style to something else could that stop the scrolling? I know there are a few styles where you can disable AutoComplete and Typing forcing the user to click the drop-down.

I got it after all. I spend hours on something to no avail, but then the moment I ask, I find a solution. :unamused:

  // **************************************************
  // Custom code for MainController
  // Created: 1/23/2018 8:31:31 AM
  // **************************************************
  using System;
  using System.ComponentModel;
  using System.Data;
  using System.Diagnostics;
  using System.Windows.Forms;
  using Ice.BO;
  using Ice.UI;
  using Ice.Lib;
  using Ice.Adapters;
  using Ice.Lib.Customization;
  using Ice.Lib.ExtendedProps;
  using Ice.Lib.Framework;
  using Ice.Lib.Searches;
  using Ice.UI.FormFunctions;
  using Infragistics.Win.UltraWinGrid;
  using Infragistics.Win;

  public class Script
  {
     // ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
     // Begin Wizard Added Module Level Variables **
     EpiUltraGrid grid1;
     EpiUltraGrid grid2;
     // End Wizard Added Module Level Variables **

     // Add Custom Module Level Variables Here **

     public void InitializeCustomCode()
     {
        // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
        // Begin Wizard Added Variable Initialization
        this.grid1 = (EpiUltraGrid)csm.GetNativeControlReference("e4989f9a-c2a5-4ff4-bd19-47e68fd02fa9");
        this.grid2 = (EpiUltraGrid)csm.GetNativeControlReference("dc3ed6d0-5423-47d3-98ed-67655d36ae72");
        // End Wizard Added Variable Initialization

        // Begin Wizard Added Custom Method Calls
        
        this.grid1.ControlAdded += new System.Windows.Forms.ControlEventHandler(this.grid1_ControlAdded);
        this.grid1.ControlRemoved += new System.Windows.Forms.ControlEventHandler(this.grid1_ControlRemoved);
        // End Wizard Added Custom Method Calls
     }

     public void DestroyCustomCode()
     {
        // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
        // Begin Wizard Added Object Disposal
        this.grid1 = null;
        this.grid2 = null;
        this.grid1.ControlAdded -= new System.Windows.Forms.ControlEventHandler(this.grid1_ControlAdded);
        this.grid1.ControlRemoved -= new System.Windows.Forms.ControlEventHandler(this.grid1_ControlRemoved);
        // End Wizard Added Object Disposal

        // Begin Custom Code Disposal

        // End Custom Code Disposal
     }

     private void MainController_Load(object sender, EventArgs args)
     {
        // Add Event Handler Code

        grid1.DisplayLayout.Bands[0].Columns["Calculated_Hyperlink"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.URL;
        grid2.DisplayLayout.Bands[0].Columns["Calculated_Hyperlink"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.URL;

        UltraGridColumn supplierCol = grid1.DisplayLayout.Bands[0].Columns["OrderDtl_FS_SupplierName_c"];
        
     }

      private void grid1_ControlAdded(object sender, ControlEventArgs e)
      {
          EmbeddableTextBox textBox = e.Control as EmbeddableTextBox;
          if (textBox != null)
              textBox.MouseWheel += new MouseEventHandler(textBox_MouseWheel);
      }

      private void grid1_ControlRemoved(object sender, ControlEventArgs e)
      {
          EmbeddableTextBox textBox = e.Control as EmbeddableTextBox;
          if (textBox != null)
              textBox.MouseWheel -= new MouseEventHandler(textBox_MouseWheel);
      }

      void textBox_MouseWheel(object sender, MouseEventArgs e)
      {
          HandledMouseEventArgs args = e as HandledMouseEventArgs;
          if (args != null)
              args.Handled = true;
      }
  }
3 Likes

Thank you i made it for Erp.UI.Controls.Combos:

EpiCombo cboBuyer;
public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		this.baseToolbarsManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.baseToolbarsManager_ToolClick);
		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls
	    session= (Session)this.oTrans.Session;
		// End Wizard Added Custom Method Calls cmbBuyer
		
		grdList=((EpiUltraGrid)csm.GetNativeControlReference("4d59326f-7a76-4c5c-8e2c-54e630db64da"));
		grdSubcontract = ((EpiUltraGrid)csm.GetNativeControlReference("fcef0a0c-90f6-48b5-8133-f892a2515b84"));
		cboBuyer = ((EpiCombo)csm.GetNativeControlReference("b734a402-4630-4190-b273-f51cd5f95b37"));
		grdSubcontract.DisplayLayout.Bands[0].Columns["BuyerID"].ValueList =cboBuyer;
		EpiDataView edvCallContextBpmData = ((EpiDataView)(this.oTrans.EpiDataViews["CallContextBpmData"]));
		System.Data.DataRow edvCallContextBpmDataRow = edvCallContextBpmData.CurrentDataRow;
		if ((edvCallContextBpmDataRow != null))
		{
			try{
				edvCallContextBpmDataRow.BeginEdit();
				edvCallContextBpmDataRow["CheckBox06"] =false;
				edvCallContextBpmDataRow.EndEdit();			
			}
			catch{}
		}
		cboBuyer.MouseWheel += new MouseEventHandler(cboBuyer_MouseWheel);
	}
public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		this.baseToolbarsManager.ToolClick -= new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.baseToolbarsManager_ToolClick);
		cboBuyer.MouseWheel -= new MouseEventHandler(cboBuyer_MouseWheel);
		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}
void cboBuyer_MouseWheel(object sender, MouseEventArgs e)
      {
          HandledMouseEventArgs args = e as HandledMouseEventArgs;
          if (args != null)
              args.Handled = true;
      }

But for Ice.Lib.Framework.EpiUltraCombo it’s easier:
Just change the DropDownStyle

private void MainController_Load(object sender, EventArgs args)
	{
		// Add Event Handler Code
		//khởi tạo các biến cục bộ
		tblSubModule = new DataTable();
		session=this.oTrans.Session as Ice.Core.Session;
		epiCheckBoxC_Overwrite.Text = "Overwrite";
		epiButtonC_Sync.ReadOnly = true;//khóa nút đồng bộ
		this.baseToolbarsManager.Tools["RefreshTool"].SharedProps.Enabled = false;//khóa nút Refresh
		this.epiUltraComboC_Module.DropDownStyle = UltraComboStyle.DropDownList;//không cho nhập text		
		this.epiUltraComboC_Module.Rows[0].Selected = true;	
		this.epiComboC_Company.DropDownStyle = UltraComboStyle.DropDownList;//không cho nhập text		
		SearchOnCompanyAdapterFillDropDown();
		this.epiComboC_Company.Value = session.CompanyID;
		//this.epiComboC_Company.Value = session.CompanyID;
		this.epiComboC_Company.ReadOnly = true;//khóa không cho chọn công ty
		//
		//epiTextBoxC_Object2.ReadOnly = true;
		//epiTextBoxC_Object2.Clear();
		epiUltraComboC_TranType.ReadOnly = true;
		this.epiUltraComboC_TranType.Rows[0].Selected = true;	
		this.epiUltraComboC_TranType.DropDownStyle = UltraComboStyle.DropDownList;//không cho nhập text
	}

Thank you so much have a nice day! :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

1 Like