|
|
|
10-03-2018, 02:46 AM
|
#1
|
Human being with feelings
Join Date: Nov 2015
Location: earth
Posts: 471
|
reaper.SetCursorContext doesn't work, can't set cursor focus
I am trying to write a script that will actually place the cursor focus on the MEV ("Main Edit View", otherwise known as the arrange window), with the focus on the edit area - NOT the TCP ("Track Control Panels").
Code:
reaper.SetCursorContext(1,0)
I've even tried the following to set the view to TCP, and then the MEV.
Code:
reaper.SetCursorContext(0,0)
reaper.SetCursorContext(1,0)
But after running the script, although the arrange *window* is focused (window title is highlighted/is active window), neither the TCP or Main Edit View are *actually focused*, as evidenced by using a hotkey to run a "Screenset: Save window set #nn" action. The "last focus" shown when saving the screenset will always show the last window I actually clicked in/on with the mouse, regardless of which window or area of a window (TCP or MEV) I have used an action or a script to set the focus to.
The only way I have found to actually get the focus to be set to the MEV is to first click on a track in the TCP, and then click in the edit area of a track in the MEV.
For example, if I click the Mixer or Actions window, and then click in the MEV in a lane of any track, when I try to save a screenset, it will still show the last focus as Mixer or Actions, instead of the Main Edit View. So I have to click on a track first, then in a lane of a track in the MEV.
This is really frustrating. Is there any solution for this? I have custom actions that depend on focus being set correctly to TCP or MEV to run subsequent actions properly (e.g. deleting a track/item depending on focus). I would really like to figure out how to get this working properly.
Or maybe this is a bug, and the last focus when saving a screenset just isn't updating properly because it is using some other method to get the last cursor focus?
|
|
|
10-07-2018, 01:54 PM
|
#2
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Have you tried displaying the current context, using GetCursorContext for debugging purposes?
http://mespotine.de/Ultraschall/Reap...tCursorContext
Maybe this clears up the behavior of SetCursorContext() a little...
Or you could try to use SetCursorContext(2,TrackEnvelope) to set it to an Envelope, as TrackEnvelopes are always within the ArrangeView itself.
|
|
|
10-07-2018, 03:13 PM
|
#3
|
Human being with feelings
Join Date: Nov 2015
Location: earth
Posts: 471
|
Quote:
Originally Posted by mespotine
Have you tried displaying the current context, using GetCursorContext for debugging purposes?
http://mespotine.de/Ultraschall/Reap...tCursorContext
Maybe this clears up the behavior of SetCursorContext() a little...
Or you could try to use SetCursorContext(2,TrackEnvelope) to set it to an Envelope, as TrackEnvelopes are always within the ArrangeView itself.
|
Yes, I've tried. In some cases, it will work properly for context-dependent actions that follow. But when the following action is saving a screenset, the "last focus" shown when saving the screenset will not be updated based on cursor context set by the SetCursorContext command. It will always remain set to the last window clicked with the mouse.
Perhaps there is some other command or function that will actually update the "last focus" to be either the TCP or MEV? I haven't been able to find any way to do it in a script. It seems it will only be updated by manually clicking on a track in the TCP (for last focus being TCP), and then clicking in the arrangement view (for last focus being MEV).
|
|
|
10-07-2018, 03:21 PM
|
#4
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
Have you tried using actions that trigger something in the arrangeview? Maybe there is one that changes the context by that.
Would be a little hacky, but well...
The function itself, maybe it's a case for a bugreport.
The focus-problem is always a difficult one in Reaper.
Oh, Julian Sader is currently working on a plugin with window-functions in them. Maybe you can set the focus with that.
He made a beta-version of SWS in the stash, though I think, his functions will not be part of the final release of SWS 2.9.8.
https://stash.reaper.fm/v/34008/reaper_sws64.zip
|
|
|
10-07-2018, 03:34 PM
|
#5
|
Human being with feelings
Join Date: Nov 2015
Location: earth
Posts: 471
|
I'm not sure if a "hacky" workaround will work. I'll have to see if something like moving an item around or adding and removing an envelope would do it. But from my experience so far, I doubt it.
And for most purposes, setting the focus via cursor context command seems to work. I've just noticed that saving a screenset seems to be an exception, and actually depends on mouse clicks, and disregards which window may actually be active based on any actions that may have changed it the focused window or cursor context. So it's probably just a bug with saving a screenset.
|
|
|
10-12-2018, 05:23 AM
|
#6
|
Human being with feelings
Join Date: Nov 2015
Location: earth
Posts: 471
|
Quote:
Originally Posted by mespotine
Have you tried using actions that trigger something in the arrangeview? Maybe there is one that changes the context by that.
Would be a little hacky, but well...
|
Still haven't been able to find a way that will actually set the cursor focus so that the "last focus" when saving a screenset will be the TCP or MEV. Sure hope this gets fixed in the near future, or by an SWS update.
|
|
|
10-12-2018, 05:52 AM
|
#7
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,621
|
I've successfully set the cursor-context with action:
1013 - Transport: Record
Despite the fact, that it triggers recording, but does this change the cursorcontext the way you need that?
If yes, I'll try to write a function to do that for you without triggering the actual recording...
|
|
|
10-12-2018, 12:15 PM
|
#8
|
Human being with feelings
Join Date: Nov 2015
Location: earth
Posts: 471
|
Quote:
Originally Posted by mespotine
I've successfully set the cursor-context with action:
1013 - Transport: Record
Despite the fact, that it triggers recording, but does this change the cursorcontext the way you need that?
If yes, I'll try to write a function to do that for you without triggering the actual recording...
|
I'm no longer at work to test this. But if you make a custom action that does this (transport: record), set a key command for that custom action, then click on the mixer panel (not docked, but in a separate window) or some other undocked window (such as the actions list, or video window), then use the key command to run the custom action, and then the key command to store a screenset, and if the "last focus" shows "main edit view" - despite the fact that you last clicked with the mouse on some other window - then this would effectively resolve the issue I'm having.
Also important to note, I'm on a Windows 10 PC - not Mac (in case that makes a difference).
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 12:21 AM.
|