Pre and post Incremental operators in variables?

Hi!

The verbose form of incrementing is supported. For instance, your “plus” button could say:

OnClick
  Set text of (widget) "counter" to (value) [[Target.text + 1]]

…no global variables required. Similarly, if you wanted to increment the text in a widget by clicking the widget itself, you could say:

OnClick
 Set text of (widget) This to (value) [[This.text + 1]]

If you need to access properties of widget that is neither the target of the command or the receiver of the event, you’d use a local variable where Target or This above sits.

The global variable “varName” can be incremented with:

Set varName to (value) [[varName + 1]]

You are correct that [[varName++]] is not supported.

1 Like