![]() |
![]() |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
TColorSyntax This component automatically highlights text on any TCustomRichEdit descendant. It works associated with a TParserAll component which provides the grammar used for the recognition of the text. This way anything can be highlighted from simple keywords to computer languages, depending on the grammar defined in TParserAll. As the user types in the companion RichEdit control, TColorSyntax is constantly evaluating the text, highlighting it when needed. TColorSyntax can also be used in Database applications just by associating it with an existing TDBRichEdit control. Here is a quick example: Start a new project, drop a TColorSyntax, a TParserAll and a TRichEdit component on the form;
Select the TColorSyntax, go to the object inspector and set the Control property to RichEdit1. Set the Parser property to ParserAll1. Double-click on the TParserAll component and define the following grammar:
The non-terminal <what> recognizes the word "ColorSyntax" and the non-terminal <component> recognizes words that start with a "T" followed by <what>, therefore recognizing the word "TColorSyntax". Double-click on the TColorSyntax component and define these two layers:
Run the application and look how TColorSyntax highlights the text as you type.
Note that TColorSyntax highlights the text in a bottom-up order, starting with the layer #01, up to the last one, in this case, the layer #02. The component first highlights "TColorSyntax" in blue and them "ColorSyntax" in red:
producing TColorSyntax Several text attributes can be defined for each layer, such as: Font color; Font typeface; Font size in points; Font style as a combination of Bold, Italic, Underline and Height of the font; Pitch, which specifies whether the characters in the font all have the same width; Character set. Note that Size and Height are dependent from each other, i.e., changing the Size might change the Height and vice-versa. Most Important Features Personalized control over each text highlighted, through the OnHighlight event handler; Up to 99 layers; Simplicity, no code needed; Uses a TCustomRichEdit descendant, so a regular TRichEdit or TDBRichEdit control works well; The component can be disabled/enabled at run-time; On-line help. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Web hosting by WebStrikeSolutions |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||