Integer Method Call

A Integer Method Call is a Method Call that returns an Integer 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 ReadOnlyIntegerProperty ComposedInteger => CalculatedIntegerProperty(ComposeTheInteger);

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(ComposedInteger),
                },
            },
            CodeContent
        },

        new HBox(alignH:AlignH.Fill)
        {
            EmptySpace.FillH,
            new Button(Close())
        }
    };
}


private IntegerMethodCall ComposeTheInteger()
{
    return IntegerMethod(() => new Body
    {
        new If(Number.IsEqualTo(1))
        {
            new Return(278)
        },

        ...

        new ElseIf(Number.IsEqualTo(10))
        {
            new Return(-18)
        },
        new Else
        {
            new Return(0)
        }
    });
}

 

Explanation of the code example

  • In this example, in line 2, the private property ComposedInteger is filled with the return value of the Integer Method Call with the name ComposeTheInteger().
  • 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: