Example: Designing a column for user-customizable color

In an application that lists animal descriptions and allows users to set color preferences, the following properties are set:

  1. On the Options tab of the View Properties box, the "Allow customizations" option is checked.
  2. The first column of the view, named PD1 has the following options set on the Column Info tab of the Column Properties box:
    • "Use value as color" is checked.
    • "User definable" is checked.
    • The "Profile Document" field has the value "DEF"
    • In the Programmer's pane, the Column Value for PD1 is set to a formula that offers some color choices:

      Red := 255:0:0;

      Purple := 128:0:128;

      Blue := 0:0:128;

      DkGreen := 0:160:0;

      Brown := 130:66:0;

      PaleYellow := 255:255:208;

      Tan := 224:161:117;

      DefaultColor := 0:0:0;

  3. The DEF profile document is coded as follows:
    Color schemes for user customizable dialog colors:
    Use this color for Koala:   [  Koalacolor]
    Use this color for Giraffe:   [Giraffecolor]
    Formula for view to read from profile doc:  [PD1 ]
    Note: Koalacolor and Giraffecolor are color fields which automatically present a color picker to the user. The PD1 field is critical -- PD1 is the name of the field and the programmatic name of the column in the view/folder that uses the profile document. This field ties the profile document to the column.
  4. The PD1 field has the following formula as its value:
    DkGreen := 0:160:0;
    PaleYellow := 255:255:208;
    @If(dialog ="\"giraffe\";"+"\""+GiraffeColor+"\""+";
    (dialog=\"koala\");"+"\""+KoalaColor+"\""+";PaleYellow:DkGreen)")
    Note: In this formula the color fields, KoalaColor and GiraffeColor, return RGB color coordinates. These values needs to be passed to the parser as a string -- thus the double set of quotes around the field names. If the formula just specified "GiraffeColor", the quotes would be stripped off during parsing, and the result would be a numeric coordinate instead of a string list. Therefore, the formula uses the backslash and the quotation mark (\") to pass the quotation mark (") to the parser as a character. If you are experiencing problems with a formula, check that your quotes are done correctly.