Page 1 of 1

Mouse auto-move with Ruby ?

PostPosted: Tue Mar 12, 2024 3:02 pm
by Tepeix
A strange question about mousse and Ruby.

I have a pad/Slider, But i want the user able to click somewhere else to move it.

Using 2 Mouse Area it works, but when the user click on the second place, i want the cursor to jump where is the first control location.

Is it possible to do this in Ruby, to make a move the mousse somewhere here when clicking in the second place ??

Re: Mouse auto-move with Ruby ?

PostPosted: Thu Mar 14, 2024 9:22 am
by Spogg
Do you mean a jump function for the slider? So you can drag the handle or click on its “slot” somewhere and the handle will jump to that point?
Or something else (and weird)? ;)

Re: Mouse auto-move with Ruby ?

PostPosted: Fri Mar 15, 2024 2:02 pm
by Tepeix
Not easy to explain..

I want the mouse icon to jump to a position, when click on the second control, so the icon will be at the exact place of the pad control 1. (if not the pad will change value before the user move it)

Don't know if this is possible. One problem might be to know which relative place or offset the icon will need..

Re: Mouse auto-move with Ruby ?

PostPosted: Fri Mar 15, 2024 4:12 pm
by Spogg
So… you click on the slider’s handle and the mouse cursor moves to the icon where it can drag the square from the right location?

I don’t know if such a thing is possible. If it is, I suspect an exotic Ruby solution would be required (beyond me!).

My understanding of mousey stuff is that control goes over to Windows and there’s some sort of dialogue between Windows and FS. And that sentence tells you all you need to know about what I know about it. :lol:

Re: Mouse auto-move with Ruby ?

PostPosted: Fri Mar 15, 2024 4:31 pm
by Tepeix
Yes, not easy..

In fact i already go to another solution..
Sharing preset, a pad and a slider, the slider could move the pad and the pad the slider and they both use the same preset module.. (quite a mess but more manageable..)

Re: Mouse auto-move with Ruby ?

PostPosted: Fri Mar 15, 2024 4:35 pm
by tulamide
It would be more helpful if you could give some context, because currently I don't see any need for this weird behavior. With context we might be able to suggest another way to go at it.

But if you insist, you'd need to do it with a self-programmed .dll, as mouse control, just like Spogg said, is in the hands of windows. There are functions to reset mouse position, but not available to us in Flowstone, only in winapi.

Re: Mouse auto-move with Ruby ?

PostPosted: Sun Mar 17, 2024 12:17 pm
by Tepeix
All my error with this was to use the prim x-y drag accumulate.. (but it works well for pad)

That's why i needed to move the mouse cursor. If you add another mouse area to it, each area would drag it.
But when you change area, you are in a very different position and the control will suddenly jump to another parameter.

It's possible to do another trick having 2 control, then transmitting the last value from one to another but it's a complex task with lot of wireless link to manage.

But it's even better to use a knob prim with ruby to make the control. In this case i erase the graphic from ruby.
Then i would use the hack function from Mgui prim (that are no more present in alpha but we could import the old prim) this make possible to move a module into another one. So i make it a cursor and the mouse area move with it. This way it's easy to have 2 mouse area that link to the same ruby control. And when we click on the other's one it doesn't reset the parameter but only increment it..

I do this on alpha so could not post an example, hope this image is comprehensible..