Me again... Using the eval version under Delphi 12.3
On a touch screen, if I use my finger to slide the content (not using the scrollbar), and I lift my finger, the OnClick even occurs. Bad for me especially if the caret is within a hyperlink... is there a way around that? Tested on Windows and Android.
Edit: Also occurs using the mouse to drag the content up/down rather than the scroll bar (OnClick event occurs when releasing the mouse button)
Eric
OnClick occurs on a touchscreen scroll
-
- Site Admin
- Posts: 17854
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: OnClick occurs on a touchscreen scroll
OnClick means clicking on control, and TRichView has the default behavior inherited from TControl.
I suggest using other mouse events instead.
I suggest using other mouse events instead.
-
- Posts: 26
- Joined: Sun May 25, 2025 6:41 pm
Re: OnClick occurs on a touchscreen scroll
I guess one has to have the mouse up occur off the control to prevent the onclick event. Seems just so stupid to me... it is not a click in my mind. To me a click is a short operation within milliseconds in order to distinguish a short vs long press, drag select text or even a scroll operation. WPTools uses the time between down/up to determine whether to invoke the OnClick event or not which threw me off, thinking it was an issue with TRichView.
I realize now that it is not your issue after all. Sorry.
I realize now that it is not your issue after all. Sorry.
-
- Posts: 26
- Joined: Sun May 25, 2025 6:41 pm
Re: OnClick occurs on a touchscreen scroll
Correction... WPTools uses the mouse position between down/up to determine if it it was a click or not.
-
- Posts: 26
- Joined: Sun May 25, 2025 6:41 pm
Re: OnClick occurs on a touchscreen scroll
FWIW, this is what I did to get around my issue and only do the OnClick event when the mouse/finger up hasn't moved far from the down:
Code: Select all
procedure TForm1.RichViewEdit1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Single);
begin
fMouseDownPos := TPointF.Create(X, Y);
end;
procedure TForm1.RichViewEdit1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Single);
begin
fMouseUpPos := TPointF.Create(X, Y);
if (Abs(fMouseDownPos.X - fMouseUpPos.X) <= 3) and (Abs(fMouseDownPos.Y - fMouseUpPos.Y) <= 3) then
RichViewEdit1Click(nil);
end;
procedure TForm1.RichViewEdit1Click(Sender: TObject);
begin
if Sender <> nil then exit;
end;