View Single Post
Old 02-11-2019, 03:06 PM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 8,457
Default

Dummy toggles were originally added to do cycle actions with actions that don't have a 'real' toggle state I think.

https://forum.cockos.com/showpost.php?p=1090262

But as mentioned there, they can go out of sync.

The more 'proper' way to support a toggle toolbar with a defer script is to do something like this I think:

at script start:
Code:
-- set toolbar button to on
is_new_value,filename,section_ID,cmd_ID,mode,resolution,val = reaper.get_action_context()
reaper.SetToggleCommandState(section_ID, cmd_ID, 1)
reaper.RefreshToolbar2(section_ID, cmd_ID)
and when script stops:
https://www.extremraym.com/cloud/rea...oc/#lua_atexit


Code:
-- set toolbar button to off
reaper.SetToggleCommandState(section_ID, cmd_ID, 0);
reaper.RefreshToolbar2(section_ID, cmd_ID);
nofish is offline   Reply With Quote