Class ConstructAction.MultipleChoiceInput
- Namespace
- CADability.Actions
- Assembly
- CADability.dll
Defines an input object for an action derived from ConstructAction. This input object extpects the input of a integer value. The integer value is entered in a editbox and/or with an up/down control. Pressing enter or TAB or clicking the mouse proceeds to the next input object.
public class ConstructAction.MultipleChoiceInput : ConstructAction.InputObject
- Inheritance
-
ConstructAction.MultipleChoiceInput
- Inherited Members
Constructors
MultipleChoiceInput(string, string)
Constructs a MultipleChoiceInput object with no initial value
public MultipleChoiceInput(string resourceId, string resourceIdValues)
Parameters
resourceIdstringthe resource id to specify a string from the StringTable. ResourceId+".Label": the Label left of the edit box. ResourceId+".ShortInfo": a short tooltip text ResourceId+"DetailedInfo": a longer tooltip text.
resourceIdValuesstringresource id of the strings for the values starting with a delimiter and seperated by the same delimiter e.g. "|first|second|third"
MultipleChoiceInput(string, string, int)
Constructs a MultipleChoiceInput object with no initial value
public MultipleChoiceInput(string resourceId, string resourceIdValues, int StartValue)
Parameters
resourceIdstringthe resource id to specify a string from the StringTable. ResourceId+".Label": the Label left of the edit box. ResourceId+".ShortInfo": a short tooltip text ResourceId+"DetailedInfo": a longer tooltip text.
resourceIdValuesstringresource id of the strings for the values starting with a delimiter and seperated by the same delimiter e.g. "|first|second|third"
StartValueintthe initial value
MultipleChoiceInput(string, string[], int)
Constructs a MultipleChoiceInput whose choices are given directly as strings instead of being taken from the string table.
public MultipleChoiceInput(string resourceId, string[] values, int StartValue)
Parameters
resourceIdstringthe resource id to specify a string from the StringTable. ResourceId+".Label": the Label left of the edit box. ResourceId+".ShortInfo": a short tooltip text ResourceId+"DetailedInfo": a longer tooltip text.
valuesstring[]the texts of the choices, in the order in which they are offered
StartValueint0-based index of the initially selected choice
Fields
DefaultChoice
Sets a DefaultInteger, which should be a static value, that carries the last input value of this vector to the next instantiation of the action.
public ConstructAction.DefaultInteger DefaultChoice
Field Value
Properties
CapturesMouse
If true, selecting this input in the property grid makes it the current input of the action, like a selected ConstructAction.DoubleInput or ConstructAction.GeoPointInput: mouse moves in the view then go to this input, which ignores them or passes them on to ForwardMouseInputTo. If false (the default), the input that was current before keeps receiving the mouse input while this one is selected.
public bool CapturesMouse { get; set; }
Property Value
Choice
The 0-based index of the currently selected choice (into the choices given to the constructor or to SetChoices(string[])). It is updated by the user's selection and by ForceValue(int); each change raises InputValueChangedEvent. It cannot be set directly, use ForceValue(int).
public int Choice { get; }
Property Value
ForwardMouseInputTo
Mouse input should be forwarded to another input object and only processed by this input, when the other input object is fixed.
public object ForwardMouseInputTo { get; set; }
Property Value
ReadOnly
If set to true, the user cannot type in a value for this input. Default: false;
public override bool ReadOnly { get; set; }
Property Value
Methods
ForceValue(int)
Selects the choice with index val as if the user had selected it: SetChoiceEvent
is raised (a handler must be attached), Choice is set and the dependent properties of the action
are refreshed. Does nothing when the input is ReadOnly.
public void ForceValue(int val)
Parameters
valint0-based index of the choice to select
SetChoices(string[])
Replaces the choices this input offers, also while the action is running, e.g. to leave out choices that don't apply in the current situation (issue #254). Choice is an index into the new choices. The selected entry is kept if its text is among the new choices. Otherwise the first choice is selected and SetChoiceEvent is raised with it, as if the user had selected it.
public void SetChoices(string[] choices)
Parameters
choicesstring[]the texts of the new choices, at least one
SetError(string)
Shows errorMessage as an error on the entry of this input in the property page, e.g. when
the value entered by the user is not acceptable for the action. The default implementation does nothing; inputs
with an edit field forward the message to their property entry, inputs without one ignore it.
public override void SetError(string errorMessage)
Parameters
errorMessagestringThe text to display, or an empty string to clear the error
Events
GetChoiceEvent
Provide a method here, if the integer value not only depends from this input, but is also modified by other means.
public event ConstructAction.MultipleChoiceInput.GetChoiceDelegate GetChoiceEvent
Event Type
InputValueChangedEvent
Event will be rasied if the Length property changed
public event ConstructAction.MultipleChoiceInput.InputValueChangedDelegate InputValueChangedEvent
Event Type
SetChoiceEvent
Provide a method here to get the result of this input (and modify your object)
public event ConstructAction.MultipleChoiceInput.SetChoiceDelegate SetChoiceEvent