Recent

Author Topic: How to shorten full path names?  (Read 4966 times)

Bart

  • Hero Member
  • *****
  • Posts: 4515
    • Bart en Mariska's Webstek
Re: How to shorten full path names?
« Reply #15 on: September 30, 2021, 10:01:03 pm »
I was playing around with MinimizeName but it only gives me the file name. Is there some undocumented flag I need to set to get results like everyone (and help) is showing? 

Why don't you just look at it's sourcecode.
It's a pretty straightforward function.

Bart

mas steindorff

  • Sr. Member
  • ****
  • Posts: 468
Re: How to shorten full path names?
« Reply #16 on: October 01, 2021, 01:28:01 am »
Your right, but I got it in my head the parameter was the string length and the MinimizeName() was a quick, simple function display aid.  The help did not suggest I was in error either:
"This function will return a shortened version of FileName, so that it fits on the given MaxWidth."   the word "pixels" does not even show up anywhere on the help page.

When I looked back at the example code posted here (after wp's correction) It was clear that I needed not only to pass the tcanvas of the display area but I also needed to do the Tcanvus math the function could have done itself (in a world where all characters are the same != real world).

Mas
   
windows 7/10 - laz 2.0 / 1.2.6 general releases

Bart

  • Hero Member
  • *****
  • Posts: 4515
    • Bart en Mariska's Webstek
Re: How to shorten full path names?
« Reply #17 on: October 01, 2021, 09:52:19 am »
Your right, but I got it in my head the parameter was the string length and the MinimizeName() was a quick, simple function display aid.  The help did not suggest I was in error either:
"This function will return a shortened version of FileName, so that it fits on the given MaxWidth."   the word "pixels" does not even show up anywhere on the help page.

Please file a bugreport if the documentation is unclear.
Don Siders can maybe look at it then.

Bart

dsiders

  • Hero Member
  • *****
  • Posts: 538
Re: How to shorten full path names?
« Reply #18 on: October 01, 2021, 08:06:33 pm »
Your right, but I got it in my head the parameter was the string length and the MinimizeName() was a quick, simple function display aid.  The help did not suggest I was in error either:
"This function will return a shortened version of FileName, so that it fits on the given MaxWidth."   the word "pixels" does not even show up anywhere on the help page.

Please file a bugreport if the documentation is unclear.
Don Siders can maybe look at it then.

Bart

Corrected in 736e71078e. Thanks.
Lazarus 2.0.12, 2.2.0-RC2, 2.3.0 (Git) / FPC 3.2.0, 3.2.2 / x86-win64 / Windows 8.1

 

TinyPortal © 2005-2018