Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-07

LCL don't paint to canvas if a key is holded

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexey

Problem: CudaText editor opens 400K file at the end, syntax parser is slow, I hold "d" char. expected: "d" or "d"*n chars appears from time to time. Eg each 1-2 seconds. Seen:
"ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" chars appears each 5-6 seconds. Not ok.

Maybe LCL don't call Paint method during holding a key (if component paints slowly)? How to solve it? Or i must force repaint to canvas each 1-2 seconds (not all platforms support it, Mac don't).

ps. Ubuntu x64 gtk2

Regards, Alexey

Reply by email

Mattias Gaertner
to Alexey
Show quoted text 9 lines
Problem: CudaText editor opens 400K file at the end, syntax parser is slow, I hold "d" char. expected: "d" or "d"*n chars appears from time to time. Eg each 1-2 seconds. Seen: "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" chars appears each 5-6 seconds. Not ok. Maybe LCL don't call Paint method during holding a key (if component paints slowly)? How to solve it? Or i must force repaint to canvas each 1-2 seconds (not all platforms support it, Mac don't).

A forced repaint will only decrease the responsiveness of your application even more.
If the syntax parser is so slow, the first thing to do is to *not* call it after every key stroke. Call it on idle or in OnPaint.

Mattias

Reply by email