Should "@if:Set" work with multiple check commands?

I have the SPACE key bound to toggling the viewer pane on/off and between vert/horiz mode.

Now I’d also like to use SPACE for toggling checkboxes when in checkbox mode.

I tried to implement that with the following button:

@toggle:if Set VIEWPANE=On

@if:Set CHECKBOXMODE=On
Select TOGGLECHECKS

@if:Set VIEWPANE=Off CHECKBOXMODE=Off
Set VIEWPANE=On,Vert

@if:Set VIEWPANE=On,Vert CHECKBOXMODE=Off
Set VIEWPANE=On,Horiz

@if:Set VIEWPANE=On,Horiz CHECKBOXMODE=Off
Set VIEWPANE=Off

Result

With checkbox mode turned on, this works as expected. However, when checkbox mode is off, the viewer pane just flickers between vert/horiz and then disappears when pressing SPACE.

Question

The docs on SET indicate that SET can be used with multiple options, such as Set DUAL=on TREE=off. I wonder whether the @if:Set command modifier is also meant to work with multiple options, such as @if:Set VIEWPANE=On,Vert CHECKBOXMODE=Off? If so, why doesn’t the above script work as expected?

Many thanks!

Works with the evaluator in the mix.

@toggle:if Set VIEWPANE=On

=checkbox=IsChecked("Set CHECKBOXMODE=On")
@if:=checkbox
Select TOGGLECHECKS

@if:=IsChecked("Set VIEWPANE=Off") && !checkbox
Set VIEWPANE=On,Vert

@if:=IsChecked("Set VIEWPANE=On,Vert") && !checkbox
Set VIEWPANE=On,Horiz

@if:=IsChecked("Set VIEWPANE=On,Horiz") && !checkbox
Set VIEWPANE=Off

Thank you so much @yonder.

Since opening this thread, I was playing around with an evaluator-based solution as well. Here’s what I got (and worked in the end as well):

@toggle:if Set VIEWPANE=On

// both lines below work
//@evalalways:viewpane_mode=IsChecked("Set VIEWPANE=Off", "SET VIEWPANE=On,Vert", "SET VIEWPANE=On,Horiz")
=viewpane_mode=IsChecked("Set VIEWPANE=Off", "SET VIEWPANE=On,Vert", "SET VIEWPANE=On,Horiz")

=checkbox_mode=IsChecked("Set CHECKBOXMODE=On")

@if:=checkbox_mode
Select TOGGLECHECKS

@if:=viewpane_mode==1 && ! checkbox_mode
Set VIEWPANE=On,Vert

@if:=viewpane_mode==2 && ! checkbox_mode
Set VIEWPANE=On,Horiz

@if:=viewpane_mode==3 && ! checkbox_mode
Set VIEWPANE=Off

That said, wouldn’t it be nice if @if:Set worked with multiple options, such as @if:Set VIEWPANE=On,Vert CHECKBOXMODE=Off? :slight_smile: (@Leo, @Jon)

Actually it does :slight_smile: But you need to separate the different options with a semi-colon, not a comma.

@if:Set VIEWPANE=On,Vert;Set CHECKBOXMODE=Off

Oh cool, that’s good to know, thanks @Jon.

The docs on @if:Set do not list an example using ; and the docs on SET outline a different syntax, namely Set DUAL=on TREE=off. This could be improved.

For the record, here’s the updated button code that works as expected:

@toggle:if Set VIEWPANE=On

@if:Set CHECKBOXMODE=On; Set VIEWPANE=Off
Select TOGGLECHECKS

@if:Set CHECKBOXMODE=Off; Set VIEWPANE=Off
Set VIEWPANE=On,Vert

@if:Set CHECKBOXMODE=Off; Set VIEWPANE=On,Vert
Set VIEWPANE=On,Horiz

@if:Set CHECKBOXMODE=Off; Set VIEWPANE=On,Horiz
Set VIEWPANE=Off