I'm not sure if this is the same question the OP asked:
I have a floating toolbar with buttons to run ReaScript programs that act on the active MIDI editor. After the programs complete, the focus is on the toolbar, instead of on the MIDI editor (which was the focused window right before I clicked the toolbar button).
Is there an API command I can put at the end of the ReaScript program to return focus to the MIDI editor? I'm getting tired of having to remember to reactivate focus on the MIDI editor after I click one of the toolbar buttons.
EDIT:
Damn -- I always seem to be able to answer my own question *after* I show my ignorance by posting it!
Before I posted, I saw the action "SWS/S&M: Cycle focused window", but didn't think it would do what I wanted. (I thought it would cycle the focus through all open windows, without me being able to know the order or which one would be the MIDI editor). I just tried it, and it does exactly what I want -- cycle the focus back and forth between the last two windows (in this case, the toolbar and the MIDI editor).
One question though: the documentation doesn't explain what the "flag" parameter does:
Code:
Main_OnCommand(int command, int flag)
It seems to work when I pass in 0 or 1 (haven't tried any other values). What is "flag" used for?