Class NameProperty
- Namespace
- CADability.UserInterface
- Assembly
- CADability.dll
Property entry which shows and edits a string property (typically "Name") of an arbitrary object via reflection: the property is looked up by name on the type of the object (or its base type) and its getter and setter are invoked when the entry is displayed or the user enters a new text. Used e.g. for the names of blocks, faces, shells and solids.
public class NameProperty : IShowPropertyImpl, IShowProperty, IPropertyEntry
- Inheritance
-
NameProperty
- Implements
- Inherited Members
Constructors
NameProperty(object, string, string)
Creates the entry for the string property PropertyName of ObjectWithName. The
property is looked up on the type of the object and, when it is not found there, on its base type.
public NameProperty(object ObjectWithName, string PropertyName, string resourceId)
Parameters
ObjectWithNameobjectThe object holding the property
PropertyNamestringName of the public string property
resourceIdstringResource id of the label text
Properties
Value
Implementation of Value: the text shown in the value column. The default is null, which means the entry has no value column; entries that show a value override it.
public override string Value { get; }
Property Value
Methods
EditTextChanged(string)
Implementation of EditTextChanged(string): accepts every text and returns true. Override it to check the text while it is typed and to apply it immediately.
public override bool EditTextChanged(string newValue)
Parameters
newValuestringthe current text of the text box
Returns
- bool
true when the text is acceptable, false to show the error symbol with the text of GetErrorText()
EndEdit(bool, bool, string)
Implementation of EndEdit(bool, bool, string): does nothing. An entry with an editable value or label overrides it to take over (or, when aborted, discard) the text that was entered.
public override void EndEdit(bool aborted, bool modified, string newValue)
Parameters
abortedbooltrue: the edit was aborted (Escape), false: it ended normally
modifiedbooltrue: the text was changed while editing
newValuestringthe text as it was when editing ended
StartEdit(bool)
Implementation of StartEdit(bool): does nothing. Override it when the entry has to prepare for an edit, e.g. remember the value before the edit.
public override void StartEdit(bool editValue)
Parameters
editValuebooltrue: the value is edited, false: the label is edited
UnSelected()
Implementation of UnSelected(), raises the StateChangedEvent
public override void UnSelected()