Column autosize idea...

Features wanted...
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Column autosize idea...

Post by TheQwerty »

From a user's perspective it is hard to believe this is a bigger can of worms than custom column scripts.

Which we could use to achieve this but:
1) It wastes a column.
2) It cannot run when the folder is empty.
3) Requires ugliness to limit it to running once for the folder.


Another option would be to define a folder PFA (after enabling the PFADefaultOpenFolders tweak), but this has a limited scope of only triggering when opening (enter/dbl-click) in the list pane.

highend
Posts: 14953
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Column autosize idea...

Post by highend »

Just for a simple example (it requires the "Name" column at the first position!):
Ofc this only works when you enter a folder^^

The script:
Create a new .xys file in your <xyscripts> folder and save it with the following script as the content:

Code: Select all

    $pane      = get("Pane");
    $visCols   = setcolumns(, 2);
    $paneWidth = gettoken(controlposition("L $pane", 1), 3 , "|") - 25; // 25 = Width of Nr. column

    // Get accumulated size of all columns apart from "Name"
    $otherColsWidth = 0;
    while ($i++ < gettoken($visCols, "count", ",")) {
        $column = gettoken($visCols, $i, ",");
        if (regexmatches($column, "(^|,)Name\.")) { continue; }
        $otherColsWidth = $otherColsWidth . "+" . gettoken($column, 2, ".");
    }
    setcolumns("Name." . $paneWidth - eval($otherColsWidth), 4);
Or if you're hardcore enough use this simple oneliner instead *g*:
It's a condensed version of the script above that uses regexmatches to get the sizes...

Code: Select all

setcolumns("Name." . gettoken(controlposition("L ". ((get("Pane") == 1) ? 1 : 2), 1), 3 , "|") - 25 - eval(gettoken(regexreplace(regexmatches(setcolumns(, 2), "\.\d+(,|$)", "+"), "(\.|,)"), 2, "+", , 2)), 4);

Let's say you named it "ColumnSetup.xys"

Create a new PFA entry:
Put it into the first position

Code: Select all

\>::load "ColumnSetup.xys";
This should put all your visible columns (apart from name) to the right side of the current pane while giving the name column the max. possible size.
One of my scripts helped you out? Please donate via Paypal

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Column autosize idea...

Post by TheQwerty »

Tip: When using a PFA script to adjust your columns, you'll likely want to ensure you define a default FVS.

This is less important if you're only adjusting the Name's width (as in highend's script), but you'll quickly see the need if you try using that script to change visible columns or their order.

DmFedorov
Posts: 716
Joined: 04 Jan 2011 16:36
Location: Germany

Re: Column autosize idea...

Post by DmFedorov »

highend wrote:I think that user defined rules (which are bound to folder view settings) are the right way to handle this dilemma.
Let the user decide how he wants to handle column sizes.

Sizes in % of visible area (depending on single or dual list view), in pixels together with priorities when what has to shrink / expand...
This can be done automatically without scripts: when we save the Folder view settings, the layout can be converted into percentages.

The only thing that should be provided in this case is the minimum width of the column.
When we will reduce the size of the panel, then at some point one of the columns reaches this minimum value.
And from that moment the column width should be tight, that is, in pixels.

In addition, some columns may be set rigidly, and the rest will be converted into percentages.
"Somebody" (of course Don) must to find more acceptable option.
If take the second option, I would put a tick "Recalculate other sizes in percentages" or something similar.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Column autosize idea...

Post by TheQwerty »

TheQwerty wrote:
highend wrote:3. That'll be interesting :)
So far, very weird.
2016-05-19 073414.png
Just a quick update.... I'm still using a similar arrangement* (to that pictured) and generally it works okay.

There are some pesky annoyances though:
1) It is absolutely terrible when using the Path column, because it generally pushes the Name column out of view and requires scrolling. I could alleviate this by putting Name left of Path but I have a much harder time consolidating the information from the two columns when doing that and cannot stand the increase in cognitive load.

2) It makes tasks involving the tree/catalog and items more difficult. Fortunately for me I make seldom use of the tree and my catalog items don't require dropping items onto them which eases things.

3) It honestly still feels a little odd and disconnected - more time might lessen this so I'm going to continue the experiment a while longer.


* My visible columns are now: Modified,Created,Size,Custom 2,Label,Tags[,Path],Name
I don't make heavy use of Labels and Tags so that is frequently just empty space, but it acts as a nice breathable buffer.

kunkel321
Posts: 664
Joined: 10 Jun 2012 03:45
Location: Near Seattle

Re: Column autosize idea...

Post by kunkel321 »

I was going to reply to this in order to bump the topic to the top. Upon reviewing the posts though, I found the excellent code solutions that Highend posted (almost 5 years ago!). Sorry for missing that somehow Highend, and thanks or the scripts!

I just now used the "one-liner" one and pasted it into a 'Custom Event Action' for double-clicking on the line numbers. It works like a charm! :ugeek:

So now, for example, if I'm in single-pane mode, browsing ebooks (which have huge file names), I can double-click the line numbers and widen the name column. If I go to dual-pane mode and want to shrink the name column again, I no longer have to do a horizontal-scroll in order to access the grab-spot between the name and ext column headers... Just double-click the line number area again.

Good stuff!
ste(phen|ve) kunkel
Scaling: Main monitor 125%, Secondary monitor on the right 100%
OS: Win 10. XYplorer version: Latest beta, unless specified.

admin
Site Admin
Posts: 66348
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Column autosize idea...

Post by admin »

Are you aware that this always worked for > 10 years without CEA? :biggrin: In this case CEA just added the option to turn it off.

kunkel321
Posts: 664
Joined: 10 Jun 2012 03:45
Location: Near Seattle

Re: Column autosize idea...

Post by kunkel321 »

admin wrote: 14 Feb 2021 12:31 Are you aware that this always worked for > 10 years without CEA? :biggrin: In this case CEA just added the option to turn it off.
It seems way more intuitive to have it triggered from the line numbers area though...
ste(phen|ve) kunkel
Scaling: Main monitor 125%, Secondary monitor on the right 100%
OS: Win 10. XYplorer version: Latest beta, unless specified.

admin
Site Admin
Posts: 66348
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Column autosize idea...

Post by admin »

Oh, I meant "Double-click on line numbers header". That's the one that was always there.

Whatever, I love this feature. There is nothing I double-click more often.

Post Reply