Recent

Author Topic: [Closed] Using the middle button on touch screens  (Read 1935 times)

loaded

  • Hero Member
  • *****
  • Posts: 880
[Closed] Using the middle button on touch screens
« on: April 26, 2024, 08:58:29 pm »
Hi All,
The code below works fine on the mouse, but is unresponsive on the touchscreen tablet (or I couldn't run it).
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  2.   Y: Integer);
  3. begin
  4.   if ssMiddle in shift then Caption:=x.ToString;
  5. end;  
  6.  

What should I do to make the middle mouse button work on a touchscreen tablet with a window operating system?
« Last Edit: April 27, 2024, 09:22:19 am by loaded »
The more memory computers have, the less memory people seem to use. 😅

Thaddy

  • Hero Member
  • *****
  • Posts: 19383
  • Glad to be alive.
Re: Using the middle button on touch screens
« Reply #1 on: April 26, 2024, 09:37:14 pm »
Well, since it is a touchscreen, shouldn't that be a "middle finger"?
I do not think that is supported.. :-\ :P
objects are fine constructs. You can even initialize them with constructors.

loaded

  • Hero Member
  • *****
  • Posts: 880
Re: Using the middle button on touch screens
« Reply #2 on: April 26, 2024, 09:50:19 pm »
Commander Thaddy, thank you very much for your answer.
I do not think that is supported.. :-\ :P

I have such a thought too. However, when there is a program that has put a lot of effort into it, people naturally look for a solution with last hope.  :-\
The more memory computers have, the less memory people seem to use. 😅

Yurgenz

  • New Member
  • *
  • Posts: 23
Re: Using the middle button on touch screens
« Reply #3 on: April 26, 2024, 09:54:48 pm »
Do you have on tablet programs that support middle mouse buttons? Did you look in mouse/touchscreen setings in Windows parameters? On notebooks touchpad drivers often have settings for imitate middle button.
« Last Edit: April 26, 2024, 09:57:08 pm by Yurgenz »

loaded

  • Hero Member
  • *****
  • Posts: 880
Re: Using the middle button on touch screens
« Reply #4 on: April 26, 2024, 10:26:42 pm »
Thank you for your reply Yurgenz
Yes, there are settings, I made the necessary adjustments, but I still couldn't get it to work.
I'll try some more tomorrow with a calm mind.
The more memory computers have, the less memory people seem to use. 😅

dseligo

  • Hero Member
  • *****
  • Posts: 1686
Re: Using the middle button on touch screens
« Reply #5 on: April 26, 2024, 10:40:06 pm »
What should I do to make the middle mouse button work on a touchscreen tablet with a window operating system?

Who is manufacturer and what is model of that touchscreen? There is a chance that manufacturer put possibility in driver to emulate middle click ('gestures'). Something like touching with 3 fingers at the same time.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Using the middle button on touch screens
« Reply #6 on: April 26, 2024, 10:44:06 pm »
Try it with a custom handler.
I can not test for Touchpad since I got none but curious if its working.
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
  9.   LCLIntf, LCLType, Messages;
  10.  
  11. type
  12.   TForm1 = class(TForm)
  13.   protected
  14.     procedure WndProc(var Message: TMessage); override;
  15.   private
  16.   public
  17.   end;
  18.  
  19. var
  20.   Form1: TForm1;
  21.  
  22. implementation
  23.  
  24. {$R *.lfm}
  25.  
  26. procedure TForm1.WndProc(var Message: TMessage);
  27. var
  28.   MouseMsg: TWMMouse;
  29. begin
  30.   inherited;
  31.   if Message.Msg = WM_MBUTTONDOWN then
  32.     begin
  33.       MouseMsg := TWMMouse(Message);
  34.       Self.Caption := IntToStr(MouseMsg.XPos);
  35.     end;
  36. end;
  37.  
  38. end.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Using the middle button on touch screens
« Reply #7 on: April 26, 2024, 10:49:11 pm »
Ps: With the provided handler you can of course also check what messages in general pop in to find out if that handler react at all for your input device, just log the "Message.Msg" somewhere to filter out more and more unwanted.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

loaded

  • Hero Member
  • *****
  • Posts: 880
Re: Using the middle button on touch screens
« Reply #8 on: April 27, 2024, 09:21:54 am »
Thank you very much for your answer dseligo and KodeZwerg.

Who is manufacturer and what is model of that touchscreen? There is a chance that manufacturer put possibility in driver to emulate middle click ('gestures'). Something like touching with 3 fingers at the same time.

Lenovo ideapad duet 5i 12iau7, Yes, I activated the three-finger feature from the settings.

KodeZwerg, The code you gave;
It works on the touch pad on the case, but not on the touch area of ​​the screen.
For now, this information is quite enough for me. Many thanks to everyone who provided their information.




The more memory computers have, the less memory people seem to use. 😅

jamie

  • Hero Member
  • *****
  • Posts: 7820
The only true wisdom is knowing you know nothing

loaded

  • Hero Member
  • *****
  • Posts: 880
Re: [Closed] Using the middle button on touch screens
« Reply #10 on: April 27, 2024, 06:20:44 pm »
Thank you very much for your answer jamie

The computer belonged to a customer and I kept it for a day to solve this problem. Unfortunately I couldn't figure it out. As of today, I delivered the device.

A friend who uses Delphi said that this problem has been solved in Delphi, but I do not have the opportunity to confirm this for now.
I believe that it will be solved with modifications in Lazarus and LCL, but I do not have the knowledge to go that deep for now.

I advised the customer to use a mouse for now, and he happily agreed.  :D
The more memory computers have, the less memory people seem to use. 😅

jamie

  • Hero Member
  • *****
  • Posts: 7820
Re: [Closed] Using the middle button on touch screens
« Reply #11 on: April 27, 2024, 06:30:43 pm »
Delphi has "OnGesture" event.
The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018