Pixel-perfect scroll position in textarea?

Hello

I have a textarea that is a code window where the user can enter code. On the left side of this textarea there is another textarea showing the line numbers. This is all working well. If not all entered code can be seen the user can of course scroll the textarea. I then have to synchronously scroll the other textarea with the line numbers.
The problem: textarea.VerticalScrollPosition returns the most top visible line number but not the pixel-perfect position. Setting this line number to the other textarea (showing current line number view) then there is a slight shift between both textareas. Well if I then also set the VerticalScrollPosition of the codearea I get them synced but then I have some flickering effects on scrolling the codearea.

Is there a solution where I can get them synced so they are always being at the precise same pixel-perfect vertical position? I also would be happy to be able to set the textarea (code) scrolling step to “line” but I couldn’t find a property for this.

Addon:
Just saw that textarea.HorizontalScrollPosition is based on pixels while textarea.VerticalScrollPosition is based on lines! This is really weird.

Have a look at https://github.com/tempelmann/custom-editfield . That should do what you want out of the box.

Thank you this looks promising but I have no clue how to “install” this. Beside of tons of files there is an installation chapter not telling me what and how I have to download files (and install where). F.e. he is talking about a “CustomEditField folder” which I don’t have in Xojo. Furthermore I miss a proper manual (inside) and the code looks pretty old, not sure if it is working with latest Xojo releases on Mac, Win, Linux).

It does… while CEF was written many years ago. Tomas has taken over and updated it…

Thanks for the additional info. I have to figure out how to “implement” it, I’m not into GIT.

It can be confusing but find the “clone/download” button and then view the read me in the download

Just click the link given by Beatrix and press the green ‘Clone or download’ button.
Select ‘Download ZIP’ and when it’s downloaded you can use CEF.

I don’t know about Linux and Windows. But I have the code working fine on Catalina with Xojo 2019r3. Download the zip file. Run the project. You probably need to copy most of the project items into your project.

FWIW, I get CGImage errors running in 19R3,1. I found just commenting out the offending routines in DragImage allows it to work (esp. since I don’t use Drag+Drop).

Is there a newer repository beside Tempelmann’s?

[quote=480268:@Tanner Lee]FWIW, I get CGImage errors running in 19R3,1. I found just commenting out the offending routines in DragImage allows it to work (esp. since I don’t use Drag+Drop).

Is there a newer repository beside Tempelmann’s?[/quote]
not officiall that I know of…
I personally did a lot of changes to it recently, but all for my own purposes, and it including cutting out chunks I didn’t need

The original version did use an image format that included the mask as a side-by-side image, not layers like today

@Dave S Thanks for the info.

Same here. I have a long IDE Communicator script. With the CEF I now know where to look if I get a compiler error with a line number.