- Timestamp:
- 03/25/11 17:18:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/NamedItemView.cs
r5445 r5832 33 33 [Content(typeof(INamedItem), false)] 34 34 public partial class NamedItemView : ItemView { 35 private readonly string nl = Environment.NewLine; 36 private const string infoLabelToolTipSuffix = "Double-click to open description editor."; 37 35 38 public new INamedItem Content { 36 39 get { return (INamedItem)base.Content; } … … 59 62 if (Content == null) { 60 63 nameTextBox.Text = string.Empty; 61 descriptionTextBox.Text = string.Empty; 62 toolTip.SetToolTip(descriptionTextBox, string.Empty); 64 toolTip.SetToolTip(infoLabel, string.Empty); 63 65 if (ViewAttribute.HasViewAttribute(this.GetType())) 64 66 this.Caption = ViewAttribute.GetViewName(this.GetType()); … … 67 69 } else { 68 70 nameTextBox.Text = Content.Name; 69 descriptionTextBox.Text = Content.Description; 70 toolTip.SetToolTip(descriptionTextBox, Content.Description); 71 toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + nl + nl + infoLabelToolTipSuffix); 71 72 Caption = Content.Name; 72 73 } … … 77 78 if (Content == null) { 78 79 nameTextBox.Enabled = false; 79 descriptionTextBox.Enabled = false;80 infoLabel.Enabled = false; 80 81 } else { 81 82 nameTextBox.Enabled = true; 82 nameTextBox.ReadOnly = ReadOnly || !Content.CanChangeName; ; 83 descriptionTextBox.Enabled = true; 84 descriptionTextBox.ReadOnly = ReadOnly || !Content.CanChangeDescription; 83 nameTextBox.ReadOnly = ReadOnly || !Content.CanChangeName; 84 infoLabel.Enabled = true; 85 85 } 86 86 } … … 98 98 Invoke(new EventHandler(Content_DescriptionChanged), sender, e); 99 99 else { 100 descriptionTextBox.Text = Content.Description; 101 toolTip.SetToolTip(descriptionTextBox, Content.Description); 100 toolTip.SetToolTip(infoLabel, string.IsNullOrEmpty(Content.Description) ? infoLabelToolTipSuffix : Content.Description + nl + nl + infoLabelToolTipSuffix); 102 101 } 103 102 } … … 131 130 } 132 131 } 133 protected virtual void descriptionTextBox_Validated(object sender, EventArgs e) { 134 if (Content.CanChangeDescription) 135 Content.Description = descriptionTextBox.Text; 136 } 137 138 protected void descriptionTextBox_DoubleClick(object sender, EventArgs e) { 139 using (TextDialog dialog = new TextDialog("Description of " + Content.Name, descriptionTextBox.Text, ReadOnly || !Content.CanChangeDescription)) { 132 protected virtual void infoLabel_DoubleClick(object sender, EventArgs e) { 133 using (TextDialog dialog = new TextDialog("Description of " + Content.Name, Content.Description, ReadOnly || !Content.CanChangeDescription)) { 140 134 if (dialog.ShowDialog(this) == DialogResult.OK) 141 135 Content.Description = dialog.Content;
Note: See TracChangeset
for help on using the changeset viewer.