Home » U++ Library support » RichText,QTF,RTF... » Text wrapping in QTF Table
Text wrapping in QTF Table [message #56492] |
Fri, 19 March 2021 06:23 ![Go to next message Go to next message](theme/default/images/down.png) |
![](https://www.ultimatepp.org/forums/images/custom_avatars/34424.gif) |
Pradip
Messages: 109 Registered: February 2019 Location: India
|
Experienced Member |
|
|
Hi guys,
I'm trying to make a QTF table, and it's needed to have all rows with exactly same row height, without wrapping Strings in the cells but truncating and probably adding an ellipsis character. I found DrawTextEllipsis() routine but not sure how could I use it in QTF.
Any ideas?
Regards,
Pradip
[Updated on: Fri, 19 March 2021 06:23] Report message to a moderator
|
|
|
|
|
Re: Text wrapping in QTF Table [message #56530 is a reply to message #56529] |
Mon, 22 March 2021 07:58 ![Go to previous message Go to previous message](theme/default/images/up.png) ![Go to next message Go to next message](theme/default/images/down.png) |
![](https://www.ultimatepp.org/forums/images/custom_avatars/3.png) |
mirek
Messages: 14003 Registered: November 2005
|
Ultimate Member |
|
|
Pradip wrote on Mon, 22 March 2021 06:38Yesss, I had started working in that line! Thanks a lot Mirek!
I think you meant to measure the width, not height, with GetWidth(), I've seen this works! I'm planning to measure the width of the intended ellipsis character as well and shorten the text and add the ellipsis to fit in the cell width. It will suffice as long as it works, needn't be too elegant ![Very Happy](images/smiley_icons/icon_biggrin.gif)
I really meant Height. I guess width will work too, but maybe less reliably and more complicated.
Quote:
But how to implement the binary search with log(len(text)) (which I think will save few iterations)?
Think of it as function - the parameter is the number of characters you have to remove. This goes from 0 to len(text).
To maximize it, you start at len/2. If it fits, the correct number is in len/2, len range. If not, in 0 to len/2. Rinse and repeat...
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sun Sep 01 07:17:21 CEST 2024
Total time taken to generate the page: 0.01460 seconds
|