View Single Post
Old 04-19-2017, 12:57 PM   #12
Human being with feelings
lunker's Avatar
Join Date: Nov 2007
Location: Lucas, TX, USA (via Luleň, Sweden)
Posts: 988

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.

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:

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?
Best Regards, Ernie "lunker" Lundqvist
BDSM (Bad Dog Studio Musicians)
Windows 10 running on Z390 + i7-8700

Last edited by lunker; 04-19-2017 at 02:28 PM.
lunker is offline   Reply With Quote