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

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

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:
-- 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:

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