Hello Tonny,
regarding the first question: the error code indicates a type mismatch with the '+' operator. When you double click on the message, the corresponding location will be shown in the Code Editor. I suppose your array is declared with float as data type. With the + operator you intend to add an integer 1 to it. Chora consideres such combinations are problematic because they may result in two different values. To avoid such situations, Chora reports this as an error. In fact, compared with C, Java, etc. Chora is much more stricter.
To disable the error message and to satisfy the Chora compiler, you have to ensure that the operands are of the matching type. In your case try to change the integer 1 to float 1.0 (with the .0). Also what I see from the screenshot is that the effect of the for-loop is limited to the line number 6 only. If you want all values from the array to be displayed you need to enclose the lines belonging to the for-loop within a block - exactly as you do in C, Java, etc. Try following:
var int32 inx;
var float caption;
for ( inx = 0; inx < Application::Device.numbers.size; inx = inx + 1 )
{
Application::Device.numbers[inx] = Application::Device.numbers[inx] + 1.0;
trace "Execute data()", caption;
}
Regarding your second question: I do not really understand your application case. I suppose, you want the slider to change a value within the array, right? In such case:
Step 1: Within the component where you have the slider add a slot method.
Step 2: Connect the slot method to the property OnChange of the slider.
Step 3: Implement the slot method as demonstrated below:
// Change the value in the array element #0
numbers[0] = Slider.CurrentValue;
I hope it helps you further.
Best regards
Paul Banach