Toggle button for topmost

Is it possible to make a toggle-button which runs:
Set LISTERCMD ontopon (and off)
and toggles with LMB only?

I've made it with three-button, but that requires LMB for ON and RMB for OFF.
Also, is it possible that for toggled state another icon is used (for example red pin when ON, and green when OFF)?

@toggle:If Set LISTERCMD=OnTopOn 
@if:Set LISTERCMD=OnTopOn 
Set LISTERCMD=OnTopOff
@if:else
Set LISTERCMD=OnTopOn 

The first line makes the button appear pushed in when in the "on" state. The rest of the lines do the actual toggling (if it's currently on, turn it off, and vice versa).

1 Like

Worked perfectly (and used @icon functionality to change button's icon dynamically), thank you Leo!

1 Like