Toggle Lock on/off doesn't work - help requested

I have a button with following programming:

@if Tablock=off
GO Tablock=lock
@if:else
GO Tablock=lock

I'm trying to make a button that will toggle the lock state of the tab or tabs selected.

I don't understand why the above doesn't work. Please help.

You're running Go TABLOCK=lock in both cases, so it will only ever lock the tab. @if also needs to be told the command you're testing the argument for (unless it's the Set command, which is assumed if no command is specified).

This would work:

@if:Go TABLOCK=off
Go TABLOCK=lock
@if:else
Go TABLOCK=off

But there is also a command to do what you want in a single line:

Go TABLOCK=lock,toggle

Edit: Some or all of the above may not work back in Opus 10. I've only tested with Opus 12.

Thank you, I understand now.