Difference between revisions of "LMD NG - MiniHTML"
Line 76: | Line 76: | ||
<pre class="brush:delphi"> | <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> | 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> | ||
− | Additional | + | Additional can be defined by using index/file/res identifier in image name: |
* connected imagelist. Use syntax: <code><img src="index:0"></code> | * connected imagelist. Use syntax: <code><img src="index:0"></code> | ||
* File: Use syntax: <code><img src="file:sample.png"></code> | * File: Use syntax: <code><img src="file:sample.png"></code> |
Revision as of 22:35, 30 January 2013
<< 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> Additional can be defined by using index/file/res identifier in image name:
|
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 |
Color Names
Special symbols
Á | Á | ¢ | ¢ | Í | Í | ó | ó | ¹ | ¹ |
á | á | © | © | í | í | Ô | Ô | ² | ² |
 |  | ¤ | ¤ | Î | Î | ô | ô | ³ | ³ |
â | â | ° | ° | î | î | Ò | Ò | ß | ß |
´ | ´ | ÷ | ÷ | ¡ | ¡ | ò | ò | Þ | Þ |
Æ | Æ | É | É | Ì | Ì | ª | ª | × | × |
æ | æ | é | é | ì | ì | º | º | &trade | ™ |
À | À | Ê | Ê | ¿ | ¿ | Ø | Ø | Ú | Ú |
à | à | ê | ê | Ï | Ï | ø | ø | ú | ú |
& | & | È | È | ï | ï | Õ | Õ | Û | Û |
Å | Å | è | è | « | « | õ | õ | Ù | Ù |
å | å | Ð | Ð | < | < | Ö | Ö | ù | ù |
à | à | ð | ð | ¯ | ¯ | ö | ö | ¨ | ¨ |
ã | ã | Ë | Ë | µ | µ | ¶ | ¶ | Ü | Ü |
Ä | Ä | ë | ë | · | · | ± | ± | Ý | Ý |
ä | ä | &euro | € |   | £ | £ | ¥ | ¥ | |
¦ | ¦ | ½ | ½ | ¬ | ¬ | " | " | ||
Ç | Ç | ¼ | ¼ | Ñ | Ñ | » | » | ||
ç | ç | ¾ | ¾ | ñ | ñ | ® | ® | ||
¸ | ¸ | > | > | Ó | Ó | § | § |