3rd:Colorful Reports within Scilex Controls

From wiki.visual-prolog.com

Revision as of 11:37, 29 October 2014 by Ferenc Nagy (talk | contribs) (New page: == Colorful Reports within Scilex Controls == '''Introduction ''' This help file describes the creation and usage of colored, styled and formatted texts in Scilexer controls invoked fr...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Colorful Reports within Scilex Controls

Introduction

This help file describes the creation and usage of colored, styled and formatted texts in Scilexer 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
  • Providing tooltips

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.

  • The styles are identified not only by an integer identifier.
  • They have foreground and background colors.
  • They have fonts with the usual attributes:

name, size, style flags: bold, italic, underlined.

  • The program extracts the font class from the Microsoft Font Structure describing the font. The fonc class may be monospace or proportional. It is an extremely important information because only monospace font are suitable to make tables without tabulators.

Remark: The script system code, or character set cannot be changed for individual styles in can be changed only globally for the scilex control. The user selects it in vain in the font dialog.



How to Get?

The program is available from the author's homepage. Visit the index page of the program for installation instructions.