enjoying new media • software aesthetics

Using Rules

../../WorkingWithTinderbox/elements/Rule.jpg

We can also add Rules to a prototype to enforce constraints. Where OnAdd actions are suggestions which you can overrule, rules are requirements: Tinderbox's rule manager runs constantly to enforce them.

For example, let's add a rule to our prototypical JournalEntry:

Entries on Sundays are light gray; all the rest are black.

This sort of zebra-striping helps the pattern of weeks stand out, and makes long lists easier to read. But it might not be right for you. Maybe you write a column that’s due on Tuesday and Friday. Maybe you want highlight alternate days. Lots of choices; that’s why we have flexible rules and not simply a menu of styles.

Think twice if you find yourself wanting Tinderbox to replace your calendar. Calendars are great, and repeating events are one of the things they do well. You could write a calendar in Tinderbox, but you're probably better served by letting the calendar do its thing and using Tinderbox to do stuff that nothing else can do.

The rule for our light gray Sundays is, simply:

if(format($Date,"W")="Sunday") {Color="lightest warm gray"} else {Color="black"}

And here's what it looks like in Outline view:

Perhaps we don’t want to use color to distinguish Sunday. We’ve got lots of other options. For example, we might choose a special font for Sunday:

or we might make Sunday's serve as separators

if(format($Date,"W")="Sunday") {IsSeparator="true"} else {IsSeparator=""}

 

Sponsored by Eastgate

serious hypertext

Tekka, 134 Main Street, Watertown MA 02472 USA. email: editor@tekka.net info@tekka.net    voice: +1 (617) 924-9044 (800) 562-1638

© Copyright 2009 by Eastgate Systems, Inc. All Rights Reserved