Can you change the text on a toolbar 'Label'?

Is it possible to change the text on a toolbar 'Label' object from a Standard Function? Like when I change from Flatview Mixed to Flatview Grouped. Like a status info label?

Yes, using @label and Evaluator code.

Example and links to the relevant documentation here:

Thanks for the reply. I think I am close, but it always ends up just setting the label to "Flat Off".

@ifset:FLATVIEW=Off
Set FLATVIEW=Grouped
@eval:FView="Flat Group"
@label:FView
@toggle:update
@ifset:FLATVIEW=Grouped
Set FLATVIEW=Mixed
@eval:FView="Flat Folders"
@label:FView
@toggle:update
@ifset:FLATVIEW=Mixed
Set FLATVIEW=MixedNoFolders
@eval:FView="Flat Mixed"
@label:FView
@toggle:update
@ifset:FLATVIEW=MixedNoFolders
Set FLATVIEW=Off
@eval:FView="Flat Off"
@label:FView
@toggle:update

I also tried using @ifset:common at the bottom since the last 2 commands are the same for all. I thought it would just set the label without have it repeated 4 times.
...
@ifset:common
@label:FView
@toggle:update

But I didn't work. I though the @ifset:common signified the end of the group, and the code below it would just execute every time. But maybe the FView is out of context at the bottom?

The last @label: modifier overwrites the previous three.

You can do it in a single line at the top:

@label:=fv=IsChecked("Set FLATVIEW=Grouped","Set FLATVIEW=Mixed","Set FLATVIEW=MixedNoFolders"); return (fv==1?"Grouped":fv==2?"Mixed":fv==3?"No Folders":"Off");

Note that @ifset control which commands are run when the button is clicked. They don't affect things like @label and @icon, which have to be evaluated without actually running the button.

1 Like

Even simpler:

@label:=Select(IsChecked("Set FLATVIEW=Grouped","Set FLATVIEW=Mixed","Set FLATVIEW=MixedNoFolders"), "Off", "Grouped", "Mixed", "No Folders")
3 Likes

Awesome!! Thanks Mates!!

At first, I though that was to replace my code. But I finally added it to the top of my code and removed the @evals and @Labels.

Works great now!