Logo Delphi Developer Days 2011

Menu for Development

Site Menu
Delphi 2010 Handbook
Delphi 2009 Handbook
Delphi 2007 Handbook
Mastering Borland Delphi 2005
Essential Pascal
Essential Delphi
Buy Books Online
Code Repository
Newsgroups
White Papers
Tools
Conferences
Training
Delphi Links
Contact Marco

My Other Sites
Italian Site (www.marcocantu.it)
Developers Newsgroups Browser (dev.newswhat.com)
My town (www.piazzacavalli.net)
the delphi search
Wintech Italia (my company)

Advertising
Home My Blog Books My Bookstore Development Links 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