PRINT_FORMAT
The PRINT_FORMAT function is identical to the PRINT function with the addition of a STRING parameter to specify how the text should be formatted. Note that the formatting is only applied when running code in a graphical environment, e.g. XJRunner, XJDeveloper or XJIntegration using the XJTAG output box) and not from the command line.
Syntax
PRINT_FORMAT( STRING format, [ INT expression | STRING expression ] , ... )
Parameters
- format
- A string containing formatting information. See Format strings below for more details.
- expression
- An expression of type INT or STRING that is to be displayed.
Example
INT result; // Define a style for tracing; the size is not set and so is inherited from the application's options STRING traceStyle := "font=Courier New,colour=grey"; IF DEBUG THEN PRINT_FORMAT(traceStyle, "IC1.Test starting\n"); END; CALL("IC1", "Test")()(result); IF DEBUG THEN PRINT_FORMAT(traceStyle, "IC1.Test finished\n"); END; IF result != 0 THEN PRINT_FORMAT("colour=red,size=150%", "IC1 Test Failed\n"); END;
Format strings
The format string contains a comma separated list of formatting options. The available formatting options are:
- font
- Specifies the name of the typeface to use to display the text. The name is not case sensitive. If the font name is not found, then the system will silently ignore the error and use the default font that has been selected in the application options.
- size
- Specifies the size of the text to display. See below for the different ways this can be specified.
- colour or color
- Specifies the colour of the text. See below for the different ways this can be specified.
Any item that is not specified is inherited from the default settings that have been selected in either XJRunner or XJDeveloper.
Standard styles
The standard Globals.xje file that is included automatically in all new projects defines three constant styles:
- ERROR_STYLE
- For displaying error messages from XJEase code; the current value is "colour=red".
- WARNING_STYLE
- For displaying warnings from XJEase code; the current value is "colour=darkorange".
- DEBUG_STYLE
- For displaying debug output; the current value is "colour=darkgrey".
Font size
There are three ways that font size can be specified:
- In points
- This is the measurement of font size most widely used in other applications under Windows. Specify a number followed by pt, e.g. size=16pt.
- In pixels
- Make the font a particular size in pixels. px, e.g. size=20px.
- Relative size
- Make the font proportional in size to the default font size, e.g size=150% would make the text 50% bigger than the default font. Using relative sizes like this has the advantage that you can increase the default size in the application and all the text will scale accordingly.
Colour
There are two ways that colour can be specified:
- Named colours
- There are a number of pre-defined, named colours that can be used, which are listed in the table below. The name is not case sensitive.
- RGB value
- A hexadecimal value prefixed with a '#' that gives the red, green and blue colour values, with each component ranging from 0x00 to 0xff. For example, #000000 is black, #ff0000 is pure red, #00ff00 is pure green, #0000ff is pure blue and #ffffff is white.
Name | Value | Colour |
---|---|---|
Black | #000000 | |
Navy | #000080 | |
DarkBlue | #00008B | |
MediumBlue | #0000CD | |
Blue | #0000FF | |
DarkGreen | #006400 | |
Green | #008000 | |
Teal | #008080 | |
DarkCyan | #008B8B | |
DeepSkyBlue | #00BFFF | |
DarkTurquoise | #00CED1 | |
MediumSpringGreen | #00FA9A | |
Lime | #00FF00 | |
SpringGreen | #00FF7F | |
Aqua | #00FFFF | |
Cyan | #00FFFF | |
MidnightBlue | #191970 | |
DodgerBlue | #1E90FF | |
LightSeaGreen | #20B2AA | |
ForestGreen | #228B22 | |
SeaGreen | #2E8B57 | |
DarkSlateGray | #2F4F4F | |
DarkSlateGrey | #2F4F4F | |
LimeGreen | #32CD32 | |
MediumSeaGreen | #3CB371 | |
Turquoise | #40E0D0 | |
RoyalBlue | #4169E1 | |
SteelBlue | #4682B4 | |
DarkSlateBlue | #483D8B | |
MediumTurquoise | #48D1CC | |
Indigo | #4B0082 | |
DarkOliveGreen | #556B2F | |
CadetBlue | #5F9EA0 | |
CornflowerBlue | #6495ED | |
MediumAquaMarine | #66CDAA | |
DimGray | #696969 | |
DimGrey | #696969 | |
SlateBlue | #6A5ACD | |
OliveDrab | #6B8E23 | |
SlateGray | #708090 | |
SlateGrey | #708090 | |
LightSlateGrey | #778899 | |
LightSlateGray | #778899 | |
MediumSlateBlue | #7B68EE | |
LawnGreen | #7CFC00 | |
Chartreuse | #7FFF00 | |
Aquamarine | #7FFFD4 | |
Maroon | #800000 | |
Purple | #800080 | |
Olive | #808000 | |
Gray | #808080 | |
Grey | #808080 | |
SkyBlue | #87CEEB | |
LightSkyBlue | #87CEFA | |
BlueViolet | #8A2BE2 | |
DarkRed | #8B0000 | |
DarkMagenta | #8B008B | |
SaddleBrown | #8B4513 | |
DarkSeaGreen | #8FBC8F | |
LightGreen | #90EE90 | |
MediumPurple | #9370D8 | |
DarkViolet | #9400D3 | |
PaleGreen | #98FB98 | |
DarkOrchid | #9932CC | |
YellowGreen | #9ACD32 | |
Sienna | #A0522D | |
Brown | #A52A2A | |
DarkGray | #A9A9A9 | |
DarkGrey | #A9A9A9 | |
LightBlue | #ADD8E6 | |
GreenYellow | #ADFF2F | |
PaleTurquoise | #AFEEEE | |
LightSteelBlue | #B0C4DE | |
PowderBlue | #B0E0E6 |
Name | Value | Colour |
---|---|---|
FireBrick | #B22222 | |
DarkGoldenRod | #B8860B | |
MediumOrchid | #BA55D3 | |
RosyBrown | #BC8F8F | |
DarkKhaki | #BDB76B | |
Silver | #C0C0C0 | |
MediumVioletRed | #C71585 | |
IndianRed | #CD5C5C | |
Peru | #CD853F | |
Chocolate | #D2691E | |
Tan | #D2B48C | |
LightGray | #D3D3D3 | |
LightGrey | #D3D3D3 | |
PaleVioletRed | #D87093 | |
Thistle | #D8BFD8 | |
Orchid | #DA70D6 | |
GoldenRod | #DAA520 | |
Crimson | #DC143C | |
Gainsboro | #DCDCDC | |
Plum | #DDA0DD | |
BurlyWood | #DEB887 | |
LightCyan | #E0FFFF | |
Lavender | #E6E6FA | |
DarkSalmon | #E9967A | |
Violet | #EE82EE | |
PaleGoldenRod | #EEE8AA | |
LightCoral | #F08080 | |
Khaki | #F0E68C | |
AliceBlue | #F0F8FF | |
HoneyDew | #F0FFF0 | |
Azure | #F0FFFF | |
SandyBrown | #F4A460 | |
Wheat | #F5DEB3 | |
Beige | #F5F5DC | |
WhiteSmoke | #F5F5F5 | |
MintCream | #F5FFFA | |
GhostWhite | #F8F8FF | |
Salmon | #FA8072 | |
AntiqueWhite | #FAEBD7 | |
Linen | #FAF0E6 | |
LightGoldenRodYellow | #FAFAD2 | |
OldLace | #FDF5E6 | |
Red | #FF0000 | |
Fuchsia | #FF00FF | |
Magenta | #FF00FF | |
DeepPink | #FF1493 | |
OrangeRed | #FF4500 | |
Tomato | #FF6347 | |
HotPink | #FF69B4 | |
Coral | #FF7F50 | |
Darkorange | #FF8C00 | |
LightSalmon | #FFA07A | |
Orange | #FFA500 | |
LightPink | #FFB6C1 | |
Pink | #FFC0CB | |
Gold | #FFD700 | |
PeachPuff | #FFDAB9 | |
NavajoWhite | #FFDEAD | |
Moccasin | #FFE4B5 | |
Bisque | #FFE4C4 | |
MistyRose | #FFE4E1 | |
BlanchedAlmond | #FFEBCD | |
PapayaWhip | #FFEFD5 | |
LavenderBlush | #FFF0F5 | |
SeaShell | #FFF5EE | |
Cornsilk | #FFF8DC | |
LemonChiffon | #FFFACD | |
FloralWhite | #FFFAF0 | |
Snow | #FFFAFA | |
Yellow | #FFFF00 | |
LightYellow | #FFFFE0 | |
Ivory | #FFFFF0 | |
White | #FFFFFF |
See Also
XJTAG v4.1.100