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

QuerySave:


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

QueryClose:

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

This was first published in November 2000

Dig Deeper

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close