Old 06-26-2019, 12:49 PM   #1
Human being with feelings
Join Date: Jan 2011
Posts: 28
Default Refresh Reaper's main window via script

I have a small script that changes a setting in preferences by the press of a button using SNM_GetIntConfigVar() and SNM_SetIntConfigVar().

"Maximum number of lanes, when showing overlapping items in lanes"

It works fine so far but I have to click into the window or scroll before Reaper updates the view to the new number of lanes. I have searched the forum for "refresh GUI and scripts" but most results only applied to scripts that actually have a GUI and mine obviously hasn't. At the moment I quickly zoom in and out horizontally via the script but the short flicker is pretty distracting

Is there a way to force Reaper to update its arrange view or the entire window?
fripholm is offline   Reply With Quote
Old 06-26-2019, 01:01 PM   #2
Human being with feelings
nofish's Avatar
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,118

Maybe UpdateArrange() or UpdateTimeline() (not sure if it'll work)
nofish is offline   Reply With Quote
Old 06-26-2019, 01:14 PM   #3
Human being with feelings
mespotine's Avatar
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,639

Which config-var(s) are you altering? Some don't update the UI, when changed and this might be such a case.

Would love to add this information to my docs then and maybe, there's another way to achieve the same thing.

Edit: You can try PreventUIRefresh to prevent a refresh of the ui during zoom. Maybe that works as hack, maybe it doesn't...
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is online now   Reply With Quote
Old 06-27-2019, 12:06 AM   #4
Human being with feelings
Join Date: Jan 2011
Posts: 28

Both suggestions work great, thanks guys. I've settled for the shorter one but Meo's hack using PreventUIRefresh and horizontal zooming does the job, too.

For those interested, this is the one that increases the number up to a maximum of 10 visible lanes.

itemlanes = reaper.SNM_GetIntConfigVar('maxitemlanes', 0)

if itemlanes < 10 then
  reaper.SNM_SetIntConfigVar('maxitemlanes', itemlanes+1)
There's another one that decreases the number which is obviously very similar.
fripholm is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 04:45 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.