Hello, guys (and gals) !
Recently I have started working on a project that would require me to detect if the caret is hovering over a certain position of the screen. I was hoping someone here would be able to tell me how to do this, and I would prefer that after it detects that the caret is hovering it waits for a second or two. Ex: hovers mouse over button for 1 sec., moves away, nothing happens; hovers mouse over button for 2 sec., context menu appears!
Thanks, Cory Ackley.
Detect Mouse Hover on an Advanced Computer?
Started by Endergreen117, Oct 14 2014 08:23 PM
lua help computer
2 replies to this topic
#1
Posted 14 October 2014 - 08:23 PM
#2
Posted 14 October 2014 - 08:28 PM
There is no such 'mouse_hover' event.
The best thing you could do is scrolling or clicking with the mouse when above the button - this will return the coordinates of where the mouse has scrolled/clicked.
Hovering is also not an option when it comes to CC event queues - it would just spam it and also there's the problem with multiple clients in one GUI.
EDIT:
If you mean the blinking cursor - that would be possible with term.getCursorPos()
You could do that by starting an os.startTimer( your-seconds-to-wait-until-context ) and os.pullEvent().
If that timer triggers and the cursor is still in the area of the button just trigger the context menu
The best thing you could do is scrolling or clicking with the mouse when above the button - this will return the coordinates of where the mouse has scrolled/clicked.
Hovering is also not an option when it comes to CC event queues - it would just spam it and also there's the problem with multiple clients in one GUI.
EDIT:
If you mean the blinking cursor - that would be possible with term.getCursorPos()
You could do that by starting an os.startTimer( your-seconds-to-wait-until-context ) and os.pullEvent().
If that timer triggers and the cursor is still in the area of the button just trigger the context menu
Edited by wieselkatze, 14 October 2014 - 08:30 PM.
#3
Posted 14 October 2014 - 08:30 PM
There is no mouse_hover event or the like for ComputerCraft. As I understand it, tracking and reporting the cursor position would involve sending a LOT of packets back and forth every time the cursor moves at all so it's just not feasible.
EDIT:
'd
EDIT:
Edited by Dog, 14 October 2014 - 08:31 PM.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











