Code to Automate Flags with additional vertical colors?

I have used Flags sporadically in the past. But now with the fairly recent change over the past months…flags are now visible on both map and outline view, I want to begin using them more extensively to give me additional visual cues.

Problem / Question: I have a flag with an EXISTING color and now want to add new colors to the note as I continue to process the note. How do I do that?

I got the inspiration from watching the great meetup with MarkA talking about how to use Tom Webster’s Sort Map with Tinderbox - revisited. See Link below.
Definitely worth revisiting!

What I want is something like this:


to give me vertical striping as I consecutively choose to add colors. I know I can manually add them, but want an automating way of creating,coding and adding Flags(color) to put into an edict

I have tried $Flags += “white” to a note with a green flag and I get this:
$Flags=green;white instead, which obviously does not work since it just replaces the color with the first.

Is there a way to code additional colors to a note with a flag using and if…then statement?

Thanks in advance


$Flags is a list, so adding “white” to $Flags adds a white flag!

If you want to add a stripe to the first flag, you might try:

var:string first=$Flags[0];
first = first + "white";
1 Like

Many thanks for the coding tip MarkB. Great learning experience.
For those following along…

Here is the code that worked for me…


Many thanks

(@TomD knows this) but for later readers wondering about flags, see: Note Flags.

From my own experimentation, as part of documenting the feature, I’d encourage people to try encoding style in flags before imagining a complex set of flag-based signals. Consider:

  • you’ve limited display space (pixels), and so packing in too much dsta may not work (bad news if you’ve already planned on that not being the case)
  • ‘standard’ named colours, which are now quite muted (i.e. not eye-searing as note colour fills) may not work so well in flags. If you need sharper course you can add your own new named colours or simply use hex values (i.e. #NNNNNN)
  • For textual content the 3-displayed-character limit is real, don’t assume otherwise (e.g. that Tinderbox will squeeze in extra text because we want that). Why? See the first bullet above.
  • Maps (plural) are only seen in map view. Outline view can show a notes first flag, but that doesn’t help if your signalling systems requires multiple flags.
  • Map icon width defines how many (of the defined) flags are displayed in the view pane. The default-width map icon will display up to 4 flags, or the first four listed flags if more than 4 are defined. By dragging the note wider, all flags can be displayed. But, there is no hint in-view that a note has more flags than are displayed. IOW: don’t assume you are seeing all the flags by default.
1 Like

Reviewing @eastgate wonderful Spatial Hypertext: Visual Grammar meetup today.
Great masterclass on how to use Visual grammar in your Tinderbox document…for the rest of us!

And the Map Grammar Tbx used in the presentation:


1 Like

I 'd thoroughly recommend looking at the TBX (link in post above above) offered alongside that meet.