Hi Olga,
Thank you for using Syncfusion products.
It is possible to extract the lexemes from the config file using "ConfigLexem - Used to parsed in an defined way". I have prepared a sample to meet to your
requirements. The sample illustrates the following criteria;
Issue 1 &2: " User is typing something & I'm checking his input and underline the error, using SetUnderline".
The sample extracts all lexemes using "ConfigLexem" defined in "Config.xml" file and stores in an Array. In runtime when user types a word the word is
compared with the lexemes stored in the array. If the typed word is not in the lexemes list the word is underlined using "SetUnderline()" method. The following
is the code snippet to do so;
[C#]
n = editControl1.Language.Lexems.Count;
obj = new object[n];
this.editControl1.Language.Lexems.CopyTo(obj);
for (int i = 0; i < n; i++)
s[i] = ((ConfigLexem)obj[i]).BeginBlock;
Issue 3 - "when user moves cursor to the underlined text, some error info is shown ( I use UpdateContextToolTip event)"
This is achieved by triggering "UpdateContextToolTip" event. This event extracts the lexeme value and the string to display is printed out in this event. The
following is the code snippet to do so;
[C#]
this.editControl1.UpdateContextToolTip += new Syncfusion.Windows.Forms.Edit.UpdateTooltipEventHandler(this.editControl1_UpdateContextToolTip);
private void editControl1_UpdateContextToolTip(object sender, Syncfusion.Windows.Forms.Edit.UpdateTooltipEventArgs e)
{
ILexemLine line = editControl1.GetLine(pointVirtual.Y);
ILexem lexeme = line.FindLexemByColumn(pointVirtual.X);
if (lexeme != null)
{
IConfigLexem configLexem = lexem.Config as IConfigLexem;
e.Text = "This is of type " + configLexem.Format.Name + " : " + lexem.Text;
}
}
Issue 4 - "If user corrects error - underlining is removed".
This is achieved by extracting the current word from the EditControl and comparing it with the lexem's list stored in the array.
Steps to execute the program:
1) Run the attached sample.
2) Type a lexeme. (Say "null, byte, namespace....". These are the lexemes in the sample config.xml file).
3) Click the button.
4) The word will not be underlined, since the lexeme is in the config.xml file.
5) Type a lexeme not in the config.xml file. (Say "byte" - which is not in config.xml file).
6) Click the button.
7) The word will be underlined in red waved format.
8) Delete 'e' from "byte" in editcontrol.
9) Click the button.
10) The word will not be underlined, since the lexeme(byte) is in the config.xml file.
11) Move mouse pointer to 'byte' context tooltip displays.
Here is the sample program for your reference.
http://websamples.syncfusion.com/samples/Edit/F-64125/main.htm'>http://websamples.syncfusion.com/samples/Edit/F-64125/main.htm">http://websamples.syncfusion.com/samples/Edit/F-64125/main.htm
Please let me know for further help.
Regards,
Sarath