Forum > LCL

Mouse button status outside the form (fullscreen) on Rasbian/arm

(1/4) > >>

xardomain:
Hi All, any pointer to find info about mouse buttons status on the screen?

I need a Linux/arm solution, it easy to get the mouse position but not the status of the buttons.
I need to acquire mouse position and button status and send to another raspberry, thanks.

I don't need to emulate it (not here), I would just to have a device(a pi for example) that will tell me where the mouse is on its screen and when the user presses the one of the three button on the mouse. The data could be passed through network or even serial.

At worst I could use a form that is the size of the screen and borderless (it should work I guess) but maybe there is a better solution.

The screen is not really used, so even a full blown empty form will do but...

TIA

Giuseppe

KodeZwerg:
I am unsure about what you actual try to do but I suggest that you "uses mouse" and look into this unit. It offer a lot, I bet also things that you searching for.
It is unknown to me how far it is compatible to your target.

xardomain:
>I am unsure about what you actual try to do but I suggest that you "uses mouse" and look into this unit. It offer a lot, I bet >also things that you searching for.
>It is unknown to me how far it is compatible to your target.

I can use mouse for the mouse position, but I am unable to detect mouse clicks. This is the reason of the request. I am unable to find this information/examples. I can find the solution for Windows, but I would  like it to be solved for Raspbian on PI, or even better cross platform.


I need to create a dual headed computer(like a PI4), one monitor, one primary keyboard and a primary mouse are the real hw, normal stuff.

On the same computer, but on the second monitor, I will have the output of a frame grabber "showing" the monitor of a target(another) computer.

I would like to setup a second keyboard and a second mouse on the dual headed computer, completely independent from the target but also independent from the primary keyboard and the mouse, they need not to interfere each other.

Connecting two keyboards and two mouses won't work because:
1) I cannot detect events from one particular keyboard or mouse connected
2) They are free to go from one monitor to another, I want them to be restricted to their monitors.

On the dual headed computer I will record macro events from the keyboard and mouse, and will generate the clicks and the keystrokes using a couple of devices (like 2 PI zero W) that will regenerate the events for the target computer using USB gadget keyboard and mouse emulation.

I could use a Teensy and or Arduino Nano but the PI Zero W would allow easier control. This is for the "regeneration" of the events captured but I would like to capture keyboard and mouse on the dual headed computer.

Apparently, It would be like you are using the target computer from the dual headed because the monitor will be replicated and the secondary keyboard and secondary mouse events will be captured on the dual headed computer and regenerated using the keyboard and mouse emulation provided by USB gadget.

I have one PI2 that could run just a Lazarus program that will transfer the mouse coordinates and button clicks to the dual headed computer but I am unable to extract mouse click information.

Hope it is more clear (not easy at all).

Giuseppe

xardomain:
Here it is using fullscreen form:
procedure TForm1.FormCreate(Sender: TObject);
begin
      Form1.Top := 0;
      Form1.Left := 0;
      //Form1.Width:= 1920;
      // Form1.Height:= 1080;
      Form1.WindowState := wsFullScreen
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = mbleft then
  begin
    CheckBox1.Checked := TRUE;
  end;
  if Button = mbmiddle then
  begin
    CheckBox2.Checked := TRUE;
  end;
  if Button = mbright then
  begin
    CheckBox3.Checked := TRUE;
  end;
end;

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
       if Button = mbleft then
  begin
    CheckBox1.Checked := FALSE;
  end;
  if Button = mbmiddle then
  begin
    CheckBox2.Checked := FALSE;
  end;
  if Button = mbright then
  begin
    CheckBox3.Checked := FALSE;
  end;
end;


procedure TForm1.Timer1Timer(Sender: TObject);
begin
  // butn := mbleft;
  Label1.caption := 'X=' + IntToStr(Mouse.CursorPos.X);
  Label2.caption := 'Y=' + IntToStr(Mouse.CursorPos.Y);
end;

Not exactly an elegant solution but it works.

Joanna from IRC:
Hi xardomain, just want to let you know that you should place your code inside the code viewer. It can be found when you modify your post...select code pascal and paste your code inside
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---code goes here
Also you went to wrong place earlier which is why nobody answered.

Navigation

[0] Message Index

[#] Next page

Go to full version