Bringing PBEAR back to Delphi 7 developers.
Posted: Wed Feb 18, 2026 5:55 pm
As a licensed PBear customer of David Balwin's... I found it frustrating that the current team rolled up the new code to only work with Delphi 2009+ (using Unicode string). So Claude and I, take back HTMLViewer to Delphi 7 developers:
Making HtmlViewer 11.10 Compile Under Delphi 7
This is a non-trivial but achievable task. HtmlViewer officially requires Delphi 2009+, because it was rearchitected around UnicodeString (which is WideString in D7 parlance). Here is everything you need to do, in order.
Step 1 — Install TntUnicodeControls
This is a hard prerequisite. The README itself says so. Get version 2.3.0 or 2.2.1 from:
http://www.yunqa.de/delphi/doku.php/pro ... rols/index
Install the BPL (TntUnicodeVcl_R70.bpl) into Delphi 7.
Do not add TNT source paths to the library path — only the BPL path. This avoids a known issue where TntDBLogDlg.pas causes compile errors about WideLoadResStr.
Step 2 — Create a Delphi 7 Package
No .dpk exists for D7 in the current github.com repo (only Rad Studio 10+). Create FrameViewer07.dpk manually. Base it on the structure of the existing packages. You need the files in source\:
This is the central version-detection include. Open source\htmlcons.inc and find the block that sets conditional defines. Delphi 7 is VER150. You need to verify that this block exists and defines UseVCLStyles as absent and enables TNT:
This is the most invasive file. In Delphi 2009+ it leverages UnicodeString. In D7, UnicodeString does not exist — you must alias it to WideString.
At the top of the interface section, inside an {$ifndef UNICODE} guard, add:
Also, any use of TStringHelper record methods (introduced in Delphi XE3) must be replaced with classic functions. Search for .ToUpper, .ToLower, .Trim, .IsEmpty, .StartsWith, .Contains and replace them with UpperCase(), LowerCase(), Trim(), = '', Pos(…) = 1, Pos(…) > 0 etc.
Step 5 — Fix {$ifdef UNICODE} string type mismatches across all units
In D7, string is AnsiString and WideString is a separate type. The viewer internally uses ThtString = WideString. All places where the code assigns a string literal or uses SysUtils functions (which return AnsiString) to a ThtString variable will need {$ifndef UNICODE} guards or explicit conversions via WideString(...).
Key patterns to fix in every unit:
Making HtmlViewer 11.10 Compile Under Delphi 7
This is a non-trivial but achievable task. HtmlViewer officially requires Delphi 2009+, because it was rearchitected around UnicodeString (which is WideString in D7 parlance). Here is everything you need to do, in order.
Step 1 — Install TntUnicodeControls
This is a hard prerequisite. The README itself says so. Get version 2.3.0 or 2.2.1 from:
http://www.yunqa.de/delphi/doku.php/pro ... rols/index
Install the BPL (TntUnicodeVcl_R70.bpl) into Delphi 7.
Do not add TNT source paths to the library path — only the BPL path. This avoids a known issue where TntDBLogDlg.pas causes compile errors about WideLoadResStr.
Step 2 — Create a Delphi 7 Package
No .dpk exists for D7 in the current github.com repo (only Rad Studio 10+). Create FrameViewer07.dpk manually. Base it on the structure of the existing packages. You need the files in source\:
The .dpk requires clause must include:HtmlBuffer.pas, HtmlCaches.pas, HtmlCss.pas, HtmlDraw.pas,
HtmlFonts.pas, HtmlGif1.pas, HtmlGif2.pas, HtmlGlobals.pas,
HtmlImages.pas, HtmlMisc.pas, HtmlSbs1.pas, HtmlSubs.pas,
HtmlSymb.pas, HtmlTable.pas, HtmlUn2.pas, HTMLUn2.pas,
ReadHTML.pas, StylePars.pas, StyleUn.pas, DitherUnit.pas,
FramBrwz.pas, FramView.pas, HtmlView.pas
Step 3 — Patch htmlcons.incrtl, vcl, TntUnicodeVcl_R70
This is the central version-detection include. Open source\htmlcons.inc and find the block that sets conditional defines. Delphi 7 is VER150. You need to verify that this block exists and defines UseVCLStyles as absent and enables TNT:
Step 4 — Fix HtmlGlobals.pasCode: Select all
{$ifndef UNICODE} // Delphi 7: provide UnicodeString alias and helpers type UnicodeString = WideString; UnicodeChar = WideChar; PUnicodeChar = PWideChar; // ThtString is the main internal string type ThtString = WideString; ThtChar = WideChar; PhtChar = PWideChar; {$else} ThtString = UnicodeString; ThtChar = Char; PhtChar = PChar; {$endif}
This is the most invasive file. In Delphi 2009+ it leverages UnicodeString. In D7, UnicodeString does not exist — you must alias it to WideString.
At the top of the interface section, inside an {$ifndef UNICODE} guard, add:
Code: Select all
{$ifndef UNICODE}
// Delphi 7: provide UnicodeString alias and helpers
type
UnicodeString = WideString;
UnicodeChar = WideChar;
PUnicodeChar = PWideChar;
// ThtString is the main internal string type
ThtString = WideString;
ThtChar = WideChar;
PhtChar = PWideChar;
{$else}
ThtString = UnicodeString;
ThtChar = Char;
PhtChar = PChar;
{$endif}Step 5 — Fix {$ifdef UNICODE} string type mismatches across all units
In D7, string is AnsiString and WideString is a separate type. The viewer internally uses ThtString = WideString. All places where the code assigns a string literal or uses SysUtils functions (which return AnsiString) to a ThtString variable will need {$ifndef UNICODE} guards or explicit conversions via WideString(...).
Key patterns to fix in every unit: