FNC Memo

I would like to add a new LanguageFileExtensionMap for another language to the FNC Memo. How can I do this? Is there a documentation. Or can I look up an existing language map (p.e. Pascal)?

Thank you so much
Tony

Hi, You can just add an item to the LanguageFileExtensionsMap collection where you specify the language and the extension that you want to add. You can do this in design time. There are already several extensions in this collection. Note that this only checks the file extension and automatically changes the Memo Language to the correct language. If you need custom code completion, you'll need to add items to the CompletionList which you can find here: TTMSFNCMemo - TMS FNC UI Pack

I open the VCLTMSFNCMemoDemo for example and I can see that there is a LanguageFileExtensionsMap collection in design time with 15 items entries. Good. But I only can add an extension and a language name (there are only two properties). But I need to add a whole specification for a NEW language (keywords etc.). I don't see how this is possible at design time. Do I miss something?
Thanks for help

Hi, at design time you can add items to the CompletionList property which is a collection of items where you can set different properties. You can find more about this here: TTMSFNCMemo - TMS FNC UI Pack

In the demo VCLTMSFNCMemoDemo I did the following:

  1. I added 'mlLPL' to enumation TTMSFNCMemoLanguage in file VCL.TMSFNCMemo

  2. I added the following code (called by a button)

    BasicMemo.LanguageFileExtensionsMap.Add(mlLPL,'.lpl');
    BasicMemo.Language := mlLPL
    BasicMemo.CompletionList.Add('model',skKeyword,'',itrNone);

When running it produced an error

Then I replaced the code by (just for testing)

BasicMemo.LanguageFileExtensionsMap.Add(mlXml,'.lpl');
BasicMemo.Language := mlXml;
BasicMemo.CompletionList.Add('model',skKeyword,'',itrNone);

The code ran, but 'model' seems not to be recognized as a keyword (it was not blue)

What did I wrong? I wanted to add a new language at runtime.

Thanks for help
Tony

Hi,

adding a keyword to a completion list will not colourize it. The completionList will just render it for Code completion/Snippets. Setting the colors for Custom Items is done by registering these words using the Monarch API which is not yet exposed in the Memo. Adding an item to the Language Enum will not work as the Memo does not know this Language. You could try to use a language that is almost the same as the one you are trying to add.