If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Global Mouse Up
1 post
• Page 1 of 1
Global Mouse Up
I want to start by saying, that this is mostly outdated! But, it seems there is an issue with the right mouse button up trigger, so maybe you can adapt this example for your needs. For left mouse button always use the existing "...captured" methods!!!
So, back in the days, I didn't know of the existence of mouseLUpCaptured (it was never documented). And of course I ran into problems, as soon as I dragged the mouse outside of the panel view, because a mouseLUp will then never be caught.
My solution was this. It is an excerpt from a longer code.
As you can see, it uses mouseLUp, not mouseLUpcaptured, but it works reliably. Why? Have a look at the event method defintion. releaseMouse if i == 'externalMouseUp' releases the mouse when a trigger arrives at an input that I called externalMouseUp. You can call it whatever you like. But you need an input and an instruction to release the mouse when it triggers.
To this input you connect a wireless receiver.
Then you need to go to the top layer. The top MGUI, to be precise. Here we add a wireless module. It contains simple code to catch a mouse up and send a trigger.
This works, because a mouse up event doesn't vanish, if it isn't handled on that layer. It will be transmitted to all layers that are connected by the MGUI's yellow "V" link. All of them build a chain, with the top layer MGUI being the last to receive that unhandled mouse up event. It catches it and sends a trigger, and each RubyEdit receiving it will release the mouse. It isn't harmful to release the mouse when it was already released by another RubyEdit.
But, remember, this is just a workaround for a problem that doesn't exist anymore for years. It could only be helpful for the right mouse button. But I didn't test it.
So, back in the days, I didn't know of the existence of mouseLUpCaptured (it was never documented). And of course I ran into problems, as soon as I dragged the mouse outside of the panel view, because a mouseLUp will then never be caught.
My solution was this. It is an excerpt from a longer code.
- Code: Select all
def event i, v
releaseMouse if i == 'externalMouseUp'
redraw if i != 'display'
end
def isInMousePoint x, y
true
end
def mouseLDown x, y
if y > @sl_off + @pos * @sl_net and y < @sl_w + @sl_off + @pos * @sl_net
if x > @sl_off and x < @sl_width + @sl_off
@delta = y - @pos * @sl_net
captureMouse
end
end
end
def mouseMoveCaptured x, y
nx = (y - @sl_off - @delta) / @sl_net
@pos = [0, nx, 1].sort[1]
redraw
if @outs[0] != (@pos * @rows).round
output 'current', (@pos * @rows).round
end
end
def mouseLUp x, y
redraw
output 'current', (@pos * @rows).round
releaseMouse
end
def mouseCursor x, y
2
end
As you can see, it uses mouseLUp, not mouseLUpcaptured, but it works reliably. Why? Have a look at the event method defintion. releaseMouse if i == 'externalMouseUp' releases the mouse when a trigger arrives at an input that I called externalMouseUp. You can call it whatever you like. But you need an input and an instruction to release the mouse when it triggers.
To this input you connect a wireless receiver.
Then you need to go to the top layer. The top MGUI, to be precise. Here we add a wireless module. It contains simple code to catch a mouse up and send a trigger.
This works, because a mouse up event doesn't vanish, if it isn't handled on that layer. It will be transmitted to all layers that are connected by the MGUI's yellow "V" link. All of them build a chain, with the top layer MGUI being the last to receive that unhandled mouse up event. It catches it and sends a trigger, and each RubyEdit receiving it will release the mouse. It isn't harmful to release the mouse when it was already released by another RubyEdit.
But, remember, this is just a workaround for a problem that doesn't exist anymore for years. It could only be helpful for the right mouse button. But I didn't test it.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
1 post
• Page 1 of 1
Who is online
Users browsing this forum: Google [Bot] and 53 guests