The sciLexer provides comprehensive bindings to the Scintilla editor with language lexers. Including a lexer for Visual Prolog code.

The sciLexer is the editor in the IDE, and it is the message window in all applications (unless you explicitly use the deprecated vpiMessage window).

sciLexer internally works in utf-8 mode, but the bindings uses standard Visual Prolog string domain (utf-16).

sciLexer control

To use the sciLexer in a dialog or form:

  • first make sure that the pfc\gui\controls\sciLexer package is added to the project, and that the project has been compiled
  • then add the sciLexer to the dialog/form as a custom control

The contents of the editor is available as the properties text and textUtf8.

    text : string.
    textUtf8 : string8.
    % @short
    % The entire text of the editor.
    % If you then save the text, you should use setSavepoint to mark the text as unmodified.
    % @end

The editor example (IDE: Help | Install Examples...) allong with other things shows how to bind menu and keyboard commands to the editor.


Lexers are used to provide token coloring and region collapsing of for certain (programming) language.

The sciLexer have lexers for over 100 languages, including Visual Prolog.

The lexers for Visual Prolog, C/C++, HTML and XML are in particular easy to use.

You simply call one of the predicates:

    lexerDefault_visualProlog : ().
    lexerDefault_cpp : ().
    lexerDefault_html : ().
    lexerDefault_xml : ().
    % @short
    % Use lexer and set default styles for the lexer.
    % Before calling this predicate set style_default as desired (for exampel by calling setDefaultLexerStyle)
    % @end

To use other languages it is normally necessary to set the keywords for the language and define colors, etc. for the styles of the language. The code for the predicates mentioned above illustrates how that is done.

copy not only place plain text on the clipboard, it also places a HTML text reflects the token styling. So when you paste into HTML aware editors (like Microsoft Word) token styling will be preserved.