We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I programatically add a complex lexem to a edit control?

Thread ID:

Created:

Updated:

Platform:

Replies:

71894 Feb 19,2008 07:40 PM UTC Feb 20,2008 09:58 PM UTC WinForms 2
loading
Tags: EditControl
Jorge Gonzalez
Asked On February 19, 2008 07:40 PM UTC

Hello

I'm trying to programatically add a complex lexem to a edit control, using as basis a example yours, like this:

{
string str="";
for(int i=10;i>0;i--)
{
str="[Table "+i.ToString()+ "]";
configlexem1=new ConfigLexem();
configlexem1.BeginBlock=str;
configlexem1.Type =FormatType.KeyWord;
configlexem1.IsComplex = true;

Split split1 = new Split();
split1.Text="[Table " + i.ToString() +"]";

this.editControl1.Language.Splits.Add(split1);
this.editControl1.Language.Lexems.Add(configlexem1);
this.editControl1.Language.ResetCaches();

}

this.editControl1.Refresh();
MessageBox.Show("Finished creating lexems with begin block Table1,Table2,Table3.... Table10");
this.menuItem1.Enabled=false;

}

But it does not work.
How can I programatically add a complex lexem to a edit control?
I use Visual Studio 2005 and Syncfusion 4.2.0.60

Thanks in advance



Sample2_f407d2d8.zip

Administrator [Syncfusion]
Replied On February 20, 2008 12:22 AM UTC

Hi Jorge,

Thank you for your interest in Syncfusion products.

Please refer the code below to programatically add a complex lexem to a edit control,

Thank you for your interest in Syncfusion products.

ISnippetFormat keywordFormat = this.editControl1.Language.Add("Keyword");
keywordFormat.FontColor = Color.Blue;
keywordFormat.Font = new Font("Arial", 10);

// Create a lexem - this that belongs to the format - Keyword
//ConfigLexem configLex = new ConfigLexem("[A-Z]", "[A-Z]", FormatType.Custom, false);
ConfigLexem configLex = new ConfigLexem("[A-Z]+", "", FormatType.Custom, false);


configLex.IsBeginRegex = true;
configLex.IsEndRegex = true;
configLex.FormatName = "Keyword";

// Add it to the current language's lexems collection
this.editControl1.Language.Lexems.Add(configLex);
this.editControl1.Language.ResetCaches();


Please let me know if this helps.

Regards,
Srirajan



Jorge
Replied On February 20, 2008 09:58 PM UTC

Hi Srirajan

Thank you for your quckly response. But this example does not work in my specific case. I tryed this:


ISnippetFormat keywordFormat = this.editControl1.Language.Add("Keyword");
keywordFormat.FontColor = Color.Blue;
keywordFormat.Font = new Font("Arial", 10);

// Create a lexem - this that belongs to the format - Keyword
ConfigLexem configLex = new ConfigLexem("[Test]", "", FormatType.Custom, false);


configLex.IsBeginRegex = false; // it´s not a regular ex.
configLex.IsEndRegex = false;
configLex.FormatName = "Keyword";

// Add it to the current language's lexems collection
this.editControl1.Language.Lexems.Add(configLex);
this.editControl1.Language.ResetCaches();


Note that I include brackets as literals. Unbracketed, it works perfectly
How can I use brackets as literals?

Best regards,
Jorge

>Hi Jorge,

Thank you for your interest in Syncfusion products.

Please refer the code below to programatically add a complex lexem to a edit control,

Thank you for your interest in Syncfusion products.

ISnippetFormat keywordFormat = this.editControl1.Language.Add("Keyword");
keywordFormat.FontColor = Color.Blue;
keywordFormat.Font = new Font("Arial", 10);

// Create a lexem - this that belongs to the format - Keyword
//ConfigLexem configLex = new ConfigLexem("[A-Z]", "[A-Z]", FormatType.Custom, false);
ConfigLexem configLex = new ConfigLexem("[A-Z]+", "", FormatType.Custom, false);


configLex.IsBeginRegex = true;
configLex.IsEndRegex = true;
configLex.FormatName = "Keyword";

// Add it to the current language's lexems collection
this.editControl1.Language.Lexems.Add(configLex);
this.editControl1.Language.ResetCaches();


Please let me know if this helps.

Regards,
Srirajan





CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;