I needed to create some custom ListBox-like control for a project this week ( Little ChatGPT Helper ). I made so much progress and am pleased with the result so far that I decided to make the code available:
It supports single-click text editing and growing/shrinking of rows while typing.
Updating with new functionality: The view will scroll to the insertion point or row that has the text focus. Release notes and GIF demonstration here:
TRCustomListBox works around a verified (macOS) XOJO bug when measuring the lines in a TextArea. Getting an accurate count of the number of lines of text in a TextArea is critical to this control’s functionality:
Thank you for the Windows feedback. I will look into the Window 11 issues today; I’m curious, but I’m developing primarily on and for Mac. I’m not surprised there’s slow scrolling: Giving the options to render via Graphics (doing all font metrics) and using a TextArea, Graphics didn’t have 100% of the functionality needed. Using a Graphics object may result in faster scrolling/rendering, but IIRC, there were differences between word wrap in Graphics vs the Text Area, and border/inset differences between the two, which, Critically, affected how the height of multi-line rows were as calculated.
Additionally, the Chat Bubbles demo may be slower because it does extra processing to calculate text widths.
Transparent TextArea background issues aside, there are fundamental differences between how TextArea renders in the window as a control and how it renders with Graphics.DrawInto, resulting in different text widths, line heights, and word wrappings.
I had conditions to open and run the demo with Xojo 2022 R1.
Some visual problems I experimented with text that doesn’t appear in the bubbles, but clicking on the bubble it appears…
So I tried to open and run the demo with Xojo 2022 R4.1 and also with Xojo 2023 R1.1 but it shows me a compilation error: