Page 1 of 1
Write component property to sd-card
Posted: Tue Sep 10, 2024 2:24 pm
by stefan.erni
Hi Ben
I would like to write the component propertis at the beginning of the Excel file.
Append string works with a text, but not with the build in function created string.
Does it work the way I program it?
Re: Write component property to sd-card
Posted: Wed Sep 11, 2024 11:57 am
by stefan.erni
It's working in AppDevelopper
but not in the ESP32 program

- 2024-09-11_08-56-07.PNG (128 KiB) Viewed 7995 times

- 2024-09-11_09-00-02.PNG (203.07 KiB) Viewed 7995 times
Re: Write component property to sd-card
Posted: Wed Sep 11, 2024 5:30 pm
by BenR
Hello,
Hmm this one is a little tricky as you can't directly reference component properties.
One trick would be to do the following.
1) Click on a blank area of the panel to select the panel and in the properties window create properties to hold the values
2) Add a macro to the Compile Start event and to the Simulation Start event, this can be the same macro for both events
3) Inside the Compiler Start macro copy the value of the property you want to your local property
4) Reference the local properties in your program as you would variables
That should work.
I've included an example.
Let us know how you get on.
Re: Write component property to sd-card
Posted: Thu Sep 12, 2024 9:38 am
by stefan.erni
Hi Ben
I have tried but I probably only get the index of the switch and not the text of the property

- 2024-09-12_10-31-54.PNG (61.66 KiB) Viewed 7952 times
Re: Write component property to sd-card
Posted: Fri Sep 13, 2024 1:22 pm
by BenR
Hello,
GetValue returns the property value, if instead you want the label string then use the GetListItem function to get the label assigned to the value.

- PropertyDemo.jpg (54.71 KiB) Viewed 7798 times
Re: Write component property to sd-card
Posted: Fri Sep 13, 2024 3:45 pm
by stefan.erni
Hi Ben
Yes this way is perfect.
Unfortunately working only in the simulation. I cannot compile to hex. There is a fail.

- 2024-09-13_15-59-32.PNG (86.89 KiB) Viewed 7756 times
Re: Write component property to sd-card
Posted: Fri Sep 13, 2024 4:09 pm
by BenR
Hello,
Compiling now. Could be the sim event macro is missing a return value and the ESP32 compiler is complaining about that.
Just add a calculation saying .Return = 1
Re: Write component property to sd-card
Posted: Fri Sep 13, 2024 4:27 pm
by stefan.erni
Hi Ben
I add but still fail compile to hex. Sim is always ok

- 2024-09-13_17-23-08.PNG (26.97 KiB) Viewed 7738 times

- 2024-09-13_17-23-31.PNG (68.73 KiB) Viewed 7738 times