SRL Archive - S.M.A.R.T. Questions and Answers.

Detect mouse click in SMART


Bixby Sayz

2011-11-17 19:21:53

Think I already know the answer but gonna ask anyway.

There are times where it would be very useful to detect when/where the user clicks on the SMART window, do something with that information, then use the Mouse routine to actually move SMART's mouse to that position.

Is this possible?

mormonman

2011-11-17 19:26:59

It requires you to add a listener to the Smart canvas.

Bixby Sayz

2011-11-17 20:27:04

Now to figure out how to do it. Not having much luck searching on here, but the search function on the forums sucks anyway.

Yago

2011-11-17 20:34:01

From: Bixby Sayz
Now to figure out how to do it. Not having much luck searching on here, but the search function on the forums sucks anyway.


You'd have to edit SMART

Bixby Sayz

2011-11-17 20:40:48

Okay there goes that idea.

mormonman

2011-11-17 20:41:06

Edit: Wrong thread. and I can't find the old one.

i luffs yeww

2011-11-18 01:10:37

To answer your question, yes, it is possible. It's just not done because nobody cares enough to do it. The listener would be relatively simple, I think. But I'm not a Java guru, so I dunno.

Bixby Sayz

2011-11-18 08:06:44

I'm thinking more of the issue of then you have a forked version of SMART. Which means you then have to update/redeploy your version every time SMART is updated if you want to share what you have with other people.

For what I have in mind, this is serious overkill and not worth the effort if the ability is not built into the standard SMART client.

Nava2

2011-11-18 11:26:17

Perhaps look at the keyboard listener event, and then modify it for mouse?

I'm sure it can be done.

Also, if you do this.. then pretty sure Ben would merge it into the main repository. :)

mormonman

2011-11-18 11:34:01

From: Nava2
Perhaps look at the keyboard listener event, and then modify it for mouse?

I'm sure it can be done.

Also, if you do this.. then pretty sure Ben would merge it into the main repository. :)


Either that or he would see that you tried something useful then he would do it himself because he likes his own code ;)

i luffs yeww

2011-11-18 16:21:51

Either way, point is that if you want something useful to be added to SMART, you might as well just do it yourself so that Ben can do it himself later. <:

Gu3st...

2011-11-18 16:56:25

It's actually possible by modifying the smart.simba file in /misc/ (adding a "GetRealMousePos" function before smart overrides it), but oddly enough only the y-axis of the result of the real mouse is correct, but it's still useful (but limited)

E: This would only work for getting mouse pos though… Not mouse clicks :/ http://villavu.com/forum/showthread.php?t=56774

BenLand100

2011-11-22 23:13:02

This has been a feature request for some time, and keeps popping up. It's trivial to detect a mouse click (SMART already captures them, and dismisses them). The question I always ask is, what do I *do* with the click inside of SMART? I can't do anything besides set a flag, or such, and wait for the script to check for a mouse click, and that's not very useful, imho. There's no way to "notify" the script that the mouse was clicked, or run some generic bit of code Simba-side.

Nava2

2011-11-23 00:16:40

From: BenLand100
This has been a feature request for some time, and keeps popping up. It's trivial to detect a mouse click (SMART already captures them, and dismisses them). The question I always ask is, what do I *do* with the click inside of SMART? I can't do anything besides set a flag, or such, and wait for the script to check for a mouse click, and that's not very useful, imho. There's no way to "notify" the script that the mouse was clicked, or run some generic bit of code Simba-side.


No way to hook a pointer to a function outside SMART?

Bixby Sayz

2011-11-23 09:21:44

From: Nava2
No way to hook a pointer to a function outside SMART?
If a callback function is defined/supplied, then call it otherwise ignore it and carry on as normal?