Manage Learn to apply best practices and optimize your operations.

Background Color On Documents

Everybody knows that you can play with the background color of forms, and also
that individual documents can be assigned a background color (or even
background graphics). Just enter a document in edit mode, choose Document
Properties, and use the Background-tab.

This is a little fun. What's a lot of fun is what you can do this in code. The
whole secret is the field $PaperColor. This is a number field which holds the
integer value for the color that is to be used for the background. The possible
values can be deducted from a standard Notes color picker. Just count left to
right and top to bottom, starting with zero (0=black, 1=white, 2=red, 3=green,
4=blue etc.) and skipping the first two lines (the standard 16-color palette).
Every row starts with a multiple of 16 (0, 16, 32 etc.) With this knowledge you
can indicate the status of documents, e.g. customers who don't pay their bills
show up in heavy red, approved documents get a green background etc. And when
the indicator is no longer needed, you can remove it and let the form default
take over.

As with most things Notes-like there is a small problem. You can't change the
field in QuerySave. (I think it's got something to do with the sequence a
document follows backend when it is saved.) You have to do all dynamic changes
in QueryClose, which means you'll have to set a global flag indicating whether
the document has been saved. See the example in the code below.

Oh, and the code contains another neat trick: $-fields *can* be referenced by
extended syntax. Just place a ~ (tilde) before the $-sign and everything is OK.
(Declarations, Globals)
Dim GlobalSaveFlag as Integer


GlobalSaveFlag = Continue ' So that if anything else modifies
' Continue, it is detected.
End Sub


If GlobalSaveFlag Then
' Remove?
Call document.RemoveItem("$PaperColor")
' Change?
document.~$PaperColor = ... ' Whatever
End If
End Sub

This was last published in November 2000

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...