Skip to content

Customize CustomFrameColor

Patrick edited this page Oct 22, 2021 · 2 revisions

This hook enables you to change the background color of the DataDigger window.

Although you can use this in a variety of way, like having a different color for each day of the week, there are also useful scenarios for this. When you use the DataDigger to connect to databases in different environments, you might want to have a visual clue that you are in a certain database. For example, if you connect to a production database. In the example below I check whether a database with 'prod' in the name is connected. If so, the frame will be colored yellow. I also check on sports to show that you need to check for the important connections first.

PROCEDURE customFrameColor:
  DEFINE OUTPUT PARAMETER pcFrameColor AS CHARACTER NO-UNDO.

  DEFINE VARIABLE cDatabases AS CHARACTER NO-UNDO.
  cDatabases = getDatabaseList().

  IF cDatabases MATCHES '*prod*' THEN 
    pcFrameColor = '14'. /* Progress color nr for yellow  */
  ELSE 
  IF cDatabases MATCHES '*sports*' THEN 
    pcFrameColor = '200,255,200'. /* RGB for light green */
  ELSE 
    pcFrameColor = ?. /* sets to default color */
END PROCEDURE.    

See also: CustomBorderColor

Please note:

  • The function getDatabaseList is a core-DataDigger function that returns a comma separated list of all connected databases.
  • Procedure setFrameColor accepts a string that has either a progress color number ('14') or an RGB value ('200,255,200') or an unknown for default coloring.

Normally the DataDigger looks like this:

When I connect to a sports database, the window changes to:

And when I connect a production database: