Joined: 24 Apr 2007
|Posted: 1 Nov 2014 18:35 Post subject: Writing Colorful Reports via Scilex Controls
| Writing Colorful Reports via Scilex Controls
The project deposited at http://franknagy.atw.hu/Tipp/Colorful website describes the creation and usage of colored, styled and formatted texts in Scilex controls invoked from Visual Prolog 7.5 programs. This is embedded in an example program which contains other tricks like
User-friendly font handling
Error capturing and reporting
Extended common dialogs
Interface to help files
Organization of styles into databases
Origin of the Problem
The earlier versions of Visual Prolog contained a message window where the programmer could redirect the standard output and show the results of the program. The message control embedded in the message window, however, could display all of its received text in the same font face and size. The necessity to separate the occasional trace lines from the important, carefully formatted tables of the important results the programmers faced had to wait for the embedding of the more sophisticated control.
Generation of Colored and Styled Reports
The VIP Support Team answered to the author's question that typographic tricks would be available in later versions of the Visual Prolog when the internal editor and the message control would be replaced by the Scintilla editor.
Solution by SciLexer
The developer team of the Visual Prolog language has built in the Scintilla editor in the version 7.4. The sciLexer package provides comprehensive bindings to the Scintilla editor with language lexers, including a lexer for Visual Prolog code. See tutorial article. Thomas Linder Puls and Dominique F. Pannier have given the author the impetus in this thread of the visual Prolog Discussion Forum.
Supported Features of the Scilexer Controls
The author's goal was not the edition of the text written in the Scilexer controls. He wanted only to distinguish the trace lines from error and warning messages, tabulated and single line results. The predicates defining the styles and applying the to the recently written texts were enough from the scilexerBase, scilexer_native and scilexer_api modules. Unlike the example Dominique F. Pannier, his goal was not parsing the text of a whole file in order to perform syntax coloring but immediate styling of small fragments of the text. By the way if the styles are undefined when the text lines are appended to the contents of the scilex control then the later definition of the styles will be distinguish them as you can see from pressing the [Apply] button of the style set handling form of the test program.
Features of the styles
The styles are identified not only by an integer identifier.
They have foreground and background colors.
They have fonts with the usual attributes:
style flags: bold, italic, underlined.
The program extracts the font class from the Microsoft Font Structure describing the font. The font class may be monospace or proportional. It is an extremely important information because only monospace font are suitable to make tables without tabulators.
See also: http://wiki.visual-prolog.com/index.php?title=3rd:Colorful_Reports_within_Scilex_Controls
|| 150.11 KB
|| 3091 Time(s)