Type | Description | |||
Expression as String | A string expression that indicates the expression being accessed. The Expression parameter must not include the HTML tags like they are passed to the AddExpression method. For instance, if we have the <b>/*</b> expression the name of the expression is /* not <b>/*</b> | |||
String | A string expression that indicates the list of prefixes being ignored in the expression. |
For instance if we defined an expression for strings like follows:
With Edit1 .AddExpression "<fgcolor=800000><b>""</b></fgcolor>", _ "<b><fgcolor=FF0000> </fgcolor></b>", _ "<fgcolor=800000><b>""</b></fgcolor>", _ True End With
In this case we have defined the expression ".
So, if the user types in the control the text:
'This is a string "this is a quote \" bla ... bla \" "'
the control displays the line like follows:
'This is a string "this is a quote \" bla ... bla \" "'
, but we want to ignore \" expressions.
In this case we need to use the following code:
With Edit1 .AddExpression "<fgcolor=800000><b>""</b></fgcolor>", _ "<b><fgcolor=FF0000> </fgcolor></b>", _ "<fgcolor=800000><b>""</b></fgcolor>", _ True .IgnorePrefixInExpression("""") = "\" End With
In this case, if the user types:
'This is a string "this is a quote \" bla ... bla \" "'
the control displays:
'This is a string "this is a quote \" bla ... bla \""'
, and this is what we need.
The IgnorePrefixInExpression property is cumulative, so you can add multiple prefixes to be ignored for an expression like in the following sample:
With Edit1 .AddExpression "<fgcolor=800000><b>""</b></fgcolor>", _ "<b><fgcolor=FF0000> </fgcolor></b>", _ "<fgcolor=800000><b>""</b></fgcolor>", _ True .IgnorePrefixInExpression("""") = "\" .IgnorePrefixInExpression("""") = """" End With
Passing an empty string to the IgnorePrefixInExpression property clears the collection of the prefixes for the expression, so the .IgnorePrefixInExpression("""") = "" clears all prefixes previously defined for an expression.
The following C++ sample adds an expression to highlight the text between " (quote) characters:
COleVariant vtMissing; vtMissing.vt = VT_ERROR; m_edit.AddExpression( "<fgcolor=800000><b>\"</b></fgcolor>", "<b><fgcolor=FF0000> </fgcolor></b>", "<fgcolor=800000><b>\"</b></fgcolor>", vtMissing, vtMissing ); m_edit.SetIgnorePrefixInExpression( "\"", "\\" ); m_edit.SetIgnorePrefixInExpression( "\"", "\"" ); m_edit.Refresh();
The following VB.NET sample adds an expression to highlight the text between " (quote) characters:
With AxEdit1 .AddExpression("<fgcolor=800000><b>""</b></fgcolor>", "<b><fgcolor=FF0000> </fgcolor></b>", "<fgcolor=800000><b>""</b></fgcolor>") .set_IgnorePrefixInExpression("""", "\") .set_IgnorePrefixInExpression("""", """") .CtlRefresh() End With
The following C# sample adds an expression to highlight the text between " (quote) characters:
axEdit1.AddExpression("<fgcolor=800000><b>\"</b></fgcolor>", "<b><fgcolor=FF0000> </fgcolor></b>", "<fgcolor=800000><b>\"</b></fgcolor>"); axEdit1.set_IgnorePrefixInExpression("\"", "\\"); axEdit1.set_IgnorePrefixInExpression("\"", "\""); axEdit1.CtlRefresh();
The following VFP sample adds an expression to highlight the text between " (quote) characters:
With thisform.Edit1.Object .AddExpression("<fgcolor=800000><b>" + chr(34) + "</b></fgcolor>", "<b><fgcolor=FF0000> </fgcolor></b>", "<fgcolor=800000><b>"+chr(34)+"</b></fgcolor>") .IgnorePrefixInExpression(chr(34)) = chr(92) .IgnorePrefixInExpression(chr(34)) = chr(34) .Refresh EndWith