Page 1 of 1

list sorted by name plus "show grid"

Posted: 10 Nov 2017 19:31
by glusberg
When looking at a list, sorted by name, and "show grid" turned on, the color background changes whenever the first word changes. Could I change it to two words (i.e.: first-name Last-name)?
I suspect this is possible, but am unable to come up with keywords that would lead me to the answers (or to ask the question correctly, i guess).
Thanks!

Re: list sorted by name plus "show grid"

Posted: 10 Nov 2017 19:54
by highend
No clue what you mean...

Maybe: Configuration | Colors and Styles | Styles | Grid style
Zebra Stripes: Alternate Rows (2)?

Re: list sorted by name plus "show grid"

Posted: 10 Nov 2017 20:02
by glusberg
( i was afraid i wasn't able to be clear, sorry)
I do want the zebra stripes. Right now, the zebra changes when the first word on the filename changes (grouping all files that start with Chris, and changing when the first word changes to Chrissie). What I would like is for the first two words to be considered. So that there would be a break (zebra change?) between "Chris Womersley" and "Chris Wooding".
Makes more sense now? I'm not sure it does...

Re: list sorted by name plus "show grid"

Posted: 10 Nov 2017 20:32
by highend
I guess that's not possible. The "Smart Names" entries for "Grid Style" do not seem to
differentiate between more than the first word...

You could try to create a script that does set color filters to do this kind of logic...

Re: list sorted by name plus "show grid"

Posted: 10 Nov 2017 22:07
by glusberg
Nah. But thank you for trying.

Re: list sorted by name plus "show grid"

Posted: 10 Nov 2017 22:34
by highend
Just as an experiment:

Code: Select all

    $highlightedColor    = "000000,EDF3FE";
    $nonHighlightedColor = "000000,FFFFFF";

    $items = listpane(, , , <crlf>);
    $filter = ""; $color = $highlightedColor; $lastFirstTwoWords = "";
    while ($i++ < gettoken($items, "count", <crlf>)) {
        $item = gettoken($items, $i, <crlf>);
        $base = gpc($item, "base");
        // Get the first two words of a (base) item name
        $firstTwoWords = regexmatches($base, "^\w+( \w+)?");
        // Toggle colors if the next following item is different
        if ($firstTwoWords != $lastFirstTwoWords) {
            if ($color == $highlightedColor) { $color = $nonHighlightedColor; }
            else { $color = $highlightedColor; }
        }
        // Add to the filter
        $filter = $filter . "$item>$color||";
        $lastFirstTwoWords = $firstTwoWords;
    }
    $filter = trim($filter, "|", "R");
    colorfilter($filter);
Be careful, it will crash XY if the $filter get's too long (too many items) :mrgreen:

Will probably file a bug report for that...

Re: list sorted by name plus "show grid"

Posted: 20 Nov 2017 13:17
by admin
How many items crashed it?

Re: list sorted by name plus "show grid"

Posted: 20 Nov 2017 13:51
by highend
It seems it's (currently, not tested any limits further) not about the number of files
but it crashes on a specific file name...

Create an empty directory, put this file into it:

Code: Select all

[UTF-8].txt
Run the script. It crashes XY (even with the current beta in a fresh instance).

Just remove the 8 from the file name. No crash
Add the 8 again and remove the brackets. No crash

Re: list sorted by name plus "show grid"

Posted: 20 Nov 2017 13:59
by admin
That's exactly what I fixed in v18.50.0209. Don't tell me it crashes. It does not crash here.

Re: list sorted by name plus "show grid"

Posted: 20 Nov 2017 14:08
by highend
No crash in 209.

But there is another problem...

Create a folder named:

Code: Select all

Dokumente [1]
Put some test files in it

Run the script

The colorfilter won't get applied. It doesn't like the "[1]"
in the folder name.

With the same files in a folder named "Dokumente 1"
it works flawlessly

Re: list sorted by name plus "show grid"

Posted: 20 Nov 2017 14:13
by admin
Good thinking (which I assume was behind constructing this evil example :biggrin: )! Next version fixes that.