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.
Unfortunately, activation email could not send to your email. Please try again.

Previously recognised keyword

Thread ID:

Created:

Updated:

Platform:

Replies:

94399 May 11,2010 05:48 AM May 13,2010 04:33 AM Windows Forms 3
loading
Tags: EditControl
Scott Blood
Asked On May 11, 2010 05:48 AM

Hello,

I am currently evaluating your .net controls for use in our products.

I am having difficulty finding out how to get the last identified keyword in the Edit control from the current cursor position.

For example, if a user enters the following SQL code into the editor control.

Select Field1, Field2, Field3 from MyTable

And then positions the cursor within the MyTable text, i would expect a function to return the FROM keyword or if the user placed the cursor in the Field2 text, i would expect this to return SELECT.

Could you point me to the correct way of doing this.

Unfortunately i am unable to download any attatchments in work, so if you could post the code here this would be very much appreciated.

Thanks
Scott

Karikalan N [Syncfusion]
Replied On May 12, 2010 06:38 AM

Hi Scott,

Thanks for your interest in Syncfusion products.

Please find the following sample link which illustrates “Previously recognized keyword”.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=ModifiedSample1072615319.zip

The sample code as follows.

void editControl1_CursorPositionChanged(object sender, EventArgs e)
{
ILexemLine line = this.editControl1.GetLine(this.editControl1.CurrentLine);

//Read all lexems in line
IList listofLexems = line.LineLexems;

//read current word(lexem)
ILexem currentLex = line.FindLexemByColumn(this.editControl1.CurrentColumn);

//If current word is select or from, it return.
if(currentLex.Config.Format.Name=="KeyWord")
return;

string returnStr = string.Empty;

foreach (Lexem lex in listofLexems)
{
if (lex.Column > currentLex.Column)
{
break;
}
if (lex.Config.Format.Name == "KeyWord" && lex.Column < currentLex.Column)
{
returnStr = lex.Text;
}
}

if (returnStr != string.Empty)
{
Console.WriteLine("ReturnStr:" + returnStr);
MessageBox.Show("Keyword is:" + returnStr);
}

}

Please let me know if you need further assistance.

Thanks,
Karikalan N

Scott Blood
Replied On May 12, 2010 09:02 AM

Karikalan,

Thanks for your post. However i have an issue with this code.

Firstly, the code only searches on the currently line for the last identified keyword, what if the user is on another line??? have do i ensure that the search goes backwards to the last found keyword, regardless of what line the user is on.

Secondly you actually have helped me by pointing me in the direction of a nasty bug i had implemented and not thought of, if a user is currently over a keyword, you dont want the system popping up intellisense for the previous keyword, so thankyou very much for this.

If you could help me a little further i am sure within the near future i will be putting an order in for a number of licenses for your complete component suite.
Thanks

Karikalan N [Syncfusion]
Replied On May 13, 2010 04:33 AM

Hi Scott,

Thank you for your inquiry. We appreciate the opportunity to assist you.

Here is the sample application which illustrates your expected behavior "the search goes backwards to the last found keyword"

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=ModifiedSample2056986894.zip

In the sample, if a cursor is in start of the word or within the word, the search goes backwards to last found keyword like Select,from,etc.,

Please post the queries in Direct-Trac. You will get a faster response along with an automatic update when your question is answered via Direct-Trac. We are happy to assist you.

Here is the Direct-Trac link.

https://www.syncfusion.com/Support/DirectTrac/logon.aspx?URL=/Support/DirectTrac/default.aspx

Please let me know if you need further information on this.

Thanks,
Karikalan N

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.

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.

;