Changeset 6496


Ignore:
Timestamp:
06/29/11 00:33:48 (8 years ago)
Author:
mkommend
Message:

#1555: Added functionality to open new view on double click.

Location:
trunk/sources/HeuristicLab.Optimization.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentTreeView.Designer.cs

    r6485 r6496  
    167167      this.optimizerTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.optimizerTreeView_DragOver);
    168168      this.optimizerTreeView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.optimizerTreeView_KeyDown);
    169       this.optimizerTreeView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.optimizerTreeview_MouseClick);
    170169      this.optimizerTreeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.optimizerTreeView_MouseDown);
     170      this.optimizerTreeView.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.optimizerTreeview_NodeMouseClick);
     171      this.optimizerTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(optimizerTreeView_NodeMouseDoubleClick);
    171172      //
    172173      // imageList
     
    221222
    222223    }
    223 
    224224    #endregion
    225225
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/ExperimentTreeView.cs

    r6488 r6496  
    2929using HeuristicLab.Common;
    3030using HeuristicLab.Core.Views;
     31using HeuristicLab.MainForm;
    3132using HeuristicLab.PluginInfrastructure;
    3233
     
    496497
    497498    #region control events
    498     private void optimizerTreeview_MouseClick(object sender, MouseEventArgs e) {
    499       Point coordinates = new Point(e.X, e.Y);
    500       TreeNode selectedNode = optimizerTreeView.GetNodeAt(coordinates);
    501       if (selectedNode != null) {
    502         optimizerTreeView.SelectedNode = selectedNode;
    503         detailsViewHost.Content = (IOptimizer)selectedNode.Tag;
    504         SetEnabledStateOfControls();
    505       }
     499    private void optimizerTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) {
     500      if (e.X < e.Node.Bounds.Left || e.X > e.Node.Bounds.Right) return;
     501      IOptimizer optimizer = (IOptimizer)e.Node.Tag;
     502      MainFormManager.MainForm.ShowContent(optimizer);
     503    }
     504    private void optimizerTreeview_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) {
     505      if (e.X < e.Node.Bounds.Left || e.X > e.Node.Bounds.Right) return;
     506      optimizerTreeView.SelectedNode = e.Node;
     507      detailsViewHost.Content = (IOptimizer)e.Node.Tag;
     508      SetEnabledStateOfControls();
    506509    }
    507510    private void optimizerTreeView_MouseDown(object sender, MouseEventArgs e) {
    508511      // enables deselection of treeNodes
     512      if (e.Button != System.Windows.Forms.MouseButtons.Left) return;
    509513      if (optimizerTreeView.SelectedNode == null) return;
    510514      Point coordinates = new Point(e.X, e.Y);
    511       if (e.Button == System.Windows.Forms.MouseButtons.Left && optimizerTreeView.GetNodeAt(coordinates) == null) {
     515      TreeNode node = optimizerTreeView.GetNodeAt(coordinates);
     516      if (node == null || coordinates.X < node.Bounds.Left || coordinates.X > node.Bounds.Right) {
    512517        optimizerTreeView.SelectedNode = null;
    513518        detailsViewHost.Content = null;
Note: See TracChangeset for help on using the changeset viewer.