HOME  FORUM  LINKS

Site Menu

Development

Director

Hosting Support

Quick Links

Delphi Topics

Some Delphi code snippets aimed primarily at the novice Delphi user

TPageControl Example

This is a simple example to demonstrate some of the formatting parameters for the TRichEdit control. Download Project

{-----------------------------------------------------------------------------
 Unit Name: RichUnit1
 Author:    Tony Domigan DOMAJ Pty. Ltd.
 Purpose:  Demonstrate TRichEdit Formattting
 History:
-----------------------------------------------------------------------------}

unit RichUnit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, AppEvnts, StdCtrls,ExtCtrls, ComCtrls ;

type
  TForm1 = class(TForm)
    Button1: TButton;
    ApplicationEvents1: TApplicationEvents;
    RichTest: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ApplicationEvents1Exception(Sender: TObject; E: Exception);
    procedure FormDestroy(Sender: TObject);
    procedure RichTestClick(Sender: TObject);
  private
    { Private declarations }
  public
    slErrorLog: TStrings;
    FCre8LogFile: Boolean;
    FAllowResizing: Boolean;
    property Cre8LogFile: Boolean read FCre8LogFile write FCre8LogFile;
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses SPConsts;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Close;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Cre8LogFile := True;
end;

procedure TForm1.ApplicationEvents1Exception(Sender: TObject;
  E: Exception);
begin
  if not Cre8LogFile then
    Exit;
  with slErrorLog do begin
    Add(Format('%s: %s',[SDelphiErrorMessage, E.Message]));
    Add(Format('%s: %d %s',[SWindowsErrorCodeAndMessage,
                            GetLastError, SysErrorMessage(GetLastError)]));
    Add(DateTimeToStr(Now));
    Add(TimeToStr(Now));
    Add('');
  end;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  if not Cre8LogFile then
    Exit;
  if Assigned(slErrorLog) then begin
    if slErrorLog.Count>0 then
      slErrorLog.SaveToFile(Format('%s.txt', [SAppErrorLog]));
    slErrorLog.Free;
  end;
end;

procedure TForm1.RichTestClick(Sender: TObject);
const cS: String = '01234 567890 abcde fghijk lmnop qrs tuv wxyz. ';
var iIterate:Integer;
begin
with TRichEdit.Create(Self) do
  begin
    Parent := Self;
    Align := alClient;
    Lines.Clear;
    Lines.Add('Use Bullet Points:');
    // set numbering style
    Paragraph.Numbering := nsBullet;
    for iIterate:=0 to 4 do Lines.Add(cS);
    //disable bullets and set alignment centre.
    Paragraph.Numbering := nsNone;
    Paragraph.Alignment := taCenter;
    Lines.Add('Alignment(Centred):');
    //set alignment left
    Paragraph.Alignment := taLeftJustify;
    Lines.Add('Left Aligned');
    //set alignment right
    Paragraph.Alignment := taRightJustify;
    Lines.Add('Right Aligned');
    //set alignment left
    Paragraph.Alignment := taLeftJustify;
    //set right and left indents to 100
    Paragraph.RightIndent := 100;
    Paragraph.LeftIndent := 100;
    Lines.Add('Para Indent: '+cS+cS+cS+cS+cS);
    //reset left indent to 60
    Paragraph.FirstIndent := 60;
    Lines.Add('Para Indent: '+cS+cS+cS+cS+cS);
    //reset left indent to 0
    Paragraph.LeftIndent := 0;
    Lines.Add('Second Line (indented by 0 but firstIndent still active)');
    //reset firstindent to 0
    Paragraph.FirstIndent := 0;
    Lines.Add('Third Line (indented by 0 but firstIndent is 0)');
  end;

end;

end.

The project code resides in a button on an otherwise empty form.See below for the screen output.

Recent Topics

The latest topics from the forum.

  1. Before Closing.Stop
  2. Stop A Script
  3. Buttons On Stage And Movie On A Window...
  4. Acrobat 8 and Director
  5. Flash Video And Director
  6. Problem with new install
  7. Urgent Help For Noob, Pretty Please?
  8. back to splashscreen when inactive
  9. Import Flash
  10. my truck game --- help
  11. opening microsoft word document and microsoft powerpoint slides
  12. My Director has no Text Field
  13. Toggle Sound On/Off for AVI Video
  14. Keyboard Input Fails to Trigger Handlers
  15. Center Movie In A Window
  16. Microsoft Word Web Browser v1.0
  17. Sine Graph Function
  18. The coloured problems
  19. A Little fix or two
  20. Sine Reverse
  21. Repeatedly replacing Director bitmap
  22. Japanese characters in Director MX
  23. k-director.com: Post Updates
  24. A blog about Adobe Director
  25. Centerstage
  26. Custom Cursor...Why It Does Not Work?
  27. Director Game!
  28. SLIDER POSITION...
  29. Bullet points in text member
  30. Activex component install
  31. quiz
  32. how to export embedded flash swf?
  33. SHOCKWAVE VIDEO
  34. Deleting Lines Comparing Time...I Have No Idea...
  35. Property not found error
  36. SHOCKWAVE PROBLEM
  37. text field focus
  38. ExitLock CloseRequest Quit Close Gadget
  39. F10 Key Code Does Not Work
  40. Director Game Development Survey
  41. baPrintFile()
  42. How do check if a printer is printing??

Useful Links

Google Translate
AltaVista Translate
Google Glossary

Google
Web www.domaj.com

EZ BAS Easy BAS.

Save hours of work on your Business Activity Statement using this simple, quick and efficient product.