Change button icon depending on open/closed toolbars?


I would like a button with a down arrow icon when the toolbars are closed. Then the icon changes to an up arrow when the toolbars are open.

Is this possible in DO11 with the new @icon modifier? If so, could some kind soul help me with the code? The icons would be called "arrow_up" and "arrow_down" and/or is it possible to point to my own .png's?

One button I'm using is to open/close the default toobars to quickly look stuff up

@toggle:disable Toolbar "Menu" STATE=top LINE=0 TOGGLE Toolbar "Operations" STATE=top LINE=1 TOGGLE


It doesn't support it directly, because @icon can only test Set command clauses, and toolbar state is controlled by the Toolbar command.
However you could do it using a variable that both manages the icon and controls what the button does.

Thanks for that info, Jon. That's good news, I guess. Still wouldn't know how to write that kind of code though :wink:

Try this:

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>Toolbars</label> <icon1>#closetoolbar</icon1> <function type="normal"> <instruction>@toggle:if $lst!:ToolbarsShown</instruction> <instruction>@icon:deftoolbar,$lst!:ToolbarsShown</instruction> <instruction /> <instruction>@ifset:$lst!:ToolbarsShown</instruction> <instruction>@set lst!:ToolbarsShown</instruction> <instruction>Toolbar &quot;Menu&quot; CLOSE</instruction> <instruction>Toolbar &quot;Operations&quot; CLOSE</instruction> <instruction /> <instruction>@ifset:else</instruction> <instruction>@set lst!:ToolbarsShown=1</instruction> <instruction>Toolbar &quot;Menu&quot; STATE=top LINE=0 </instruction> <instruction>Toolbar &quot;Operations&quot; STATE=top LINE=1 </instruction> </function> </button>

That works awesome! Thank you so much, Jon!

I never, ever would have gotten that on my own :open_mouth: