I have a generated report in Informix 4GL that prints to the screen. I need to have one column displayed in reverse format. I tried the following:
print line_image attribute(reverse)
But that doesn't work. Is this possible at all?
I have a generated report in Informix 4GL that prints to the screen. I need to have one column displayed in reverse format. I tried the following:
print line_image attribute(reverse)
But that doesn't work. Is this possible at all?
If you mean "is there any way at all to do it", the answer's "yes". If you mean "is there a nice easy built-in way to do it", the answer's "no".
What you'll need to do is:
brv
(begin reverse video; choose your own name if you don't like mine).erv
(end reverse video).Arrange for your printing to use:
PRINT COLUMN 1, first_lot_of_data,
COLUMN 37, brv, reverse_data,
COLUMN 52, erv,
COLUMN 56, next_lot_of_data
There'll probably be 3 or 4 characters needed to switch. Those characters will be counted by the column-counting code in the report.
Different terminal types will have different sequences. These days, the chances are your not dealing with the huge variety of actual green-screen terminals that were prevalent in the mid-80s, so you may be able to hardwire your findings for the brv
and erv
strings. OTOH, you may have to do some fancy footwork to find the correct sequences for different terminals at runtime. Shout if you need more information on this.
A simple way which might allow you to discover the relevant sequences is to run a program such as (this hasn't been anywhere near an I4GL compiler — there are probably syntax errors in it):
MAIN
DISPLAY "HI" AT 1,1
DISPLAY "REVERSE" AT 1,4 ATTRIBUTE(REVERSE)
DISPLAY "LO" AT 1, 12
SLEEP 2
END MAIN
Compile that into terminfo.4ge
and run:
./terminfo.4ge # So you know what the screen looks like
./terminfo.4ge > out.file
There's a chance that won't use the display attributes. You'd see that if you run cat out.file
and don't see the reverse flash up, then we have to work harder.
You could also look at the terminal entry in the termcap
file or from the terminfo
entry. Use infocmp $TERM
(with the correct terminal type set in the environment variable) and look for the smso
(enter standout mode) and rmso
(exit standout mode) capabilities. Decipher those (I have rmso=\E[27m
and smso=\E[7m
for an xterm-256color
terminal; the \E
is ASCII ESC or \033
) and use them in the brv
and erv
strings. Note that rmso
is 5 characters long.
Adding on to the previous answer, you can try the following
print "\033[7mHello \033[0mWorld"
\033[7m means to print in reverse. And, \033[0m means to go back to standard.