Class LengthProperty
- Namespace
- CADability.UserInterface
- Assembly
- CADability.dll
Property entry for the control center that displays and edits a length (a double value in the units of the model), e.g. the radius of a circle, the length of a line or the size of a text. The value is connected to its owner via the base class mechanisms of EditableProperty<T> (delegates, reflection or OnGetValue and OnSetValue). The number of decimal digits comes from the "Formatting.GeneralDouble" setting. Its context menu ("MenuId.Length") offers to modify the length with the mouse (ModifyWithMouse), to measure it as the length of a curve, the distance of two points, of a point and a curve or of two curves, to double or halve it, to store it as a named value and to open the format settings. A LengthHotSpot shows the entry as a draggable handle in the drawing area.
public class LengthProperty : EditableProperty<double>, IPropertyEntry, IShowProperty, IConstructProperty, ICommandHandler
- Inheritance
-
LengthProperty
- Implements
- Inherited Members
Constructors
LengthProperty(IFrame, string)
Creates a length property entry that is not yet connected to a value. Set OnGetValue and OnSetValue before the entry is used.
public LengthProperty(IFrame frame, string resourceId = null)
Parameters
frameIFrameThe frame whose formatting settings (digits, decimal separator) are used for the display
resourceIdstringResource id of the label text and the tooltip, or null
LengthProperty(GetValueDelegate, SetValueDelegate, IFrame, string)
Creates a length property entry that reads and writes the value through the given delegates.
public LengthProperty(EditableProperty<double>.GetValueDelegate getValueDelegate, EditableProperty<double>.SetValueDelegate setValueDelegate, IFrame frame, string resourceId = null)
Parameters
getValueDelegateEditableProperty<double>.GetValueDelegateReturns the current length from the object that owns it
setValueDelegateEditableProperty<double>.SetValueDelegateTransfers a new length to the owning object
frameIFrameThe frame whose formatting settings are used for the display
resourceIdstringResource id of the label text and the tooltip, or null
LengthProperty(object, string, string, IFrame, bool)
Creates a length property entry that reads and writes the value through reflection on a property of the owning object.
public LengthProperty(object ObjectWithLength, string PropertyName, string resourceId, IFrame frame, bool autoModifyWithMouse = true)
Parameters
ObjectWithLengthobjectThe object that owns the value, e.g. a circle or a text
PropertyNamestringName of a (public or non-public) instance property of type double on
ObjectWithLengthresourceIdstringResource id of the label text and the tooltip
frameIFrameThe frame whose formatting settings are used for the display
autoModifyWithMouseboolNot evaluated by this constructor; kept for compatibility with older code
LengthProperty(string, IFrame, bool)
Obsolete: creates the entry like LengthProperty(IFrame, string); autoModifyWithMouse is ignored.
[Obsolete("Parameter autoModifyWithMouse no longer supported, use LengthProperty(IFrame frame, string resourceId) instead")]
public LengthProperty(string resourceId, IFrame frame, bool autoModifyWithMouse)
Parameters
resourceIdstringResource id of the label text and the tooltip
frameIFrameThe frame whose formatting settings are used for the display
autoModifyWithMouseboolIgnored
Methods
CheckMouseButton(bool)
Obsolete and without functionality; the call can be removed.
[Obsolete("method has no functionality, remove this call")]
public void CheckMouseButton(bool Check)
Parameters
CheckboolIgnored
GetLength()
Returns the current length as read from the owning object (or the value held by this entry when no object is connected).
public double GetLength()
Returns
- double
The length in the units of the model
LengthChanged()
Must be called by the owner when the length has been changed from outside (not through this entry), so that the displayed value is refreshed. Has no effect while the entry is not on a property page.
public void LengthChanged()
SetLength(double)
Sets the length: transfers it to the owning object (through the set delegate or the reflected property) and refreshes the display. Used by the owner and by actions that construct the value.
public void SetLength(double l)
Parameters
ldoubleThe new length in the units of the model
TextToValue(string, out double)
Converts the text to a value. Returns true if possible, false otherwise (maybe invalid characters or outside the limit)
protected override bool TextToValue(string text, out double val)
Parameters
Returns
ValueToText(double)
Returns the text representation of the value.
protected override string ValueToText(double val)
Parameters
valdouble
Returns
Events
GetLengthEvent
Obsolete: adding a handler installs it as OnGetValue, so it is asked for the current value whenever the entry needs it. Only one handler is kept (adding replaces the previous one), removing clears the delegate.
[Obsolete("use delegate LengthProperty.OnGetValue instead")]
public event LengthProperty.GetLengthDelegate GetLengthEvent
Event Type
LabelChangedEvent
Obsolete: adding a handler installs it as LabelTextChanged, which is called when the user has edited the label text of the entry. Only one handler is kept, removing clears the delegate.
[Obsolete("use delegate LengthProperty.LabelTextChanged instead")]
public event EditableProperty<double>.LabelChangedDelegate LabelChangedEvent
Event Type
LockedChangedEvent
Obsolete: adding a handler installs it as LockedChanged, which is called with the new state whenever Locked changes. Only one handler is kept, removing clears the delegate.
[Obsolete("use delegate LengthProperty.LockedChanged instead")]
public event EditableProperty<double>.LockedChangedDelegate LockedChangedEvent
Event Type
ModifyWithMouseEvent
Obsolete: adding a handler installs it as ModifyWithMouse. The handler is called with true when the user starts dragging the hotspot of this entry and with false when the "modify with mouse" command of the context menu is selected. Only one handler is kept, removing clears the delegate.
[Obsolete("use delegate LengthProperty.ModifyWithMouse instead")]
public event ModifyWithMouseDelegate ModifyWithMouseEvent
Event Type
SetLengthEvent
Obsolete: adding a handler installs it as OnSetValue, so it is called whenever a new value is to be transferred to the owner. Only one handler is kept (adding replaces the previous one), removing clears the delegate.
[Obsolete("use delegate LengthProperty.OnSetValue instead")]
public event LengthProperty.SetLengthDelegate SetLengthEvent