Free cookie consent management tool by TermsFeed Policy Generator

Changeset 410 for trunk/sources


Ignore:
Timestamp:
07/30/08 13:16:34 (16 years ago)
Author:
gkronber
Message:

fixed #180 by adding an event-handler for the mouse-up event that selects the clicked node on right-click.

(had to rename variable functionTreeView to funTreeView because the designer was unhappy. )

Location:
trunk/sources/HeuristicLab.Functions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Functions/FunctionView.Designer.cs

    r155 r410  
    5050    private void InitializeComponent() {
    5151      this.components = new System.ComponentModel.Container();
    52       this.functionTreeView = new System.Windows.Forms.TreeView();
     52      this.funTreeView = new System.Windows.Forms.TreeView();
    5353      this.splitContainer = new System.Windows.Forms.SplitContainer();
    5454      this.variablesGroupBox = new System.Windows.Forms.GroupBox();
     
    6969      this.SuspendLayout();
    7070      //
    71       // functionTreeView
    72       //
    73       this.functionTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
    74       this.functionTreeView.HideSelection = false;
    75       this.functionTreeView.Location = new System.Drawing.Point(0, 0);
    76       this.functionTreeView.Name = "functionTreeView";
    77       this.functionTreeView.Size = new System.Drawing.Size(182, 532);
    78       this.functionTreeView.TabIndex = 0;
    79       this.functionTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.functionTreeView_AfterSelect);
     71      // funTreeView
     72      //
     73      this.funTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
     74      this.funTreeView.HideSelection = false;
     75      this.funTreeView.Location = new System.Drawing.Point(0, 0);
     76      this.funTreeView.Name = "funTreeView";
     77      this.funTreeView.Size = new System.Drawing.Size(182, 532);
     78      this.funTreeView.TabIndex = 0;
     79      this.funTreeView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.funTreeView_MouseUp);
     80      this.funTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.functionTreeView_AfterSelect);
    8081      //
    8182      // splitContainer
     
    8788      // splitContainer.Panel1
    8889      //
    89       this.splitContainer.Panel1.Controls.Add(this.functionTreeView);
     90      this.splitContainer.Panel1.Controls.Add(this.funTreeView);
    9091      //
    9192      // splitContainer.Panel2
     
    167168            this.copyToClipboardMenuItem});
    168169      this.treeNodeContextMenu.Name = "treeNodeContextMenu";
    169       this.treeNodeContextMenu.Size = new System.Drawing.Size(248, 26);
     170      this.treeNodeContextMenu.Size = new System.Drawing.Size(259, 26);
    170171      //
    171172      // copyToClipboardMenuItem
    172173      //
    173174      this.copyToClipboardMenuItem.Name = "copyToClipboardMenuItem";
    174       this.copyToClipboardMenuItem.Size = new System.Drawing.Size(247, 22);
     175      this.copyToClipboardMenuItem.Size = new System.Drawing.Size(258, 22);
    175176      this.copyToClipboardMenuItem.Text = "Copy to clip-board (Model-Analyzer)";
    176177      this.copyToClipboardMenuItem.Click += new System.EventHandler(this.copyToClipboardMenuItem_Click);
    177178      //
    178       // FunctionView
     179      // FunctionTreeView
    179180      //
    180181      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    181182      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    182183      this.Controls.Add(this.splitContainer);
    183       this.Name = "FunctionView";
     184      this.Name = "FunctionTreeView";
    184185      this.Size = new System.Drawing.Size(735, 532);
    185186      this.splitContainer.Panel1.ResumeLayout(false);
     
    197198    #endregion
    198199
    199     private System.Windows.Forms.TreeView functionTreeView;
     200    private System.Windows.Forms.TreeView funTreeView;
    200201    private System.Windows.Forms.SplitContainer splitContainer;
    201202    private System.Windows.Forms.TextBox templateTextBox;
  • trunk/sources/HeuristicLab.Functions/FunctionView.cs

    r365 r410  
    5252
    5353    protected override void UpdateControls() {
    54       functionTreeView.Nodes.Clear();
     54      funTreeView.Nodes.Clear();
    5555      functionNameVisitor.Visit(functionTree);
    5656      TreeNode rootNode = new TreeNode();
     
    5959      rootNode.Tag = functionTree;
    6060      rootNode.ContextMenuStrip = treeNodeContextMenu;
    61       functionTreeView.Nodes.Add(rootNode);
     61      funTreeView.Nodes.Add(rootNode);
    6262
    6363      foreach(IFunctionTree subTree in functionTree.SubTrees) {
    6464        CreateTree(rootNode, subTree);
    6565      }
    66       functionTreeView.ExpandAll();
     66      funTreeView.ExpandAll();
    6767    }
    6868
     
    8585      templateTextBox.Clear();
    8686      editButton.Enabled = false;
    87       if(functionTreeView.SelectedNode != null && functionTreeView.SelectedNode.Tag != null) {
    88         IFunctionTree selectedBranch = (IFunctionTree)functionTreeView.SelectedNode.Tag;
     87      if(funTreeView.SelectedNode != null && funTreeView.SelectedNode.Tag != null) {
     88        IFunctionTree selectedBranch = (IFunctionTree)funTreeView.SelectedNode.Tag;
    8989        UpdateVariablesList(selectedBranch);
    9090        templateTextBox.Text = selectedBranch.Function.Name;
     
    120120
    121121    void selectedVariable_ValueChanged(object sender, EventArgs e) {
    122       if(functionTreeView.SelectedNode != null && functionTreeView.SelectedNode.Tag != null) {
    123         TreeNode node = functionTreeView.SelectedNode;
     122      if(funTreeView.SelectedNode != null && funTreeView.SelectedNode.Tag != null) {
     123        TreeNode node = funTreeView.SelectedNode;
    124124        functionNameVisitor.Visit(selectedBranch);
    125125        node.Text = functionNameVisitor.Name;
     
    132132
    133133    private void copyToClipboardMenuItem_Click(object sender, EventArgs e) {
    134       TreeNode node = functionTreeView.SelectedNode;
     134      TreeNode node = funTreeView.SelectedNode;
    135135      if(node == null || node.Tag == null) return;
    136136
     
    138138      visitor.Visit((IFunctionTree)node.Tag);
    139139      Clipboard.SetText(visitor.ModelAnalyzerPrefix);
     140    }
     141    private void funTreeView_MouseUp(object sender, MouseEventArgs e) {
     142      if(e.Button == MouseButtons.Right) {
     143        // Select the clicked node
     144        funTreeView.SelectedNode = funTreeView.GetNodeAt(e.X, e.Y);
     145      }
    140146    }
    141147
Note: See TracChangeset for help on using the changeset viewer.