I’m working with a MacBook Pro (Catalina) and the implemented trackpad.
I just wanted to define a MouseUp event on a textbox. In order to test it I put a MessageBox in it. The event does not fire (message not displayed).
Then I tried the MouseDown event the same way and it was working!
Anyone has an idea why the MouseUp is not working on the Apple notebooks?
I could find a solution. I post it here for anyone else having the same issue:
Create a Timer f.e. with name MyTimer
RunMode: Off (this makes sure your Timer will not fire on starting the app)
In your MouseDown event put:
This will execute your timer (even previously put RunMode: off) and after 100ms the cursor in the textarea is positioned. So the MyTextarea.SelectionStart has a the correct value.
This is not a nice solution, rather a workaround. I have no idea why the mouse is blocked on a textarea with code “Return True” and I also don’t know why the MouseDown event must set to “Return True” in order to execute the MouseUp event. They both should act independent (imho).
Concerning my question @Gavin Smith has answered it.
@Michel Bujardet I’m calculating the current line and line position of the cursor for displaying purposes. This of course has effect on users mouseclick inside the textarea. The MouseDown event returns the existing (current) position in MyTextarea.SelectionStart but I need the new one. I then assumed that the MouseUp event would return the right position (set by mouse click). So this thread started…
You have another way to get MouseUp without returning True in MouseDown.
Start a 15 Milliseconds multiple timer in MouseDown and not IsContextualClick with this kind of code in Action:
[code]If not System.MouseDown then
Sender.Mode = Timer.ModeOff
// Do MouseUp
I don’t think you need to manage the cursor position if what you need is the selection, since you have SelStart and SelLength. But if you needed the cursor position anyway, you can obtain it with System.MouseX and System.MouseY, given that they are relative to the screen, and you would have to subtract the window position, and the position of the TextArea in the window.