String Method Call
Table of Contents
A String Method Call is a Method Call that returns a String Expression.
- See Methods for explanations of the basics and for Code examples and for the declaration of Method Calls.
See How to use Method Calls for general information on using Method Calls.
Code Example
private IntegerProperty Number => IntegerProperty(null, IntegerDefinition.GetInstance(IntegerSize.Integer, false, maxValue:10));
private ReadOnlyStringProperty ComposedString => CalculatedStringProperty(ComposeTheString);
protected override IUIElement CreateGui()
{
return new VBox
{
new HBox(alignH:AlignH.Fill, alignV:AlignV.Fill)
{
new GroupBox("example")
{
new VBox(2)
{
new Label("number (1 till 10):"),
new TextBox(Number),
new Label("calculated string:"),
new Label(ComposedString),
},
},
CodeContent
},
new HBox(alignH:AlignH.Fill)
{
EmptySpace.FillH,
new Button(Close())
}
};
}
private StringMethodCall ComposeTheString()
{
return StringMethod(() => new Body
{
new If(Number.IsEqualTo(1))
{
new Return("You typed One.")
},
...
new ElseIf(Number.IsEqualTo(10))
{
new Return("You typed Ten.")
},
new Else
{
new Return("Your have to choose a number from 1 till 10 :(")
}
});
}
Explanation of the code example
- In this example, in line 2, the private property
ComposedStringis filled with the return value of the String Method Call with the nameComposeTheString(). - This private property is then in line 19 displayed in a form, using
new Label. - This method is defined in lines 34-54.
Example of the result
A form like the one defined above, could look like this.
When nothing has been entered:

When 1 has been entered:

When 10 has been entered:
