Propery Manager not loading saved values

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
medelec35
Valued Contributor
Posts: 2418
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 772 times
Been thanked: 831 times

Flowcode v11 Propery Manager not loading saved values

Post by medelec35 »

Hi Ben.
If it's my mistake I will move this topic to general
I would like to save an load property values within PC Developer deployed app.
After changing the property value running the app and selecting the save switch, I get the Are you sure you want to save prompt.
Select Stop, reload and run the app that will now have the original value, select Load switch and get the Are you sure you want to load prompt.
The Property does not change to the saved value, although its the correct value within the generate Config file.

Is Property Manager and CSV Read/Write compatible with Event APIs? As using within Ev_Initalise , Ev_Properties, Ev_ProjectClosedown etc causes a 0B blank config file or duplicated entries.
I'm trying to set up auto saving and loading of properties.
Attachments
Property Manager Test.fcpcd
(14.22 KiB) Downloaded 7 times
(view online)
Martin

medelec35
Valued Contributor
Posts: 2418
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 772 times
Been thanked: 831 times

Flowcode v11 Re: Propery Manager not loading saved values

Post by medelec35 »

Hi Ben.
As an experiment, I gave AI the Property Manager component to investigate, and produced an updated file very quickly, and it works!
Ai Stated:
Yes — I can see it directly in the PropertyManager.fcsx source, no guessing needed. It's a real bug in the component itself, in how it handles bare/root-level properties (ones registered without a Component:: prefix, like UpdateRate).

Here's the actual mismatch, line by line:

In RegisterProperty (line 390-392), the handle starts as Component.GetRoot(). If the property name you register has no :: in it at all (a bare property), the loop that would normally call Component.FindChild never runs, so Handles[NumProps] ends up storing the root panel's handle.

In Save (line 145), the check is Handles[.idx] == this. But this in this macro means PropertyManager1's own handle, not the root panel's handle. Since a bare property's stored handle is the root handle, not PropertyManager1's own handle, this comparison is always false for bare properties. So instead of writing the literal string this::UpdateRate,5, it falls through to the else branch and writes Tree.GetName(Handles[.Idx]) — the actual name of the root panel (e.g. Main::UpdateRate,5).

Then in Load (line 290), it reads that component-name token back and checks .SubStr != "this". Since the token is the panel's real name (not literally "this"), this is true, so it calls Component.FindChild(.Handle, .SubStr) — trying to find a child of root literally named the same as the root panel itself. That fails, because the root isn't a child of itself. .Handle comes out of that call invalid/wrong.

That broken handle is what then gets passed into Component.Property.SetValue(.Handle, .PropName, .SubStr) — targeting the wrong (or no) component, so the bare property never actually updates, even though the value in the file is correct.

So the fix on Flowcode's end would be either: compare Handles[.idx] == Component.GetRoot() in Save instead of == this, or have Load specifically special-case when the resolved handle equals root. Either way, this is a real, source-confirmed bug specific to bare/root-level registered properties
Attached is the update file an component without the icon.
Attachments
PropertyManager.fcpx
(3.92 KiB) Downloaded 6 times
PropertyManager.fcsx
(28.46 KiB) Downloaded 9 times
(view online)
Martin

WingNut
Posts: 286
Joined: Tue Jul 13, 2021 1:53 pm
Has thanked: 56 times
Been thanked: 43 times

Re: Propery Manager not loading saved values

Post by WingNut »

Hi Martin. For my curiosity, which Ai did you use?

N

medelec35
Valued Contributor
Posts: 2418
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 772 times
Been thanked: 831 times

Re: Propery Manager not loading saved values

Post by medelec35 »

Hi N.
I used the files posted here with Claude.
Claude then creates the .fcfx or .fcpcd files.
for .fcfx files, you will have to start with a blank file that is set to your current target as there are so many targets to choose from.
Like any AI Claude is not perfect, but has produced working components, embedded projects and PC Developer files that are complex and time consuming for us to create.
I have been impressed.
Martin

BenR
Matrix Staff
Posts: 2295
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 634 times
Been thanked: 842 times

Re: Propery Manager not loading saved values

Post by BenR »

Hi Martin,

Cool this is working though I can see the change and the only thing seems to be the use of the API Component.GetRoot instead of the "this" handle. I would have thought these would be identical but maybe not. I'll do some experimenting.

Either way I've pushed your change into the live component source.

edit. aha no it's the root of the current project not the root of the component. Great nice fix!

medelec35
Valued Contributor
Posts: 2418
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 772 times
Been thanked: 831 times

Re: Propery Manager not loading saved values

Post by medelec35 »

Thanks, Ben.
I'm not sure how it works, but it does.
I'm wondering if the AI makes things up to sound clever. :lol:
Martin

chipfryer27
Valued Contributor
Posts: 2107
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 469 times
Been thanked: 699 times

Re: Propery Manager not loading saved values

Post by chipfryer27 »

[quoteI'm wondering if the AI makes things up to sound clever.quote]

Not just AI... Me too....

chipfryer27
Valued Contributor
Posts: 2107
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 469 times
Been thanked: 699 times

Re: Propery Manager not loading saved values

Post by chipfryer27 »

I'm wondering if the AI makes things up to sound clever.
Not just AI... Me too....

medelec35
Valued Contributor
Posts: 2418
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 772 times
Been thanked: 831 times

Re: Propery Manager not loading saved values

Post by medelec35 »

chipfryer27 wrote:
Tue Sep 15, 2026 9:08 pm
Not just AI... Me too....
chipfryer27 wrote:
Tue Sep 15, 2026 9:08 pm
Not just AI... Me too....
:lol:
Not just once, but twice! :lol:
BenR wrote:
Tue Sep 15, 2026 5:17 pm
edit. aha no it's the root of the current project not the root of the component. Great nice fix!
I'm glad I ....ermm I mean AI was able to help.
Martin

medelec35
Valued Contributor
Posts: 2418
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 772 times
Been thanked: 831 times

Re: Propery Manager not loading saved values

Post by medelec35 »

Hi Ben.
Added an event timer to delay by 100ms, but still the same.
Perhaps Code should be slightly different?

Same with PropertyManger, if there is a way around it?
Attachments
csv save property test Timer.fcpcd
(15.99 KiB) Downloaded 1 time
(view online)
Martin

Post Reply