Page 1 of 1

[Solved] CC click - All entries vanish?

Posted: 25 Nov 2024 16:03
by highend
Current beta.

I'm not a 100% sure if this is a bug...
If it's not, I'll move it^^

Add this CC and a column for it.
Shift + Left click one of its cells, choose "Edit modified date..."
Change the date, e.g. just the hour of it
All entries of that CC column go blank?

Code: Select all

    $curDate = filetime(<cc_item>, "m");
    $newDate = $curDate;
    if (<cc_trigger> == 5) { // Shift 4 + Left click 1
        $menu = <<<>>>
Edit modified date...|e
        >>>;
        $selected = popupmenu($menu, 6:=<crlf>, 7:="|");
        if ($selected == "e") {
            $newDate = input("Edit date", , $curDate, "e", $curDate);
            if ($newDate != $curDate) {
                timestamp "m", $newDate, <cc_item>;
            }
        }
    }
    return $newDate;

Re: CC click - All entries vanish?

Posted: 25 Nov 2024 16:40
by admin
Sounds weird. I'll look into it tomorrow.

Re: CC click - All entries vanish?

Posted: 25 Nov 2024 18:53
by highend
Script a bit simplified and here is a .gif that shows the behavior.
Animation.gif

Re: CC click - All entries vanish?

Posted: 26 Nov 2024 11:09
by admin
The problem is recursion. The CC script calls timestamp, timestamp triggers a list refresh, the list refresh triggers the CC script, and so on. XY does not explode, it gracefully exits the recursive abyss, but the column cannot be populated.

Re: CC click - All entries vanish?

Posted: 26 Nov 2024 11:21
by highend
Any way to handle this so it'll work as expected?

Even

Code: Select all

setting "AllowRecursion", 0;
doesn't change the behavior...

Re: CC click - All entries vanish?

Posted: 26 Nov 2024 11:28
by admin
You mean setting "AllowRecursion", 1;, it makes a difference but you won't like it.

Re: CC click - All entries vanish?

Posted: 26 Nov 2024 11:39
by highend
Yeah, sorry, 1 != 0.

So even if we get a new command that hinders e.g. timestamp to make the refresh we'd be stuck with the old value shown, not the modified one?

Re: CC click - All entries vanish?

Posted: 26 Nov 2024 11:52
by admin
The CC column would be updated, but not the Modified column.

Re: CC click - All entries vanish?

Posted: 26 Nov 2024 11:56
by highend
At least it would be better than the current situation ;)

Re: CC click - All entries vanish?

Posted: 26 Nov 2024 12:17
by admin
I tried something and it works well so far. In the next beta insert this line right before the timestamp line: setting "AllowRecursion", 2; It will allow recursion and reset the <cc_trigger> variable to zero so the flow will not re-enter the recursive part of the code.

Re: CC click - All entries vanish?

Posted: 26 Nov 2024 13:34
by highend

Code: Select all

setting "AllowRecursion", 2;
fixes the issue :tup: