Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

Author Topic: LAMW-How do I get the width and height of a character?  (Read 487 times)

lazpas

• Jr. Member
• Posts: 58
LAMW-How do I get the width and height of a character?
« on: September 19, 2022, 02:47:47 am »
How do I get the width and height of a character?

Thanks.

jmpessoa

• Hero Member
• Posts: 2153
Re: LAMW-How do I get the width and height of a character?
« Reply #1 on: September 19, 2022, 03:15:51 am »

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

lazpas

• Jr. Member
• Posts: 58
Re: LAMW-How do I get the width and height of a character?
« Reply #2 on: September 19, 2022, 03:26:37 am »

rsu333

• Full Member
• Posts: 102
Re: LAMW-How do I get the width and height of a character?
« Reply #3 on: September 19, 2022, 03:51:37 pm »
Try demo

jmpessoa

• Hero Member
• Posts: 2153
Re: LAMW-How do I get the width and height of a character?
« Reply #4 on: September 20, 2022, 01:20:17 am »
Quote
Try demo

Yes! demos "AppListViewDemo2"  and ""AppListViewDemo7"   are about "drawing" items.....

But, I don't know exactly what  @lazpaz need....
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

lazpas

• Jr. Member
• Posts: 58
Re: LAMW-How do I get the width and height of a character?
« Reply #5 on: September 20, 2022, 02:28:28 am »
Hi,

I want to know the width of one character, and then calculate the width of all characters. When the width of all characters is greater than the width of the control, intercept the specified number of characters and add "..." after the characters.

Thanks

jmpessoa

• Hero Member
• Posts: 2153
Re: LAMW-How do I get the width and height of a character?
« Reply #6 on: September 20, 2022, 11:25:32 pm »

Done!

jListView: New "ItemTextEllipsis" property!

Now You can try:

Code: Pascal  [Select][+][-]
1.    jTextView1.SetEllipsize(emEnd);
2.    jTextView1.Text:= 'Johann Wolfgang von Goethe was a German poet, playwright, novelist, scientist, statesman, theatre director, and critic.' ;
3.
4.    jListView1.ItemTextEllipsis:= True;
5.    jListView1.Add('Johann Wolfgang von Goethe was a German poet, playwright, novelist, scientist, statesman, theatre director, and critic.');
6.    jListView1.ItemTextEllipsis:= False;
7.
8.
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

lazpas

• Jr. Member
• Posts: 58
Re: LAMW-How do I get the width and height of a character?
« Reply #7 on: September 22, 2022, 02:42:18 am »
Thank you very much,jmpessoa.

I will try