Quote:
Originally Posted by juliansader
Using some new API functions, the mouse cursor can be changed:
Code:
reaper.Mouse_SetCursor(reaper.Mouse_LoadCursor(191)) -- Loads REAPER's native "key signature" cursor
Code:
reaper.Mouse_SetCursor(reaper.Mouse_LoadCursorFromFile("...file path and name...")) -- Loads custom cursor
When the script terminates, or after each defer cycle, REAPER will change the new cursor back. To prevent this -- as long as the mouse stays within a certain window -- one can use:
Code:
reaper.WindowMessage_Intercept(window, "WM_SETCURSOR:block")
To restore the cursor if it has moved out of the window, try this:
Code:
function loop()
if reaper.Window_FromPoint(reaper.GetMousePosition()) ~= window then
wasOutsideWindow = true
elseif wasOutsideWindow then
wasOutsideWindow = false
reaper.Mouse_SetCursor(reaper.Mouse_LoadCursor(502)) -- Set cursor again
-- Since WM_SETCURSOR is being blocked, we must tell the window to update cursor
reaper.WindowMessage_Send(window, "WM_SETCURSOR", 0, 0, 0, 0)
end
reaper.defer(loop)
end
function exit()
reaper.WindowMessage_ReleaseWindow(window)
end
|
I tried adding the reaper.Mouse_SetCursor(reaper.Mouse_LoadCursor(502 )) to an existing script but got a error message.
I then realised that I wanted to add it to some Reaper actions that couln't be edited (remove item I want an "eraser" type of icon).
It occrred to me that to ask if you could do a simple self contained script that could be used for custom actions?
For people like me who've not yet got into sripting - (though I'd love to), but who are very happy with custom and cycle actions, breaking out some of the API functionality such as the SetCursor, could be brilliant. It would then be just a matter of inserting either the correct number or correct patch depending.
I aks this as I suspect that if I try to just make a new script from the raw code that I will discover it isn't intended to be used that way...
Although I may try in the mean time anyway!
--
Just tried the above as Lua and getting "attempt to call a nil value(field"Mouse_LoadCursor")
(I do have the js_ReaScriptAPI installed)
Probably this is just way above my current level - hence the above request