Menu

#56 Add touch scrolling

open
nobody
5
2016-12-13
2016-12-13
No

In the scenario when the application runs on a touch screen device, the feature of scrolling the document vertically with the touch drag is what user expects.

Additionally, when running on a screen with a very high DPI, the size of the scrollbars becomes so tiny, that using touch (fingers) to operate these scroll bars becomes very difficult.

I faced this scenarios when deploying Lazarus written applications on Meizu MX4 phone running Ubuntu Touch.

I found out an opportunity in the layout of the TSynEdit, more precisely, took advantage of the Gutter. Currently the Gutter does not make any special use of Mouse Events (OnMouseDown, OnMouseMove, OnMouseUp), and it provides enough surace area for using touch gestures on it conveniently. Especially that in a high dpi scenario I can still programatically increase TSynEdit.Font.Height which will render Gutter big enough for the scenario.

I implemented a class TTouchSynEdit which allows you to use touch gestures (fragging down/up) on the gutter for scrolling the text vertically. The behavior can be turned on/off with:
Property TTouchSynEdit.EnableTouchScrollOnGutter: Boolean;
which is set to True by default.

Attached is the source code, it is very short, please feel free to use it by either including TTouchSynEdit class in your sources or by transplanting my functionality into the TSynEdit class.

Best Regards,
Kris

1 Attachments

Discussion


Log in to post a comment.