)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display the intelisense popup when special character is pressed in EditControl?

Platform: WinForms |
Control: EditControl |
Published Date: November 20, 2015 |
Last Revised Date: May 24, 2019

You can display the intellisense popup, while pressing the special characters in EditControl. This requirement can be achieved by configuring, custom language using ConfigLexem in EditControl.

 

The following code example demonstrates the same.

C#

// Creates format for methods coloring.
ISnippetFormat formatMethod = editControl1.Language.Add("Method", "Text");
formatMethod.FontColor = Color.HotPink;
 
// Creates format for properties coloring.
ISnippetFormat formatProperty = editControl1.Language.Add("Property", "Text");
formatProperty.FontColor = Color.Goldenrod;
 
// Disables ContextChoiceList dropping after . in global context.
ConfigLexem lexemDot = GetConfigLexem((IConfigLexem)editControl1.Language, ".");
lexemDot.DropContextChoiceList = false;
            
// Adds "<?" word processing for global context.
ConfigLexem lexemId = GetConfigLexem((IConfigLexem)editControl1.Language, "<");
lexemId.Type = FormatType.Text;
// "<?" starts it`s own context. It does not have EndBlock specified, so the first unprocessed token will force parser to exit from "this"'s context.
lexemId.IsComplex = true;    
 
ConfigLexem lexemQues = GetConfigLexem((IConfigLexem)lexemId, "?");
lexemQues.Type = FormatType.Operator;
// "?" can drop context choice list
lexemQues.DropContextChoiceList = true;
lexemQues.IsComplex = true;
 
ConfigLexem this_Property3 = GetConfigLexem((IConfigLexem)lexemQues, "php..>");
this_Property3.Type = FormatType.Custom; this_Property3.FormatName = "Property";
this_Property3.IsComplex = true;
 
// Add "GenerateMap" configuration after "this."
ConfigLexem this_Method2 = GetConfigLexem((IConfigLexem)lexemQues, " text..>");
this_Method2.Type = FormatType.Custom; this_Method2.FormatName = "Method";
// needed for processing "(" and ")" next.
this_Method2.IsComplex = true;           
 
//To reset the cached data.
editControl1.Language.ResetCaches();

 

VB

' Creates format for methods coloring.
Dim formatMethod As ISnippetFormat = editControl1.Language.Add("Method", "Text")
formatMethod.FontColor = Color.HotPink
 
' Creates format for properties coloring.
Dim formatProperty As ISnippetFormat = editControl1.Language.Add("Property", "Text")
formatProperty.FontColor = Color.Goldenrod
 
' Disables ContextChoiceList dropping after . in global context.
Dim lexemDot As ConfigLexem = GetConfigLexem(CType(editControl1.Language, IConfigLexem), ".")
lexemDot.DropContextChoiceList = False
 
' Adds "<?" word processing for global context.
Dim lexemId As ConfigLexem = GetConfigLexem(CType(editControl1.Language, IConfigLexem), "<")
lexemId.Type = FormatType.Text
' "<?" starts it`s own context. It does not have EndBlock specified, so the first unprocessed token will force parser to exit from "this"'s context.
lexemId.IsComplex = True
 
Dim lexemQues As ConfigLexem = GetConfigLexem(CType(lexemId, IConfigLexem), "?")
lexemQues.Type = FormatType.Operator
' "?" can drop context choice list
lexemQues.DropContextChoiceList = True
lexemQues.IsComplex = True
 
Dim this_Property3 As ConfigLexem = GetConfigLexem(CType(lexemQues, IConfigLexem), "php..>")
this_Property3.Type = FormatType.Custom
this_Property3.FormatName = "Property"
this_Property3.IsComplex = True
 
' Add "GenerateMap" configuration after "this."
Dim this_Method2 As ConfigLexem = GetConfigLexem(CType(lexemQues, IConfigLexem), " text..>")
this_Method2.Type = FormatType.Custom
this_Method2.FormatName = "Method"
' needed for processing "(" and ")" next.
this_Method2.IsComplex = True
 
'To reset the cached data.
editControl1.Language.ResetCaches()

 

Note:

The function named “ResetCaches” is must be called after every change of the configuration inside the language.

 

Showing context prompt list

Figure 1: Context prompt list is shows when pressing the “?“ in EditControl.

Sample Links:

C#: EditControl_Intellisense_C#

VB: EditControl_Intellisense_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon