[Lazarus] Donate function ShortenStringEx to LCL

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Donate function ShortenStringEx to LCL

Free Pascal - Lazarus mailing list
I want to donate this func. it can truncate text on canvas with 3 modes:
dots at begin/ at middle of text/ at end of text. Tested in ATTabs demo.
Code--

https://github.com/Alexey-T/ATTabs/blob/master/attabs/attabs.pas#L894

char $2026 is ellipsis. Can also use '...' or '..'

--
Regards,
Alexey Torgashin

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Donate function ShortenStringEx to LCL

Free Pascal - Lazarus mailing list
On Thu, Dec 6, 2018 at 12:40 PM AlexeyT via lazarus
<[hidden email]> wrote:
> I want to donate this func. it can truncate text on canvas with 3 modes:
> dots at begin/ at middle of text/ at end of text. Tested in ATTabs demo.
> Code--
>
> https://github.com/Alexey-T/ATTabs/blob/master/attabs/attabs.pas#L894

Why is there :
  S:= UTF8Decode(Text);
  ...
  Result:= UTF8Encode(S);

Please also look at function ShortDisplayFilename() in unit IDEProcs.
It should be moved to LazFileUtils.

Juha
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Donate function ShortenStringEx to LCL

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Am 06.12.2018 um 11:40 schrieb AlexeyT via lazarus:
> I want to donate this func. it can truncate text on canvas with 3
> modes: dots at begin/ at middle of text/ at end of text. Tested in
> ATTabs demo. Code--
>
> https://github.com/Alexey-T/ATTabs/blob/master/attabs/attabs.pas#L894
>
> char $2026 is ellipsis. Can also use '...' or '..'


Except for more flexible positioning of the '...', this is already
available as MinimizeName in FileCtrl, or painting text with
TCanvas.TextRect having its TextStyle.EndEllipsis = true.

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Donate function ShortenStringEx to LCL

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list

> Why is there :
>    S:= UTF8Decode(Text);
>    ...
>    Result:= UTF8Encode(S);
Seems it can be just "S:= Text", "Result:= S". but I had problems
without UTF8Encode/decode in my apps before. On Windows. It was FPC 2.6.4.
>
> Please also look at function ShortDisplayFilename() in unit IDEProcs.
It is more simple..

--
Regards,
Alexey

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Donate function ShortenStringEx to LCL

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list

> Except for more flexible positioning of the '...', this is already
> available as MinimizeName in FileCtrl
MinimizeName is different as I see. it uses ExtractFile* heavily for ex.
And no option DotsString.

--
Regards,
Alexey

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus