Recent

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

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • 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

  • Hero Member
  • *****
  • Posts: 532
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 10 &11, Ubuntu 21+ - fpc 3.0.4, IDE 2.0 general releases

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • 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: 1080
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.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

 

TinyPortal © 2005-2018