Writing Colorful Reports via Scilex Controls

Introduction

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. 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.

Deposited files

The demo project can be downloaded from the franknagy.atw.hu/Tipp/InstallColorful.zip archive.

Tree of folders


Tree of Folders Sub-Folder Contents Selective
Installation*
Project folder
. The project folder contains the main program and the project maintenance files necesssary for the Visual Prolog 7.5 PE. IV
Exe Executable test program
and the necessary DLL-s.
I
II
ColorfulReports_tmphhp Sub-folder of the online manual (CHM help). All
Data Sub-folder of saved style sets. All
Auxiliary Auxiliary procedures handlings string, filename a timestamps. III
Enhanced_Report Sub-folder of style defining and testing procedures. III
Extended_Dialogs Extended common dialogs (more than 3 choices). III
FontFormat Font handling class. III
Help Interface to online help. III
MyErrHan Error handling and reporting via scilex control. III
Pictures Individual screenshots (embedded in the online help).
TaskWindow Main event, menu and form handler of the test program. III
Toolbars Upper status line. III
Deb Reserved for debugging. IV
Obj Reserved for object modules. IV
    *Selective installation
  1. You want to run the test program. You have the personal or commercial edition of Visual Prolog 7.5.
  2. You want to run the test program. You don't have the personal or commercial edition of Visual Prolog 7.5.
  3. You want to undesrtand how it works.
  4. You want to modify its source and/or documentation.



Other Websites of the Program

Visual Prolog Discussion Forum
Visual Prolog Wiki