Color column labels and attribute backgrounds

Someone asked if I could color the column labels of a particular view a color, and if I could color the background color of the various obj-attr values in the view, based on attribute values.

Note this is different than coloring the text of the attribute which you can do with the GUI.

Any thoughts? Canvases?

  • Louie

llandale - Tue Oct 20 14:59:16 EDT 2009

Re: Color column labels and attribute backgrounds
djakad - Tue Oct 20 17:20:25 EDT 2009

I don't know any way to change the color of column headings (normally gray).

It is possible to highlight text in various colors, in a Layout DXL column, with use of the \\highlight Rich Text tags (also need a Color Table). The following thread gives some clues and examples:
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14272423

With canvases, you could probably simulate columns... but would probably take quite a bit of work.

Re: Color column labels and attribute backgrounds
Peter_Albert - Wed Oct 21 06:23:52 EDT 2009

djakad - Tue Oct 20 17:20:25 EDT 2009
I don't know any way to change the color of column headings (normally gray).

It is possible to highlight text in various colors, in a Layout DXL column, with use of the \\highlight Rich Text tags (also need a Color Table). The following thread gives some clues and examples:
https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14272423

With canvases, you could probably simulate columns... but would probably take quite a bit of work.

The colour of the column headings is set globally (from the database explorer select Tools --> Options; then the "Display" tab. The column headings colour is set via "Title Background". With that I have my doubts that you can set the colour for individual columns.

As for canvases, I have attached a small script I wrote some time ago to display attribute values on a coloured background, based on an enumerated attribute value. At the end you will find three examples on how to use it. It was a bit tricky to get proper line breaks in, and to add additional line breaks when the text is longer than the canvas width. Then, in this case, you don't want the extra line breaks to appear within words.

Well, it works for me, but I can't guarantee it works in all cases. And it uses strings, so if you get memory problems, it might be worth converting it into using buffers.

Note that text on canvas columns does neither export into Excel nor into Word!

Regards,

Peter
Attachments

attachment_14307161_canvas.inc