Changeset 12398


Ignore:
Timestamp:
05/26/15 13:36:26 (7 years ago)
Author:
pfleck
Message:

#2387

  • Added clearSearch-button in TypeSelector.
  • Adapted behavior of TypeSelector and NewItemDialog that a selected node stays selected as long as it matches the search criteria.
Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.Designer.cs

    r12397 r12398  
    4242      this.searchLabel = new System.Windows.Forms.Label();
    4343      this.searchTextBox = new System.Windows.Forms.TextBox();
     44      this.clearSearchButton = new System.Windows.Forms.Button();
    4445      this.typeParametersGroupBox = new System.Windows.Forms.GroupBox();
    4546      this.setTypeParameterButton = new System.Windows.Forms.Button();
     
    146147      this.searchTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    147148                  | System.Windows.Forms.AnchorStyles.Right)));
     149      this.searchTextBox.Controls.Add(this.clearSearchButton);
    148150      this.searchTextBox.Location = new System.Drawing.Point(29, 3);
    149151      this.searchTextBox.Name = "searchTextBox";
    150152      this.searchTextBox.Size = new System.Drawing.Size(193, 20);
    151153      this.searchTextBox.TabIndex = 1;
    152       this.toolTip.SetToolTip(this.searchTextBox, "Enter string to search for types");
     154      this.toolTip.SetToolTip(this.searchTextBox, "Filters the available Types.\r\nThe search term is tokenized by space and a name ha" +
     155        "s to contain all tokens to be displayed.\r\n(E.g. \"Sym Reg\" matches \"SymbolicRegr" +
     156        "ession\")");
    153157      this.searchTextBox.TextChanged += new System.EventHandler(this.searchTextBox_TextChanged);
    154158      this.searchTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.searchTextBox_KeyDown);
     159      //
     160      // clearSearchButton
     161      //
     162      this.clearSearchButton.BackColor = System.Drawing.Color.Transparent;
     163      this.clearSearchButton.Cursor = System.Windows.Forms.Cursors.Default;
     164      this.clearSearchButton.Dock = System.Windows.Forms.DockStyle.Right;
     165      this.clearSearchButton.FlatAppearance.BorderSize = 0;
     166      this.clearSearchButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     167      this.clearSearchButton.ForeColor = System.Drawing.Color.Transparent;
     168      this.clearSearchButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Delete;
     169      this.clearSearchButton.Location = new System.Drawing.Point(543, 0);
     170      this.clearSearchButton.Margin = new System.Windows.Forms.Padding(0);
     171      this.clearSearchButton.Name = "clearSearchButton";
     172      this.clearSearchButton.Size = new System.Drawing.Size(15, 16);
     173      this.clearSearchButton.TabIndex = 0;
     174      this.clearSearchButton.TabStop = false;
     175      this.clearSearchButton.UseVisualStyleBackColor = false;
     176      this.clearSearchButton.Click += new System.EventHandler(this.clearSearchButton_Click);
    155177      //
    156178      // typeParametersGroupBox
     
    245267    protected System.Windows.Forms.Label searchLabel;
    246268    protected System.Windows.Forms.TextBox searchTextBox;
     269    protected System.Windows.Forms.Button clearSearchButton;
    247270    protected System.Windows.Forms.ToolTip toolTip;
    248271    protected System.Windows.Forms.SplitContainer typeParametersSplitContainer;
  • trunk/sources/HeuristicLab.Core.Views/3.3/TypeSelector.cs

    r12397 r12398  
    177177      else {
    178178        searchString = searchString.ToLower();
     179        TreeNode selectedNode = typesTreeView.SelectedNode;
    179180
    180181        if (!searchString.Contains(currentSearchString)) {
    181182          typesTreeView.BeginUpdate();
    182183          // expand search -> restore all tree nodes
    183           TreeNode selectedNode = typesTreeView.SelectedNode;
    184184          typesTreeView.Nodes.Clear();
    185185          foreach (TreeNode node in treeNodes)
    186186            typesTreeView.Nodes.Add((TreeNode)node.Clone());
    187           RestoreSelectedNode(selectedNode);
    188187          typesTreeView.EndUpdate();
    189188        }
    190 
    191189
    192190        // remove nodes
    193191        typesTreeView.BeginUpdate();
    194192        var searchTokens = searchString.Split(' ');
    195 
    196193        int i = 0;
    197194        while (i < typesTreeView.Nodes.Count) {
     
    221218        }
    222219        typesTreeView.EndUpdate();
     220
     221        RestoreSelectedNode(selectedNode);
    223222        UpdateDescription();
    224223      }
     
    394393      }
    395394    }
     395    private void clearSearchButton_Click(object sender, EventArgs e) {
     396      searchTextBox.Text = string.Empty;
     397      searchTextBox.Focus();
     398    }
    396399    #endregion
    397400
  • trunk/sources/HeuristicLab.Optimizer/3.3/NewItemDialog.cs

    r12397 r12398  
    174174      } else {
    175175        searchString = searchString.ToLower();
     176        var selectedNode = typesTreeView.SelectedNode;
    176177
    177178        if (!searchString.Contains(currentSearchString)) {
    178179          typesTreeView.BeginUpdate();
    179180          // expand search -> restore all tree nodes
    180           var selectedNode = typesTreeView.SelectedNode;
    181181          typesTreeView.Nodes.Clear();
    182182          foreach (TreeNode node in treeNodes)
    183183            typesTreeView.Nodes.Add((TreeNode)node.Clone());
    184           RestoreSelectedNode(selectedNode);
    185184          typesTreeView.EndUpdate();
    186185        }
     
    189188        typesTreeView.BeginUpdate();
    190189        var searchTokens = searchString.Split(' ');
    191 
    192190        int i = 0;
    193191        while (i < typesTreeView.Nodes.Count) {
     
    217215        }
    218216        typesTreeView.EndUpdate();
     217
     218        RestoreSelectedNode(selectedNode);
    219219        UpdateDescription();
    220220      }
Note: See TracChangeset for help on using the changeset viewer.