Table of Contents

Class StringProperty

Namespace
CADability.UserInterface
Assembly
CADability.dll

Property page entry to edit a string, e.g. the name of an object or the text of a Text. The value is connected to a property of an object via reflection or via the OnGetValue and OnSetValue delegates; the text is taken as it is typed.

public class StringProperty : EditableProperty<string>, IPropertyEntry, IShowProperty, IConstructProperty, ISerializable
Inheritance
StringProperty
Implements
Inherited Members

Constructors

StringProperty(object, string, string)

Creates the entry for a string property of ObjectWithProperty, which is accessed via reflection.

public StringProperty(object ObjectWithProperty, string PropertyName, string resourceId)

Parameters

ObjectWithProperty object

The object holding the property

PropertyName string

Name of the string property of that object

resourceId string

Resource id of the label text

StringProperty(SerializationInfo, StreamingContext)

Constructor for the legacy binary deserialization (ISerializable); only the resource id is restored. Currently only needed by the debugger visualizer.

protected StringProperty(SerializationInfo info, StreamingContext context)

Parameters

info SerializationInfo

Provides the data

context StreamingContext

The source of the deserialization

StringProperty(string, string)

Creates the entry with an initial value and no connected object. The entered text can be queried with GetString() or received via OnSetValue.

public StringProperty(string stringValue, string resourceId)

Parameters

stringValue string

The initial text

resourceId string

Resource id of the label text

Properties

NotifyOnLostFocusOnly

Obsolete: sets DeferUpdate, i.e. whether the text is passed on only when editing ends rather than with every keystroke.

[Obsolete("use DeferUpdate instead")]
public bool NotifyOnLostFocusOnly { set; }

Property Value

bool

Methods

GetString()

Returns the current text, taken from the connected object (or OnGetValue) when there is one.

public string GetString()

Returns

string

The current text

SetString(string)

Sets the text, passes it on to the connected object (or OnSetValue) and refreshes the entry.

public void SetString(string val)

Parameters

val string

The new text

TextToValue(string, out string)

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 string val)

Parameters

text string
val string

Returns

bool

ValueToText(string)

Returns the text representation of the value.

protected override string ValueToText(string val)

Parameters

val string

Returns

string

Events

GetStringEvent

Obsolete: adding a handler sets OnGetValue to call it, removing one clears the delegate. Only a single handler is supported.

[Obsolete("use delegate StringProperty.OnGetValue instead")]
public event StringProperty.GetStringDelegate GetStringEvent

Event Type

StringProperty.GetStringDelegate

SetStringEvent

Obsolete: adding a handler sets OnSetValue to call it, removing one clears the delegate. Only a single handler is supported.

[Obsolete("use delegate StringProperty.OnSetValue instead")]
public event StringProperty.SetStringDelegate SetStringEvent

Event Type

StringProperty.SetStringDelegate

StringChangedEvent

Obsolete: adding a handler sets OnSetValue to call it (without the value; query GetString()), removing one clears the delegate. Only a single handler is supported.

[Obsolete("use delegate StringProperty.OnSetValue instead")]
public event StringProperty.StringChangedDelegate StringChangedEvent

Event Type

StringProperty.StringChangedDelegate