Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: override error bgcolor  (Read 13887 times)
Alessandro (Efisio) R.
Posts: 42

« on: December 22, 2014, 04:39:38 pm »


I am trying to set a background color to all error messages with the pseudo selector "Message:error".

From ERROR instruction section of the BDL manual
If you want to apply automatically a style to all program warnings displayed with the ERROR instruction, you can use the :error pseudo selector in the style definition.

From message style attributes section of the BDL manual
Like simple form fields, TTY attributes have a higher priority than style attributes. By default, ERROR has
the TTY attribute REVERSE, which explains why ERROR messages have a reverse background even when
you use a backgroundColor style attribute.

So, if I want to apply a background color only with a style attribute without adding on every ERROR instruction any option and overriding the default tty style?

Sebastien F.
Four Js
Posts: 512

« Reply #1 on: December 23, 2014, 11:36:12 am »


Consider centralizing your ERROR instructions in a function, and use ATTRIBUTES(NORMAL) to remove the default REVERSE TTY attribute, and have your style background color applied... for example:

  1. FUNCTION my_error(m, s)
  2.   DEFINE m, s STRING
  3.   IF s IS NULL THEN
  5.   ELSE
  7.   END IF
Alessandro (Efisio) R.
Posts: 42

« Reply #2 on: December 23, 2014, 12:09:36 pm »

Thanks Seb. I thought there was a way to override that attribute without editing all the project.
Reuben B.
Four Js
Posts: 1066

« Reply #3 on: January 04, 2015, 10:51:18 pm »


Mathematically what does the REVERSE attribute actually do?

When I first read this thread, my first instinct was that even if ERROR had an implicit REVERSE attribute, that this could be overcome by simply swapping the values of the textColor and backgroundColor attributes in the .4st, or perhaps set the RGB colour values in the style to be a ones complement of the desired RGB colour value, however neither of these techniques worked.  It was as if the implicit REVERSE was setting a hard-coded grey as the background-color.

Looking forward, is the implicit REVERSE actually required?.  It seems an unnecessary complication that could perhaps be removed and replaced with a suitable entry in default.4st if needed. 


Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of
Contributor to
Sebastien F.
Four Js
Posts: 512

« Reply #4 on: January 05, 2015, 01:32:16 pm »


When using a REVERSE TTY attribute in the code, the VM just sets a dedicated "reverse" attribute in the AUI node for the element. We have other TTY attributes such as "blink", "underline", "color" ...

The rendering of these TTY attributes is then in the hands of the front-ends, for "reverse", front-ends can mimic what you could get on dumb terminals with "reverse video" character highlighting.

ERROR has been implemented with an implicit "reverse" attribute, because in I4GL text mode, the error message displays in reverse-video.

Swapping textColor/backgroundColor does not help, because element-specific TTY attributes have a higher precedence as style attributes.

Maybe we could have had a global option, to define the default TTY attributes for ERROR:


Centralizing error message display in a function is anyway a good pattern to me.

Alessandro (Efisio) R.
Posts: 42

« Reply #5 on: January 05, 2015, 03:10:42 pm »

Reading the BDL manual, the NORMAL tty attribute appears to be a font attribute instead of REVERSE, which is a video attribute. And this is why applying your suggestion and centralizing with a function that uses ERROR ATTRIBUTES (NORMAL, STYLE...) doesn't let me choose a textColor in the Message:error. I partially resolved using the BLINK attribute, which doesn't make any graphical effect in GUI mode and maybe overrides some other 4st styles that are useless for me.
Pages: [1]
  Reply  |  Print  
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines