Marco's Web Center

Menu for Development

Site Menu
Object Pascal Handbook
Delphi Handbooks Collection
Mastering Borland Delphi 2005
(Old) White Papers
(Old)Tools
(Old) Conferences

My Other Sites
Italian Site (www.marcocantu.it)
the delphi search

Spirit of delphi

Advertising
Home My Blog Books Object Pascal Marco

Home: Code Repository: Mastering Delphi 6

Chapter 06 - Project HtmlEdit

Project Structure

HtmlEdit.dpr
program HtmlEdit;

uses
QForms,
HtmlEditForm in 'HtmlEditForm.pas' {Form1};

{$R *.res}

begin
Application.Initialize;
Application.CreateForm(TForm1,Form1);
Application.Run;
end.
HtmlEditForm.pas
unit HtmlEditForm;

interface

uses
SysUtils,Types,Classes,Variants, QGraphics, QControls, QForms, QDialogs,
 QStdCtrls, QComCtrls;

type
TForm1= class(TForm)
   Memo1: TMemo;
   TextViewer1: TTextViewer;
   procedure Memo1Change(Sender: TObject);
   procedure FormCreate(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

var
Form1:TForm1;

implementation

{$R *.xfm}

procedureTForm1.Memo1Change(Sender:TObject);
begin
TextViewer1.Text:=Memo1.Lines.Text;
end;

procedureTForm1.FormCreate(Sender:TObject);
begin
TextViewer1.Text:=Memo1.Lines.Text;
end;

end.
HtmlEditForm.xfm
object Form1: TForm1
  Left = 172
  Top = 113
  Width = 696
  Height = 480
  VertScrollBar.Range = 465
  HorzScrollBar.Range = 673
  ActiveControl = Memo1
  Caption = 'HtmlEdit'
  Color = clBackground
  OnCreate = FormCreate
  PixelsPerInch = 75
  TextHeight = 13
  TextWidth = 6
  object Memo1: TMemo
    Left = 24
    Top = 8
    Width = 649
    Height = 177
    Lines.Strings = (
      '<h1>Test Html</h1>'
      '<p>Test text <b>with bold</b><br>'
      '<p>and more test on a new line, followed by a table'
      '<p>'
      '<table border=1>'

              '<tr><td>cell 1</td><td>cell b</td><td>cell</td><td>cell</td></tr' +
        '>'

              '<tr><td>cell 2</td><td>cell b</td><td>cell</td><td>cell</td></tr' +
        '>'

              '<tr><td>cell 3</td><td>cell b</td><td>cell</td><td>cell</td></tr' +
        '>'

              '<tr><td>cell 4</td><td>cell b</td><td>cell</td><td>cell</td></tr' +
        '>'

              '<tr><td>cell 5</td><td>cell b</td><td>cell</td><td>final cell</t' +
        'd></tr>'
      '</table>'

              '<p>and finally a "dead" hyperlink, <a href="http://www.marcocant' +
        'u.com"> marcocantu.com </a>.')
    TabOrder = 0
    OnChange = Memo1Change
  end
  object TextViewer1: TTextViewer
    Left = 24
    Top = 192
    Width = 649
    Height = 273
    TabOrder = 1
  end
end