Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/11/10 12:03:25 (14 years ago)
Author:
mkommend
Message:

adapted view captions (ticket #893)

File:
1 edited

Legend:

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

    r3566 r3764  
    4141    public NamedItemView() {
    4242      InitializeComponent();
    43       Caption = "NamedItem";
    4443      errorProvider.SetIconAlignment(nameTextBox, ErrorIconAlignment.MiddleLeft);
    4544      errorProvider.SetIconPadding(nameTextBox, 2);
     
    6059      base.OnContentChanged();
    6160      if (Content == null) {
    62         Caption = "NamedItem";
    6361        nameTextBox.Text = string.Empty;
    6462        descriptionTextBox.Text = string.Empty;
    6563        toolTip.SetToolTip(descriptionTextBox, string.Empty);
     64        if (ViewAttribute.HasViewAttribute(this.GetType()))
     65          this.Caption = ViewAttribute.GetViewName(this.GetType());
     66        else
     67          this.Caption = "NamedItem View";
    6668      } else {
    67         Caption = Content.Name + " (" + Content.GetType().Name + ")";
    6869        nameTextBox.Text = Content.Name;
    6970        descriptionTextBox.Text = Content.Description;
    7071        toolTip.SetToolTip(descriptionTextBox, Content.Description);
     72        Caption = Content.Name;
    7173      }
    7274      SetEnabledStateOfControls();
     
    9294      if (InvokeRequired)
    9395        Invoke(new EventHandler(Content_NameChanged), sender, e);
    94       else
     96      else {
    9597        nameTextBox.Text = Content.Name;
     98        Caption = Content.Name;
     99      }
    96100    }
    97101    protected virtual void Content_DescriptionChanged(object sender, EventArgs e) {
     
    106110    protected virtual void nameTextBox_Validating(object sender, CancelEventArgs e) {
    107111      if ((Content != null) && (Content.CanChangeName)) {
     112        if (string.IsNullOrEmpty(nameTextBox.Text)) {
     113          e.Cancel = true;
     114          errorProvider.SetError(nameTextBox, "Name cannot be empty");
     115          nameTextBox.SelectAll();
     116          return;
     117        }
    108118        Content.Name = nameTextBox.Text;
    109 
    110119        // check if variable name was set successfully
    111120        if (!Content.Name.Equals(nameTextBox.Text)) {
Note: See TracChangeset for help on using the changeset viewer.