Page 2 of 2

Re: "..." in the filelist-rows

Posted: 23 Feb 2016 14:55
by TheQwerty
This is a bit tricky, but it can be done.

SetColumns can get you the column width in pixels, allowing you to adjust what is returned based on that width. You'll need to play around a bit to figure out how the pixel width relates to your desired output lengths but that'll just take a little bit of trial and error.

This will not automatically adjust to resizing the column - and likely never will because it would mean triggering the script repeatedly during the resizing - but you can force the column to refresh after changing the column width to have it take on the new format. (Right-Click > Refresh Column or just refresh the list with F5, etc.)

Code: Select all

function GetColumnWidth($column) {
  return GetToken(FormatList(SetColumns(,2),'f', ',', "$column.*"), 2, '.',, 2);
}

// This needs to be the name that XY uses to identify the column.
// For Custom Columns that is 'Custom #'.
$width = GetColumnWidth('Custom 3');
if ($width < 40) {
  $fmt = 'yyyy';
} elseif ($width < 60) {
  $fmt = 'yyyy.mm';
} elseif ($width < 100) {
  $fmt = 'yyyy.mm.dd';
} else {
  $fmt = 'yyyy.mm.dd hh:nn:ss';
}
return Report("{Modified $fmt}", <cc_item>);

Re: "..." in the filelist-rows

Posted: 23 Feb 2016 21:24
by DaniHausmann
That kind of scripting is too much stuff for me. I give up. And pressing F5 is more horror than the '...'.

Here is another idea: :beer:
You can change the print-function for the list-cells. If the celltext ends with a NoPointsFlag (for example: char(#9) or char(#0)), the program does not print the '....'. Later in a script i could make the celltext one character longer with the NoPointsFlag.

Now the functions looks like this:
print(celltext);
if (width(celltext) > width(column)) then print('...');


Later it would look like this:
print(celltext);
if (width(celltext) > width(column)) and (LastChar(celltext) <> NoPointsFlag) then print('...');


The word "NoPointsFlag" sounds beautiful. That should be enough reason to realize it. The idea is good too.

Please give it to me. I am ill with the points.....................