Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/15/10 01:34:27 (14 years ago)
Author:
mkommend
Message:

implemented first version of View.ReadOnly and adapted some views to the new mechanism (ticket #973)

File:
1 edited

Legend:

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

    r2917 r3350  
    6666        Caption = "NamedItem";
    6767        nameTextBox.Text = "-";
    68         nameTextBox.Enabled = false;
    6968        descriptionTextBox.Text = "";
    70         descriptionTextBox.Enabled = false;
    7169        toolTip.SetToolTip(descriptionTextBox, string.Empty);
    7270      } else {
    7371        Caption = Content.Name + " (" + Content.GetType().Name + ")";
    7472        nameTextBox.Text = Content.Name;
    75         nameTextBox.ReadOnly = !Content.CanChangeName;
     73        descriptionTextBox.Text = Content.Description;
     74        toolTip.SetToolTip(descriptionTextBox, Content.Description);
     75      }
     76      SetEnableStateOfControls();
     77    }
     78
     79    protected override void OnReadOnlyChanged() {
     80      base.OnReadOnlyChanged();
     81      SetEnableStateOfControls();
     82    }
     83    private void SetEnableStateOfControls() {
     84      if (Content == null) {
     85        nameTextBox.Enabled = false;
     86        descriptionTextBox.Enabled = false;
     87      } else {
    7688        nameTextBox.Enabled = true;
    77         descriptionTextBox.Text = Content.Description;
    78         descriptionTextBox.ReadOnly = !Content.CanChangeDescription;
     89        nameTextBox.ReadOnly = ReadOnly || !Content.CanChangeName; ;
    7990        descriptionTextBox.Enabled = true;
    80         toolTip.SetToolTip(descriptionTextBox, Content.Description);
     91        descriptionTextBox.ReadOnly = ReadOnly || !Content.CanChangeDescription;
    8192      }
    8293    }
Note: See TracChangeset for help on using the changeset viewer.