Table of Contents

Class DoubleProperty

Namespace
CADability.UserInterface
Assembly
CADability.dll

Property entry for the control center that displays and edits a plain floating point number without a unit and without a context menu, e.g. a scale factor, a single coordinate (the x, y and z sub entries of GeoPointProperty and GeoVectorProperty) or a setting value. The value is connected to its owner via the base class mechanisms of EditableProperty<T> (delegates, reflection or OnGetValue and OnSetValue); created with a setting name it holds the value itself and is saved as part of the Settings, which is why the class is serializable. The number of decimal digits comes from the "Formatting.GeneralDouble" setting and can be changed with DecimalDigits. For a length with the length context menu use LengthProperty, for an angle AngleProperty.

public class DoubleProperty : EditableProperty<double>, IPropertyEntry, IShowProperty, IConstructProperty, IJsonSerialize, ISerializable
Inheritance
DoubleProperty
Implements
Inherited Members

Constructors

DoubleProperty()

Empty constructor for IJsonSerialize deserialisation

protected DoubleProperty()

DoubleProperty(IFrame, string)

Creates a double property entry that is not yet connected to a value. Set OnGetValue and OnSetValue before the entry is used.

public DoubleProperty(IFrame frame, string resourceId = null)

Parameters

frame IFrame

The frame whose formatting settings (digits, decimal separator) are used for the display

resourceId string

Resource id of the label text and the tooltip, or null

DoubleProperty(GetValueDelegate, SetValueDelegate, IFrame, string)

Creates a double property entry that reads and writes the value through the given delegates.

public DoubleProperty(EditableProperty<double>.GetValueDelegate getValueDelegate, EditableProperty<double>.SetValueDelegate setValueDelegate, IFrame frame, string resourceId = null)

Parameters

getValueDelegate EditableProperty<double>.GetValueDelegate

Returns the current value from the object that owns it

setValueDelegate EditableProperty<double>.SetValueDelegate

Transfers a new value to the owning object

frame IFrame

The frame whose formatting settings are used for the display

resourceId string

Resource id of the label text and the tooltip, or null

DoubleProperty(object, string, string, IFrame, bool)

Creates a double property entry that reads and writes the value through reflection on a property of the owning object.

public DoubleProperty(object ObjectWithLength, string PropertyName, string resourceId, IFrame frame, bool autoModifyWithMouse = true)

Parameters

ObjectWithLength object

The object that owns the value, e.g. a dimension style or a drive

PropertyName string

Name of a (public or non-public) instance property of type double on ObjectWithLength

resourceId string

Resource id of the label text and the tooltip

frame IFrame

The frame whose formatting settings are used for the display

autoModifyWithMouse bool

Not evaluated by this constructor; kept for compatibility with older code

DoubleProperty(SerializationInfo, StreamingContext)

Constructor for the legacy binary deserialization (ISerializable): restores the value, the resource id and the setting name. The value is displayed with all significant digits.

protected DoubleProperty(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

The serialized data

context StreamingContext

The source of the deserialization

DoubleProperty(string, IFrame)

Obsolete: creates the entry like DoubleProperty(IFrame, string), only the parameters are swapped.

[Obsolete("Parameter autoModifyWithMouse no longer supported, use DoubleProperty(IFrame frame, string resourceId) instead")]
public DoubleProperty(string resourceId, IFrame frame)

Parameters

resourceId string

Resource id of the label text and the tooltip

frame IFrame

The frame whose formatting settings are used for the display

DoubleProperty(string, string, double, IFrame)

Creates a property entry that holds its value itself (no connected object), as used for the values of the Settings (e.g. "Approximate.Precision" or "Grid.XDistance").

public DoubleProperty(string SettingName, string resourceId, double initialValue, IFrame frame)

Parameters

SettingName string

Name of the setting; currently not stored by this constructor

resourceId string

Resource id of the label text and the tooltip

initialValue double

The initial value of the entry

frame IFrame

The frame whose formatting settings are used for the display, or null: the value is then displayed with all significant digits and the decimal separator of the current culture

Properties

DecimalDigits

The number of decimal digits used to display the value, initialized from the "Formatting.GeneralDouble" setting of the frame (3 when there is no frame). The special value 29 displays the value with all significant digits instead of a fixed number of decimals. Changing it does not refresh the display, call DoubleChanged() for that.

public int DecimalDigits { get; set; }

Property Value

int

DoubleValue

Obsolete: reads the value like GetDouble() and sets it like SetDouble(double).

[Obsolete("Use DoubleProperty.GetDouble or DoubleProperty.SetDouble instead")]
public double DoubleValue { get; set; }

Property Value

double

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

Check bool

Ignored

DoubleChanged()

Must be called by the owner when the value 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 DoubleChanged()

GetDouble()

Returns the current value as read from the owning object (or the value held by this entry when no object is connected).

public double GetDouble()

Returns

double

The current value

GetObjectData(IJsonWriteData)

Writes the resource id, the value and (when present) the setting name for the JSON serialization (IJsonSerialize); used when this entry is part of the settings.

public virtual void GetObjectData(IJsonWriteData data)

Parameters

data IJsonWriteData

Receives the data

GetObjectData(SerializationInfo, StreamingContext)

Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.

public virtual void GetObjectData(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

Receives the data

context StreamingContext

The destination of the serialization

SetDouble(double)

Sets the value: 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 SetDouble(double l)

Parameters

l double

The new value

SetObjectData(IJsonReadData)

Restores the resource id, the value and the setting name from the JSON serialization (IJsonSerialize). The value is then held by the entry itself, no object is connected.

public virtual void SetObjectData(IJsonReadData data)

Parameters

data IJsonReadData

The data to read from

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

text string
val double

Returns

bool

ValueToText(double)

Returns the text representation of the value.

protected override string ValueToText(double val)

Parameters

val double

Returns

string

Events

GetDoubleEvent

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 DoubleProperty.OnGetValue instead")]
public event DoubleProperty.GetDoubleDelegate GetDoubleEvent

Event Type

DoubleProperty.GetDoubleDelegate

LabelChangedEvent

Obsolete and never raised; use LabelTextChanged instead.

[Obsolete("use delegate DoubleProperty.LabelTextChanged instead")]
public event DoubleProperty.LabelChangedDelegate LabelChangedEvent

Event Type

DoubleProperty.LabelChangedDelegate

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 DoubleProperty.LockedChanged instead")]
public event EditableProperty<double>.LockedChangedDelegate LockedChangedEvent

Event Type

EditableProperty<double>.LockedChangedDelegate

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 DoubleProperty.ModifyWithMouse instead")]
public event ModifyWithMouseDelegate ModifyWithMouseEvent

Event Type

ModifyWithMouseDelegate

SetDoubleEvent

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 DoubleProperty.OnSetValue instead")]
public event DoubleProperty.SetDoubleDelegate SetDoubleEvent

Event Type

DoubleProperty.SetDoubleDelegate