Recent

Author Topic: OnMouseDown event  (Read 21721 times)

RW1962

  • New Member
  • *
  • Posts: 41
Re: OnMouseDown event
« Reply #30 on: January 30, 2024, 12:59:28 pm »
Thanks to all for your earnest help.

In my opinion, this is either a Windows or Security issue, and we can't fix it ourselves.

By the issue's history ... I only had Vrs2 installed, and it was working properly. After months to years that I was operating, Text selection by dragging the cursor across a line of text would not highlight nor select the text. Additionally, the Extra buttons on the trackball mouse would quit firing.

To fix it I would reinstall my RichMemo app in a different folder. Then everything worked correctly. But eventually it would start up again. So I moved the app again, and it would be temporarily fixed.

After months of doing this, I decided to run it by all of you.

Again, thanks for taling it on.

Rick

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: OnMouseDown event
« Reply #31 on: January 30, 2024, 01:10:58 pm »
By the issue's history ... I only had Vrs2 installed, and it was working properly. After months to years that I was operating, Text selection by dragging the cursor across a line of text would not highlight nor select the text. Additionally, the Extra buttons on the trackball mouse would quit firing.
So this also happened in the past with Laz 2?

To fix it I would reinstall my RichMemo app in a different folder. Then everything worked correctly. But eventually it would start up again. So I moved the app again, and it would be temporarily fixed.
I've never seen a virusscanner or other security measure block buttons like that.
It's also strange that moving the app would fix it. Seem more like a driver problem but then it should happen for other programs too.

I have seen other software interfere with mouse buttons but not to the extend that it doesn't work in one program and does in another.

You could try X-Mouse Button Control app (I've used that to re-program the middle mousebutton (wheel) to close windows with Alt+F4). When firing up the program you can also test the buttons to see if they come through there.
https://www.highrez.co.uk/downloads/xmousebuttoncontrol.htm

You could also re-install Laz 2 as secondary installation (again with C:\Laz2 and C:\Laz2\config for the config) just to see if it works in there. But if you say it also happened in the past with Laz 2 this would not fix it. You'll need to find the cause of the problem.


Thaddy

  • Hero Member
  • *****
  • Posts: 18780
  • To Europe: simply sell USA bonds: dollar collapses
Re: OnMouseDown event
« Reply #32 on: January 30, 2024, 01:12:10 pm »
If he would change OnMouseDown to OnMouseUp the whole issue would not exist.
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: OnMouseDown event
« Reply #33 on: January 30, 2024, 01:13:26 pm »
If he would change OnMouseDown to OnMouseUp the whole issue would not exist.
Well, that was already discussed and tried.

@Thaddy

Thanks for helping.

I set it up for MouseUp, but it behaved the same as MouseDown.

And for me the OnMouseDown works just fine with all those buttons.

RW1962

  • New Member
  • *
  • Posts: 41
Re: OnMouseDown event
« Reply #34 on: January 31, 2024, 12:32:47 pm »
I haven't experienced any dependance on OnMouseDown nor OnMouseUp ... and I am currently using OnMouseUp. Moreover, I am exclusively using Lazarus v3.

However, when I removed v2 (purging all support resources), and made a clean install of v3(32 bit) ... upon launching it for the first time, I saw 4 & 5 activating, but only for a couple hits. Then they went silent again.

Rick

RW1962

  • New Member
  • *
  • Posts: 41
Re: OnMouseDown event
« Reply #35 on: January 31, 2024, 04:16:24 pm »
Here is a site that explains how to read button 4 & 5.

https://www.codeproject.com/Articles/14016/Handling-Keyboard-and-Mouse-Application-Buttons-in

Unfortunately, it is in C++ code. I don't know C code very well. Can anyone translate it to Pascal?

Rick

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: OnMouseDown event
« Reply #36 on: January 31, 2024, 04:22:22 pm »
Did X-Mouse Button Control app work for you?
Does it show the button 4 and 5 when pressed?

Lazarus already reads those buttons it's just that don't seem to work for you (every time).

You could try to open a bugreport and see if someone else has the same problem.

RW1962

  • New Member
  • *
  • Posts: 41
Re: OnMouseDown event
« Reply #37 on: January 31, 2024, 04:24:58 pm »
Here is another example...

https://community.khronos.org/t/how-to-catch-xbutton-clicks/24990

Yes, I had tried to use X-Mouse some time back. I couldn't get it to do anything.

bugreport report is a waste of time. If they can't repeat (which you can't) they say "NO WAY."

Rick
« Last Edit: January 31, 2024, 04:28:47 pm by RW1962 »

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: OnMouseDown event
« Reply #38 on: January 31, 2024, 04:32:46 pm »
Yes, I had tried to use X-Mouse some time back. I couldn't get it to do anything.
If even X-Mouse doesn't show 4 and 5 being pressed I guess you're out of luck.

RW1962

  • New Member
  • *
  • Posts: 41
Re: OnMouseDown event
« Reply #39 on: January 31, 2024, 04:38:28 pm »
This is another ...

https://learn.microsoft.com/en-us/windows/win32/learnwin32/mouse-clicks

Code: Pascal  [Select][+][-]
  1. The WM_XBUTTONDOWN and WM_XBUTTONUP window messages apply to both XBUTTON1 and XBUTTON2. The wParam parameter indicates which button was clicked.
  2.  
  3. C++
  4.  
  5. UINT button = GET_XBUTTON_WPARAM(wParam);  
  6. if (button == XBUTTON1)
  7. {
  8.     // XBUTTON1 was clicked.
  9. }
  10. else if (button == XBUTTON2)
  11. {
  12.     // XBUTTON2 was clicked.
  13. }
  14.  

It looks like a winner to me.

Rick


rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: OnMouseDown event
« Reply #40 on: January 31, 2024, 04:54:42 pm »
This is another ...

https://learn.microsoft.com/en-us/windows/win32/learnwin32/mouse-clicks

Which is all in the source of Lazarus itself already.

You could try to override the Windows messaging loop and see if you can catch them... but I wonder if it would make any difference.

BTW. You did try testing the small test app OUTSIDE the IDE didn't you???
I saw that the docking-plugin of Lazarus also catches some mouse button messages.
(But even with docking installed it works for me with debugging in the IDE, but I though I'd ask just to test...)

Thaddy

  • Hero Member
  • *****
  • Posts: 18780
  • To Europe: simply sell USA bonds: dollar collapses
Re: OnMouseDown event
« Reply #41 on: January 31, 2024, 05:24:43 pm »
Well, that was already discussed and tried.

And for me the OnMouseDown works just fine with all those buttons.
HOW? firing once as opposed to keep firing? I did not see any proper code. Oh, well, again.
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

RW1962

  • New Member
  • *
  • Posts: 41
Re: OnMouseDown event
« Reply #42 on: January 31, 2024, 06:48:12 pm »
I just compiled my app and put it in a new folder.
It is performing with the 4 & 5 mouse buttons.
Ill' let you know when it fails to do so.

Plus, this is a strong indicator that Windows is interfering with my executions.
Yet by the same logic ... Lazarus is still not performing with those button at all.
This same mischief is happening on 2 computers.

This is why I want to take over the mouse controls.

Rick

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: OnMouseDown event
« Reply #43 on: January 31, 2024, 07:17:17 pm »
You could try this code but if Lazarus doesn't get the buttons I suspect the whole program doesn't get the buttons and nothing will work.

https://forum.lazarus.freepascal.org/index.php/topic,61577.msg463713.htm

RW1962

  • New Member
  • *
  • Posts: 41
Re: OnMouseDown event
« Reply #44 on: February 01, 2024, 03:12:07 pm »
Kudos to KodeZwerg, it is excellent coding.

@RVK
You are correct. The KodeZwerg code was implemented into my app, and everything else functioned as expected ... but the 4 & 5 buttons would not fire.

But it looks like the KodeZwerg is a direct access to the Windows infrastructure. Wouldn't that be independent of the Lazarus complier?

Plus, my app that I placed in the new folder is still firing 4 & 5. But I have relocated it many times in the past, and eventually it has always failed ... and never fixes itself.

Rick




 

TinyPortal © 2005-2018