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
20
UltraToolBar double-click issue
posted

Hi,

I have a problem with UltraToolBar double-click. When users double-click a tool on the toolbar of a form to open another form, the system treats it as two single clicks. The first click opens another form (as a MDI child) which in turn has its own toolbar, the second click fires toolclick event for a tool on the toolbar of the second form and open an unexpected form. I tried to use ToolDoubleClick event handler to do something but this event handler has never got fired since Infragistics treat double-click as two separate single clicks.

Please give me some advices.

Thanks

Huan Truong

Parents
No Data
Reply
  • 44743
    posted

    Apparently the ToolDoubleClick event was originally intended for only the LabelTool and editor tools. You can submit a feature request for this event to fire with other tools here: http://devcenter.infragistics.com/Protected/RequestFeature.aspx.

    You can also workaround this in the ToolClick event with the following code:

    private Point lastClickedLocation = new Point( -10000, -10000 );
    private Stopwatch timeSinceLastClick = new Stopwatch();
    private string lastClickedToolKey;

    private void ultraToolbarsManager1_ToolClick( object sender, ToolClickEventArgs e )
    {
     Point currentPosition = Cursor.Position;

     bool isDoubleClick = false;

     if ( this.timeSinceLastClick.IsRunning &&
      this.timeSinceLastClick.ElapsedMilliseconds <= SystemInformation.DoubleClickTime &&
      this.lastClickedToolKey == e.Tool.Key )
     {
      Size maxSize = SystemInformation.DoubleClickSize;

      if ( Math.Abs( this.lastClickedLocation.X - currentPosition.X ) < Math.Abs( maxSize.Width ) &&
       Math.Abs( this.lastClickedLocation.Y - currentPosition.Y ) < Math.Abs( maxSize.Height ) )
      {
       isDoubleClick = true;
      }
     }

     if ( isDoubleClick )
     {
      this.ToolDoubleClick( e.Tool );
      this.lastClickedToolKey = null;
      this.timeSinceLastClick.Stop();

      return;
     }

     this.lastClickedLocation = currentPosition;
     this.lastClickedToolKey = e.Tool.Key;

     this.timeSinceLastClick.Reset();
     this.timeSinceLastClick.Start();

     //switch ( e.Tool.Key )
     //{
     //    // Do normal tool click processing code here
     //}
    }

    private void ToolDoubleClick( ToolBase tool )
    {
     //switch ( e.Tool.Key )
     //{
     //    // Do tool double click processing code here
     //}
    }

Children