Difference between revisions of "LMD VCL - MiniHTML"
Line 11: | Line 11: | ||
|- | |- | ||
| Bold | | Bold | ||
− | | <b>, </b> | + | | <code><b>, </b></code> |
| '''bold''' | | '''bold''' | ||
|- | |- | ||
| Italic | | Italic | ||
− | | <i>, </i> | + | | <code><i>, </i></code> |
| ''italic'' | | ''italic'' | ||
|- | |- | ||
| Underline | | Underline | ||
− | | <u>, </u> | + | | <code><u>, </u></code> |
| <u>underline</u> | | <u>underline</u> | ||
|- | |- | ||
Line 73: | Line 73: | ||
| <img src="image" [width="w"] [height="h"]> | | <img src="image" [width="w"] [height="h"]> | ||
| The ''src'' parameter value is passed to the OnImageNeeded event handler. You can specify the width and height of the image rectangle if needed. By default the width and height are taken from the image you provide in event handler, but you can stretch image on drawing by specifying width and height explicitly.<br> | | The ''src'' parameter value is passed to the OnImageNeeded event handler. You can specify the width and height of the image rectangle if needed. By default the width and height are taken from the image you provide in event handler, but you can stretch image on drawing by specifying width and height explicitly.<br> | ||
− | The simplest OnImageNeeded event handlers:<br><br>< | + | The simplest OnImageNeeded event handlers:<br><br> |
+ | <pre class="brush:delphi"> | ||
+ | procedure TForm1.LMDHTMLLabel1ImageNeeded(Sender: TObject; SourceName: TLMDString; var Image: TPicture);<br>begin<br> Image.LoadFromFile(SourceName);<br>end;<br><br>procedure TForm1.LMDHTMLLabel1ImageNeeded(Sender: TObject; SourceName: TLMDString; var Image: TPicture);<br>begin<br> ImageList1.GetBitmap(strtoint(SourceName), Image.Bitmap);<br>end;<br></pre> | ||
|- | |- | ||
Line 79: | Line 81: | ||
| <~~myVariable> | | <~~myVariable> | ||
| The ''aVarName'', ''aVarValue'' parameters are passed to the OnVariableNeeded event handler, which defines what value substitutes the tag<br> | | The ''aVarName'', ''aVarValue'' parameters are passed to the OnVariableNeeded event handler, which defines what value substitutes the tag<br> | ||
− | < | + | <pre class="brush:delphi"> |
− | procedure TForm2.LMDHTMLLabel1VariableNeeded(Sender: TObject; const aVarName: TLMDString; var aVarValue: TLMDString); | + | procedure TForm2.LMDHTMLLabel1VariableNeeded(Sender: TObject; const aVarName: TLMDString; var aVarValue: TLMDString); |
+ | begin | ||
+ | aVarValue := '1111'; | ||
+ | end; | ||
+ | </pre> | ||
|- | |- | ||
| Embedded controls | | Embedded controls |
Revision as of 05:54, 22 October 2012
<< Back to Getting started or Product Resources page
Supported subset of HTML tags
NG HTMLPack and certain controls of other NG Packs (e.g. DialogPack) integrate a Mini HTML engine which supports a subset of HTML tags. Following HTML tags can be used:
Tag | Syntax | Comments & samples |
---|---|---|
Bold | <b>, </b>
|
bold |
Italic | <i>, </i>
|
italic |
Underline | <u>, </u>
|
underline |
Strikeout | <strikeout>, </strikeout> or <s>, </s> | |
Paragraph | <p [align="left|right|center"]> | Use align parameter to specify the alignment of the text in the paragraph. Default value for align is "left". |
Subscript | <sub>, </sub> | Subscript text is drawn with smaller font and with baseline moved down. |
Superscript | <sup>, </sup> | Superscript text is drawn with smaller font and with baseline moved up. |
Unordered list of elements | <ul><li>item</li>...</ul> |
|
Ordered list of elements | <ol><li>item</li>...</ol> |
|
Horizontal divider | <hr [width="width"]> | If no value for width attribute is specified, then it will take maximum available value. |
Line break | <br> | |
Font | <font [name="fontname"] [size="x|+x|-x|x px"] [color={"#rrggbb"|"color name"}] [bgcolor={"#rrggbb"|"color name"}]>text</font> | You can specify the name of the font name, size (absolute size or increase, decrease of size)
and font background color. Color must be a valid hexadecimal value in common HTML format, valid VCL color identifier (clWhite, clBtnFace for example) or valid HTML color identifier (red, black, btnshadow for example. You can use background synonym for bgcolor attribute. |
Hyperlink | <a href="link">link text</a> | Link parameter value is passed to OnLinkClick event handler, present in some controls (not all controls support clicking on the URLs. |
Embedded image | <img src="image" [width="w"] [height="h"]> | The src parameter value is passed to the OnImageNeeded event handler. You can specify the width and height of the image rectangle if needed. By default the width and height are taken from the image you provide in event handler, but you can stretch image on drawing by specifying width and height explicitly. The simplest OnImageNeeded event handlers: procedure TForm1.LMDHTMLLabel1ImageNeeded(Sender: TObject; SourceName: TLMDString; var Image: TPicture);<br>begin<br> Image.LoadFromFile(SourceName);<br>end;<br><br>procedure TForm1.LMDHTMLLabel1ImageNeeded(Sender: TObject; SourceName: TLMDString; var Image: TPicture);<br>begin<br> ImageList1.GetBitmap(strtoint(SourceName), Image.Bitmap);<br>end;<br> |
Variables | <~~myVariable> | The aVarName, aVarValue parameters are passed to the OnVariableNeeded event handler, which defines what value substitutes the tagprocedure TForm2.LMDHTMLLabel1VariableNeeded(Sender: TObject; const aVarName: TLMDString; var aVarValue: TLMDString); begin aVarValue := '1111'; end; |
Embedded controls | <control vclclass= width= height= name=> | Allows embedding of any control into HTML text |
Supported special symbols
Á | Á | ¢ | ¢ | Í | Í | ó | ó | ¹ | ¹ |
á | á | © | © | í | í | Ô | Ô | ² | ² |
 |  | ¤ | ¤ | Î | Î | ô | ô | ³ | ³ |
â | â | ° | ° | î | î | Ò | Ò | ß | ß |
´ | ´ | ÷ | ÷ | ¡ | ¡ | ò | ò | Þ | Þ |
Æ | Æ | É | É | Ì | Ì | ª | ª | × | × |
æ | æ | é | é | ì | ì | º | º | &trade | ™ |
À | À | Ê | Ê | ¿ | ¿ | Ø | Ø | Ú | Ú |
à | à | ê | ê | Ï | Ï | ø | ø | ú | ú |
& | & | È | È | ï | ï | Õ | Õ | Û | Û |
Å | Å | è | è | « | « | õ | õ | Ù | Ù |
å | å | Ð | Ð | < | < | Ö | Ö | ù | ù |
à | à | ð | ð | ¯ | ¯ | ö | ö | ¨ | ¨ |
ã | ã | Ë | Ë | µ | µ | ¶ | ¶ | Ü | Ü |
Ä | Ä | ë | ë | · | · | ± | ± | Ý | Ý |
ä | ä | &euro | € |   | £ | £ | ¥ | ¥ | |
¦ | ¦ | ½ | ½ | ¬ | ¬ | " | " | ||
Ç | Ç | ¼ | ¼ | Ñ | Ñ | » | » | ||
ç | ç | ¾ | ¾ | ñ | ñ | ® | ® | ||
¸ | ¸ | > | > | Ó | Ó | § | § |