Changeset 18166


Ignore:
Timestamp:
12/26/21 20:49:51 (6 months ago)
Author:
gkronber
Message:

#3047: set SuppressKeyPress=true in all controls that handle the Enter key explicitly (except for dialogs).

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/OrdinalComparisonDateTimeFilterView.cs

    r17180 r18166  
    5252
    5353    private void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    54       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     54      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    5555        label.Focus();  // set focus on label to validate data
    56       if (e.KeyCode == Keys.Escape) {
     56        e.SuppressKeyPress = true;
     57      } else if (e.KeyCode == Keys.Escape) {
    5758        valueTextBox.Text = Content.Value.ToString();
    5859        label.Focus();  // set focus on label to validate data
     60        e.SuppressKeyPress = true;
    5961      }
    6062    }
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/OrdinalComparisonDoubleFilterView.cs

    r17180 r18166  
    5151
    5252    private void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    53       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     53      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    5454        label.Focus();  // set focus on label to validate data
    55       if (e.KeyCode == Keys.Escape) {
     55        e.SuppressKeyPress = true;
     56      } else if (e.KeyCode == Keys.Escape) {
    5657        valueTextBox.Text = Content.Value.ToString();
    5758        label.Focus();  // set focus on label to validate data
     59        e.SuppressKeyPress = true;
    5860      }
    5961    }
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/OrdinalComparisonFloatFilterView.cs

    r17180 r18166  
    5151
    5252    private void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    53       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     53      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    5454        label.Focus();  // set focus on label to validate data
    55       if (e.KeyCode == Keys.Escape) {
     55        e.SuppressKeyPress = true;
     56      } else if (e.KeyCode == Keys.Escape) {
    5657        valueTextBox.Text = Content.Value.ToString();
    5758        label.Focus();  // set focus on label to validate data
     59        e.SuppressKeyPress = true;
    5860      }
    5961    }
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/OrdinalComparisonIntFilterView.cs

    r17180 r18166  
    5151
    5252    private void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    53       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     53      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    5454        label.Focus();  // set focus on label to validate data
    55       if (e.KeyCode == Keys.Escape) {
     55        e.SuppressKeyPress = true;
     56      } else if (e.KeyCode == Keys.Escape) {
    5657        valueTextBox.Text = Content.Value.ToString();
    5758        label.Focus();  // set focus on label to validate data
     59        e.SuppressKeyPress = true;
    5860      }
    5961    }
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/OrdinalComparisonLongFilterView.cs

    r17180 r18166  
    5151
    5252    private void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    53       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     53      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    5454        label.Focus();  // set focus on label to validate data
    55       if (e.KeyCode == Keys.Escape) {
     55        e.SuppressKeyPress = true;
     56      } else if (e.KeyCode == Keys.Escape) {
    5657        valueTextBox.Text = Content.Value.ToString();
    5758        label.Focus();  // set focus on label to validate data
     59        e.SuppressKeyPress = true;
    5860      }
    5961    }
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/OrdinalComparisonPercentFilterView.cs

    r17180 r18166  
    5858
    5959    private void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    60       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     60      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    6161        label.Focus();  // set focus on label to validate data
    62       if (e.KeyCode == Keys.Escape) {
     62        e.SuppressKeyPress = true;
     63      } else if (e.KeyCode == Keys.Escape) {
    6364        valueTextBox.Text = Content.Value.ToString();
    6465        label.Focus();  // set focus on label to validate data
     66        e.SuppressKeyPress = true;
    6567      }
    6668    }
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/OrdinalComparisonTimeSpanFilterView.cs

    r17180 r18166  
    5959
    6060    private void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    61       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     61      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    6262        label.Focus();  // set focus on label to validate data
    63       if (e.KeyCode == Keys.Escape) {
     63        e.SuppressKeyPress = true;
     64      } else if (e.KeyCode == Keys.Escape) {
    6465        valueTextBox.Text = Content.Value.ToString();
    6566        label.Focus();  // set focus on label to validate data
     67        e.SuppressKeyPress = true;
    6668      }
    6769    }
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/StringComparisonAvailableValuesFilterView.cs

    r17180 r18166  
    8282
    8383    private void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    84       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     84      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    8585        label.Focus();  // set focus on label to validate data
    86       if (e.KeyCode == Keys.Escape) {
     86        e.SuppressKeyPress = true;
     87      } else if (e.KeyCode == Keys.Escape) {
    8788        valueComboBox.Text = Content.Value;
    8889        label.Focus();  // set focus on label to validate data
     90        e.SuppressKeyPress = true;
    8991      }
    9092    }
  • trunk/HeuristicLab.Clients.OKB.Views/3.3/Query/Views/StringComparisonFilterView.cs

    r17180 r18166  
    8282
    8383    private void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    84       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     84      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    8585        label.Focus();  // set focus on label to validate data
    86       if (e.KeyCode == Keys.Escape) {
     86        e.SuppressKeyPress = true;
     87      } else if (e.KeyCode == Keys.Escape) {
    8788        valueTextBox.Text = Content.Value;
    8889        label.Focus();  // set focus on label to validate data
     90        e.SuppressKeyPress = true;
    8991      }
    9092    }
  • trunk/HeuristicLab.Core.Views/3.3/NamedItemView.cs

    r17180 r18166  
    119119    }
    120120    protected virtual void nameTextBox_KeyDown(object sender, KeyEventArgs e) {
    121       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     121      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    122122        nameLabel.Focus();  // set focus on label to validate data
    123       if (e.KeyCode == Keys.Escape) {
     123        e.SuppressKeyPress = true;
     124      } else if (e.KeyCode == Keys.Escape) {
    124125        nameTextBox.Text = Content.Name;
    125126        nameLabel.Focus();  // set focus on label to validate data
     127        e.SuppressKeyPress = true;
    126128      }
    127129    }
  • trunk/HeuristicLab.Data.Views/3.3/StringConvertibleArrayView.cs

    r17180 r18166  
    156156    }
    157157    private void lengthTextBox_KeyDown(object sender, KeyEventArgs e) {
    158       if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
     158      if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) {
    159159        lengthLabel.Focus();  // set focus on label to validate data
    160       if (e.KeyCode == Keys.Escape) {
     160        e.SuppressKeyPress = true;
     161      } else if (e.KeyCode == Keys.Escape) {
    161162        lengthTextBox.Text = Content.Length.ToString();
    162163        lengthLabel.Focus();  // set focus on label to validate data
     164        e.SuppressKeyPress = true;
    163165      }
    164166    }
     
    249251        clipboardText = clipboardText.Remove(clipboardText.Length - Environment.NewLine.Length);  //remove last newline constant
    250252
    251       var lines = clipboardText.Split(new [] { Environment.NewLine }, StringSplitOptions.None);
     253      var lines = clipboardText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
    252254      var tabSep = new[] { '\t' };
    253255      if (lines.Length > 2) {
  • trunk/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs

    r17921 r18166  
    227227    }
    228228    private void rowsTextBox_KeyDown(object sender, KeyEventArgs e) {
    229       if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
     229      if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) {
    230230        rowsLabel.Focus();  // set focus on label to validate data
    231       if (e.KeyCode == Keys.Escape) {
     231        e.SuppressKeyPress = true;
     232      } else if (e.KeyCode == Keys.Escape) {
    232233        rowsTextBox.Text = Content.Rows.ToString();
    233234        rowsLabel.Focus();  // set focus on label to validate data
     235        e.SuppressKeyPress = true;
    234236      }
    235237    }
     
    249251    }
    250252    private void columnsTextBox_KeyDown(object sender, KeyEventArgs e) {
    251       if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
     253      if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) {
    252254        columnsLabel.Focus();  // set focus on label to validate data
    253       if (e.KeyCode == Keys.Escape) {
     255        e.SuppressKeyPress = true;
     256      } else if (e.KeyCode == Keys.Escape) {
    254257        columnsTextBox.Text = Content.Columns.ToString();
    255258        columnsLabel.Focus();  // set focus on label to validate data
     259        e.SuppressKeyPress = true;
    256260      }
    257261    }
  • trunk/HeuristicLab.Data.Views/3.3/TextValueView.cs

    r17180 r18166  
    8686
    8787    protected virtual void valueTextBox_KeyDown(object sender, KeyEventArgs e) {
    88       if (e.Shift && (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return))
     88      if (e.Shift && (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)) {
    8989        valueLabel.Select();  // select label to validate data
    90 
    91       if (e.KeyCode == Keys.Escape) {
     90        e.SuppressKeyPress = true;
     91      } else if (e.KeyCode == Keys.Escape) {
    9292        valueTextBox.Text = Content.GetValue();
    9393        valueLabel.Select();  // select label to validate data
     94        e.SuppressKeyPress = true;
    9495      }
    9596    }
  • trunk/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views/3.4/SymbolView.cs

    r17180 r18166  
    7070    #region control event handlers
    7171    private void initialFrequencyTextBox_KeyDown(object sender, KeyEventArgs e) {
    72       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     72      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    7373        initialFrequencyLabel.Select();  // select label to validate data
    74 
    75       if (e.KeyCode == Keys.Escape) {
     74        e.SuppressKeyPress = true;
     75      } else  if (e.KeyCode == Keys.Escape) {
    7676        initialFrequencyTextBox.Text = Content.InitialFrequency.ToString();
    7777        initialFrequencyLabel.Select();  // select label to validate data
     78        e.SuppressKeyPress = true;
    7879      }
    7980    }
  • trunk/HeuristicLab.Parameters.Views/3.3/ScopeTreeLookupParameterView.cs

    r17180 r18166  
    106106    }
    107107    protected virtual void depthTextBox_KeyDown(object sender, KeyEventArgs e) {
    108       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     108      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    109109        depthLabel.Focus();  // set focus on label to validate data
    110       if (e.KeyCode == Keys.Escape) {
     110        e.SuppressKeyPress = true;
     111      } else if (e.KeyCode == Keys.Escape) {
    111112        depthTextBox.Text = Content.Depth.ToString();
    112113        depthLabel.Focus();  // set focus on label to validate data
     114        e.SuppressKeyPress = true;
    113115      }
    114116    }
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/FeatureCorrelation/TimeframeFeatureCorrelationView.cs

    r17180 r18166  
    7070      if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) {
    7171        timeFrameLabel.Select();  // select label to validate data
    72       }
    73 
    74       if (e.KeyCode == Keys.Escape) {
     72        e.SuppressKeyPress = true;
     73      } else  if (e.KeyCode == Keys.Escape) {
    7574        timeframeTextbox.Text = lastFramesValue;
    7675        timeFrameLabel.Select();  // select label to validate data
     76        e.SuppressKeyPress = true;
    7777      }
    7878    }
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/TimeSeriesPrognosis/TimeSeriesPrognosisResultsView.cs

    r17180 r18166  
    107107
    108108    private void TrainingHorizonTextBox_KeyDown(object sender, KeyEventArgs e) {
    109       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     109      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    110110        TrainingHorizonLabel.Select();  // select label to validate data
    111 
    112       if (e.KeyCode == Keys.Escape) {
     111        e.SuppressKeyPress = true;
     112      } else if (e.KeyCode == Keys.Escape) {
    113113        TrainingHorizonTextBox.Text = Content.TrainingHorizon.ToString();
    114114        TrainingHorizonLabel.Select();  // select label to validate data
     115        e.SuppressKeyPress = true;
    115116      }
    116117    }
     
    132133
    133134    private void TestHorizonTextBox_KeyDown(object sender, KeyEventArgs e) {
    134       if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return))
     135      if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) {
    135136        TestHorizonLabel.Select();  // select label to validate data
    136 
    137       if (e.KeyCode == Keys.Escape) {
     137        e.SuppressKeyPress = true;
     138      } else if (e.KeyCode == Keys.Escape) {
    138139        TestHorizonTextBox.Text = Content.TestHorizon.ToString();
    139140        TestHorizonLabel.Select();  // select label to validate data
     141        e.SuppressKeyPress = true;
    140142      }
    141143    }
Note: See TracChangeset for help on using the changeset viewer.