#ifdef 12 Posted June 27 (edited) I added dynamic (variable) row heights to TControlList and it works: But when resizing the form, the TControlList is terribly slow. @Serge_G I know you are a guru in this list. Please tell me how this can be fixed? Project1.zip Edited June 27 by #ifdef Share this post Link to post
Lajos Juhász 293 Posted June 27 The delay is due to the fact that whenever the users moves the mouse during the resizing the getCaption is executed. It costs time to calculate the required space for every item. Share this post Link to post
Brian Evans 105 Posted June 27 A scroll bar that is based on # of rows instead of height and only using enough labels to fill the visible area - swapping/drawing content, as necessary. The drawback is jumpy scrolling instead of smooth due to row at a time vs line at a time, but it is orders of magnitude faster. A lot more work to do it with a ControlList but most grids that support variable row height will do all it for you. Share this post Link to post
Serge_G 87 Posted July 2 Thanks for the guru, but actually I am on holidays (let say I prefer this term that a low activity scheme due to retirement 😉) Sure, I will have a look to your project. TControlList variable row heights was in my lengthy to-do list when retired but, as I really prefer FMX TListview this to-do item was in the bottom 10. 1 Share this post Link to post
Serge_G 87 Posted July 3 (edited) So, I have a look and test with 11.3 and 12.1 (entreprise) and no slow comportment found. So, for me, you got it.🙌 You said you use which version, community ok but last one (which is now a 11.2 or 11.3 version don't remember exactly ) ? As I see in your code, the key is the TControlList.FHeights I never found (for my discharge, I just deep dive in this component at the first occurrence and never run back in it) Edited July 3 by Serge_G Share this post Link to post
#ifdef 12 Posted July 3 1 hour ago, Serge_G said: So, I have a look and test with 11.3 and 12.1 (entreprise) and no slow comportment found. So, for me, you got it.🙌 You said you use which version, community ok but last one (which is now a 11.2 or 11.3 version don't remember exactly ) ? As I see in your code, the key is the TControlList.FHeights I never found (for my discharge, I just deep dive in this component at the first occurrence and never run back in it) Thank you for your kind words, but no, I don’t think I succeeded, that's why I decided to contact you personally 😞 I have 11.3 CE (28.0.48361.3236), you are right, but it probably should look and work the same on 12.1: the problem occurs when the form changes size. What about the "FHeights" - it's just a temporary storage of row sizes (like a cache or something). Share this post Link to post
#ifdef 12 Posted July 3 You can try changing "100" to "1000" and change the size of the form after compilation Share this post Link to post
Brian Evans 105 Posted July 3 Making a Windows API call for every cell to get the text height will be slow period. The call is required since the text needs to be re-flowed when the width changes. It does all cells to get a new total height. As I mentioned for speed you need a different approach that doesn't need to calculate total height. Share this post Link to post
Lajos Juhász 293 Posted July 3 You could try something like this. Add a new private field to the form fPrevWidth: integer; procedure TForm1.FormResize(Sender: TObject); begin if (Abs(fPrevWidth-width)>50) or (GetAsyncKeyState(VK_LBUTTON) and $8000 = 0) then begin getCaption; fPrevWidth:=Width; end; end; Share this post Link to post
Kas Ob. 121 Posted July 3 @#ifdef Well i can't compile your project nor i have an idea what TControlList is, yet from your last post i can deduce the problem. Se, same behavior is visible with Windows Notepad, you can try it, open a big text file something around few MBs and make sure that Word Wrap is enabled, and see for your self, same behavior, disabling the Word Wrap will make it fast like it was few lines. Calculating the height of paragraph is demanding process, because it only possible with a font and a width, after that rendering will happen again with the font applying device context parameters, so it might be doable but not like that it must involve caching. The only components i know of that do this right (or lets say fast) is the controls from Delphi HTML components. Yet, there is may be a workaround in your case, which is switching to virtual drawing, and rendering only what should be visible while emulating the scrollbar position at side, in other words you need to switch to owner draw and draw text manually what is enough to fill the control. Share this post Link to post
Lajos Juhász 293 Posted July 3 4 minutes ago, Kas Ob. said: TControlList is Here you can find out more https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_VCL_TControlList_Control. Share this post Link to post
Kas Ob. 121 Posted July 3 3 minutes ago, Lajos Juhász said: Here you can find out more https://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_VCL_TControlList_Control. So these are TMemo(s) in the list ! not even simple and plain text lines in a list box. Anyway, same recommendation as for single Memo or ListBox, switch to owner drawing, then limit what you are using/rendering/showing to the visible ones, while simulate/emulate a scroll bar on the side, or it might support its own scrollbar, who knows. Share this post Link to post
#ifdef 12 Posted July 3 11 minutes ago, Kas Ob. said: Se, same behavior is visible with Windows Notepad, you can try it, open a big text file something around few MBs and make sure that Word Wrap is enabled, and see for your self, same behavior, disabling the Word Wrap will make it fast like it was few lines. I know but... in Notepad++ everything is ok 🥲 Share this post Link to post
#ifdef 12 Posted July 3 1 minute ago, Kas Ob. said: So these are TMemo(s) in the list ! not even simple and plain text lines in a list box. Anyway, same recommendation as for single Memo or ListBox, switch to owner drawing, then limit what you are using/rendering/showing to the visible ones, while simulate/emulate a scroll bar on the side, or it might support its own scrollbar, who knows. Nope. TControlList if for TGraphicControl only: Share this post Link to post
Kas Ob. 121 Posted July 3 12 minutes ago, #ifdef said: I know but... in Notepad++ everything is ok 🥲 It is owner drawn in full. 9 minutes ago, #ifdef said: Nope. TControlList if for TGraphicControl only: Well i said i can't compile your project, and if all of these text segments are ... What ? (i don't care) TLable or TMemo, then use 50-80 and just update their content simulating hundreds or thousands, instead of creating hundreds, update their contents based on the scroll bar. You could also try to create the needed amount and try to clear the non visible and fill the few visible when resizing, i am throwing ideas here and hope might help. Share this post Link to post
Kas Ob. 121 Posted July 3 By the way Notepad++ with 14mb text file with longs lines, very fast without Word Wrap, does stutter on resizing with Word Wrap enabled. Share this post Link to post
Patrick PREMARTIN 74 Posted July 3 1 hour ago, Kas Ob. said: By the way Notepad++ with 14mb text file with longs lines, very fast without Word Wrap, does stutter on resizing with Word Wrap enabled. You can try Ultra Edit. It works well with big files. Share this post Link to post
#ifdef 12 Posted July 4 Sorry, I don't need a text editor, I just need to somehow speed up the rendering of text with word splitting and that's it Share this post Link to post
Die Holländer 45 Posted July 4 Do you need to be able to edit/use the textblocks or is it just for display? word splitting = word wrap? Share this post Link to post
#ifdef 12 Posted July 4 (edited) 3 hours ago, Die Holländer said: Do you need to be able to edit/use the textblocks or is it just for display? No, I don't (anyway, TControlList is for TGraphicControl only). 3 hours ago, Die Holländer said: word splitting = word wrap? Yes. Edited July 4 by #ifdef Share this post Link to post
A.M. Hoornweg 144 Posted July 5 On 6/27/2024 at 11:49 AM, #ifdef said: I added dynamic (variable) row heights to TControlList and it works: But when resizing the form, the TControlList is terribly slow. @Serge_G I know you are a guru in this list. Please tell me how this can be fixed? Project1.zip Just out of interest, what tool do you use to create GIF's like this? Share this post Link to post
#ifdef 12 Posted July 6 On 7/5/2024 at 11:01 AM, A.M. Hoornweg said: Just out of interest, what tool do you use to create GIF's like this? https://github.com/NickeManarin/ScreenToGif/ Share this post Link to post