NG Controls - HTMLPack
(© by LMD Innovative, (http://www.lmd.de or http://www.lmdtools.com)


Contents
  Introduction
  Documentation
    Mini-HTML Reference 
    Properties
    Events
    Methods
  Demos


Introduction
NG MiniHTML engine is an enhanced version of the MiniHTML engine included in the LMD VCL series.
Included controls in the first release of HTMLPack are:

Other controls will follow in future releases.

By focusing on features of recent Delphi/C++Builder several notable additions were integrated. Among others those are:

 

Textfield1: <~~textfield1> Textfield2:<~~textfield2>

[Top]


Documentation

The following section provides overview about common NG HTMLPack properties, events and methods.

Properties 

Property

Type

Description

Options

TNGHTMLOptions

 

  Options.LineGap

integer

Height of the interval between two lines of text

  Options.LinkColor

TColor

color of the text in <a></a> tag

  Options.LinkStyle

TFontStyles

font style of the text in <a></a> tag

LinkPopupMenu

TPopupMenu

Menu that is invoked by right clicking the link

Storage

TNGHTMLStorage

A storage of HTML snippets with support of automatic jumps from one to another by link clicking. Each snippet has Name property that can be used as href in <a> tag. For example, clicking on a link <a href=”News”>News</a> will cause html control to display snippet with name = ‘News’.

StorageItemIndex

integer

An index of the Storage’s snippet to be shown.

StorageItemNotFoundIndex

integer

An index of the snippet to be shown when referred snippet is not found.

CheckStorageLinks

boolean

This flag allows to turn off automatic jumps between storage’s items.

IsHTML

boolean

Setting this property to true makes control to display html code instead of rendered html.

Offset

TPoint

Specifies left-top corner of the rectangle area being rendered. (0,0) by default.

PlainText

string

Use this property to get text without html tags.

Render

TNGHTMLRender

Allows to get direct access to render engine instance.

[Top]

Events

Event

Event type name

Description

OnGetImage

 TNGHTMLImageNeededEvent

This event is used to retrieve image, when img tag has no source specifier (file:, res: or imagelist:).

OnGetVariable

TNGHTMLVariableNeededEvent

This event is triggered when html engine renders <~~varname> tag. Used for providing variable value.

OnLinkClick    

TNGHTMLLinkClickEvent

Triggered when user click a link.

OnControlCreated

TNGHTMLControlCreatedEvent

Triggered right after an embedded control is created. Use this event to initialize control, e.g. name it, populate with data etc.

OnAdjustControlPosition

TNGHTMLControlPositionNeededEvent

This event is triggered before embedded control is displayed. You can adjust control position at this moment.

OnControlVisibilityNeeded

TNGHTMLControlVisibilityNeededEvent

Triggered before embedded control’s Visible property is set. You can add custom filters here to suppress showing of the embedded control.

OnStorageItemChanged

TNGHTMLStorageItemChangedEvent

This event is triggered when html control’s StorageItemIndex property is changed. In Features  demo, this event is used to implement traverse through history.

OnTagFound

TNGHTMLTagFoundEvent

This event gives you total control on html engine. You can implement new tags, handle unknown tags (see Controls demo for example where unsupported <x> tag is substituted by <b> tag).

[Top]

Methods

INGHTMLControl interface

Most of INGHTMLControl’s methods are for internal use. However, you can use two of them to unify work with NG HTML controls. These are SetHTML and GetHTML.

 

  1.     function GetDefaultFont: TFont;
  2.     function GetHTMLOptions: TNGHTMLOptions;
  3.     function GetHTML: string;
  4.     procedure SetHTML(const Value: string);
  5.     function GetPadding: TPadding;
  6.     procedure SetRenderParameter(const aName: string; const aValue: string); (for internal use only)

 

Direct access to an engine singleton

 

function HTMLRender:TNGHTMLRender;

 

Direct access to a global rendering engine instance.

 

Direct rendering of HTML to a canvas

 

You can use following methods to draw HTML text to a canvas:

 

  1. function NGHTMLDrawText(Canvas: TCanvas; szStr: string; ARect: TRect;  LineGap: integer; LinkColor: TColor; WordWrap: boolean; bCalcOnly: Boolean = False):Integer; overload;
  1. function NGHTMLDrawText(Canvas: TCanvas; szStr: string; ARect: TRect;  bCalcOnly: Boolean = False): Integer; overload;

 

Both methods return height of rendered HTML texts. If bCalcOnly property is set ti true, then no final rendering is made.
[Top]
 
 

NG HTMLPack demos

To get a quick start we suggest that you check the demo projects which are shipped with any version of NG HTMLPack :

Folder

Description

\features This project demonstrates all supported tags of MiniHTML engine.
\controls This demo presents all controls included in NG HTMLPack.

[Top]


©  by LMD Innovative Germany
All other trademarks are acknowledged.