Author Topic: Setting Account Background Colors  (Read 6025 times)

precisonline

  • President
  • Administrator
  • Rock Star
  • *****
  • Posts: 1609
    • Precision Solutions
Setting Account Background Colors
« on: May 31, 2007, 10:39:47 am »
This morning a good friend and customer asked me if there was a way to set the background colors for screens in particular accounts so that his users could see when they were in DEV, TEST, production, or any other account.  What a great idea!  I've seen this done before with multiple machines, but never with different accounts on the same machine.

Looking through the SB+ configuration, there's no default background color that can be set with configuration - except on the terminal definition.  And considering there's no (easy) way to force a particular terminal definition to be selected when someone logs into a particular account, having multiple terminal definitions with different background colors isn't much of a solution.

But this got me thinking.  If the colors are on the terminal definition, why not use the Proc At Set Common to manipulate the terminal definition in the session's @TERM.DEFN variable?  This led to a little process called SET.COLOR which looks like this:

LOCAL L.FG,L.BG,L.LO
*
L.BG = @PARAM"G0,1"
L.FG = @PARAM"G1,1"
L.LO = @PARAM"G2,1"
*
@TERM.DEFN<14,1> = @TERM.DEFN<21,L.FG> : @TERM.DEFN<22,L.BG>
@TERM.DEFN<14,3> = @TERM.DEFN<22,L.BG> : @SVM : @TERM.DEFN<21,L.FG> : @SVM : @TERM.DEFN<21,L.LO>

Calling this process on the Proc at Set Common via:

SET.COLOR,bg,fg,lo

...where bg,fg, and lo are color numbers (from /TERM.DEFN F5-Color) sets up the color for that session in that account without having to have specific terminal definitions for individual accounts.  Certainly, this is just a beginning to the idea, but this could easily be expanded to control any of the terminal color configurations in attribute 14 of @TERM.DEFN.
-Kevin
Accidents "happen"; success, however, is planned and executed.