Blog

All Blog Posts  |  Next Post  |  Previous Post

FNC & VCL: The best of both worlds, part 2: Syntax highlighting memos

Bookmarks: 

Tuesday, October 3, 2023

TMS Software Delphi  Components

Intro

In today's fast-paced software development world, writing efficient and error-free code is crucial. To aid developers in this endeavor, syntax highlighting memos have become indispensable tools. In this blog article, we will explore two powerful options for syntax highlighting memos: the VCL TAdvMemo and the FNC TTMSFNCMemo. We will delve into their features, architectures, and guide you when to use them in your application development.

Syntax Highlighting Memos Features

Syntax highlighting memos offer a plethora of features that make coding easier and more efficient:

  • Language Syntax-based Coloring: These memos colorize code based on the language syntax, making it easier to identify keywords, strings, numbers, comments and more ...
  • Code Completion: They provide code completion suggestions as you type, reducing coding errors and speeding up typing code.
  • Parameter Hinting: When working with functions or methods, these memos offer parameter hints, making it simpler to use the right arguments.
  • Code Folding: Developers can collapse sections of code to focus on specific parts of the codebase.
  • Code formatting: memos can automatically apply formatting to code based on code formatting rules.
  • Breakpoints and Bookmarks: Easily mark important sections of your code with breakpoints and bookmarks.

VCL TAdvMemo 

TMS Software Delphi  Components

A first option TMS software offers to add a syntax highlighting memo to your applications is TAdvMemo. The VCL TAdvMemo is a custom control built specifically for the VCL framework. It is based on 100% native Object Pascal code for the Windows operating system and it offers a custom code rendering engine and interaction capabilities via mouse and keyboard with the code. Language specifications and color settings for syntax styles are defined in a separate class known as TAdvCustomMemoStyler. TAdvCustomMemoStyler is the base class from which many derived classes are available with the specific syntax rules settings for the different supported languages. 

VCL TAdvMemo Additional Components

In addition to the core TAdvMemo control, there are several additional components that enhance its functionality:

  • TDBAdvMemo: A DB-aware version of the memo control designed for database applications.
  • TAdv*MemoStyler: Offers syntax highlighting for various programming languages, including Pascal, CSS, HTML, Basic, SQL, C#, Python, Perl, JavaScript, Lua, JSON, XML, INI, PHP, and more.
  • TAdvCodeList: Provides a visual code snippet list component.
  • TAdvMemoSource: Non-visual component for efficient memory management when editing multiple code files through a single TAdvMemo interface.
  • TAdvMemoStylerManager: Manages multiple memo styler instances and invokes the correct syntax styler based on file extension when opening a file.
  • TAdvMemoSpellChecker: Includes a spell-checking feature for TAdvMemo.
  • TAdvMultiFileMemo: Control offering a full tabbed multi-file editing experience with virtually no code to write.
  • TAdvMemoPDFIO: Offers PDF export capabilities for TAdvMemo (next to HTML & RTF export already built-in).
  • TAdvMemoToolBar and TAdvMemoRibbonToolBar: Provide customizable toolbars for the memo control.


FNC TTMSFNCMemo

TMS Software Delphi  Components

The FNC TTMSFNCMemo is a syntax highlighting memo designed for both VCL Windows applications and cross-platform development via the FireMonkey framework, Lazarus LCL framework or TMS WEB Core web framework. Its architecture is fundamentally different from the VCL TAdvMemo. TTMSFNCMemo is built upon a browser engine in which the JavaScript Monaco library exposes all code eding features. Note that the JavaScript Monaco library is the library that is the heart of the widely popular Microsoft Visual Studio Code IDE. It is a MIT licensed library, so fully safe to use in commercial applications. The number of languages supported by the Monaco library is huge:

plaintextfsharpmsdaxrestructuredtextwgsl
abapfreemarkermysqlrubyxml
apexgoobjective-crustyaml
azcligraphqlpascalsbjson
bathandlebarspascaligoscala
bicephclperlscheme
cameligohtmlpgsqlscss
clojureiniphpshell
coffeescriptjavaplasol
cjavascriptpostiatsaes
cppjuliapowerquerysparql
csharpkotlinpowershellsql
csplessprotost
csslexonpugswift
cypherluapythonsystemverilog
dartliquidqsharpverilog
dockerfilem3rtcl
eclmarkdownrazortwig
elixirmdxredistypescript
flow9mipsredshiftvb
This language can be selected via a simple TTMSFNCMemo.Language property. Of course, in TTMSFNCMemnu, all commonly expected syntax highlighting code editor features are available: auto-completion, code-folding, code snippet insertion, bookmarks & breakpoint indicators, ...   Uniquely available in TTMSFNCMemo is also the optional code mini-map. This is a rendered overview of the complete code file at the right of the memo for rapid code navigation. Of course, things like block selection, find & replace are all built-in. 

Comparison

VCL TAdvMemo
FNC TTMSFNCMemo
  • Windows only
  • Lightweight
  • Fine-grained control over styles
  • Additional helper components
  • 100% native Object Pascal code solution
  • Cross-platform, cross-framework
  • Support for many languages
  • Wide font type support
  • Look & feel same as Visual Studio Code
  • Reuse existing proven JavaScript library +
    its continues enhancements
  • Availability of mini-map of source code
  • Parametrized code snippet insertion

Webinar

We also held a webinar at TMS WebAcademy on this topic of syntax highlighting memos that you can view here:



Conclusion

The choice between these memos ultimately depends on your specific development needs and target platforms. Both tools excel at enhancing the coding experience and improving productivity. For both solutions, fully functional trial versions are included in TMS VCL UI Pack and TMS FNC UI Pack so you can test all benefits of these solutions without limitations!



Bruno Fierens


Bookmarks: 

Related blog posts



This blog post has received 1 comment.


1. Sunday, October 8, 2023 at 7:38:58 PM

Thank you, Bruno, for the comparison between this two Memo-controls! That helps a lot to make the right decision!

Hindermann Thorsten




Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post