(************************************************************************
*    This File is Part of the AHM Triton Tools                          *
*    for Borland Delphi and C++ Builder.                                *
*************************************************************************
* Copyright © 1995-1999 Alexander H. Mehlhorn (AHM) and Tritontools.com *
* All Rights reserved.                                                  *
*                                                                       *
*    For more Information contact us at                                 *
*    E-Mail : support@tritontools.com                                   *
*    URL : http://www.tritontools.com                                   *
*                                                                       *
*    AHM is copyright by Alexander H. Mehlhorn                          *
*    All Parts of this Collection were developed,                       *
*    designed and implemented by AHM                                    *
*                                                                       *
*    Under no Circumstances may you distribute this file                *
*    in this or any other format. This File is supplied                 *
*    as Evaluation of Source only. No Delphi Components may be developed*
*    using extracts or subsets of this code without expressed permission*
*    by AHM.                                                            *
*                                                                       *
*************************************************************************)
unit AHMEnhancedDsgn;

interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, DesignIntf,
  AHMEnhancedConst,
  AHMTPresentation, DesignEditors;

type
  TAHMHintProperty = class(TStringProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;
  TAHMCaptionProperty = class(TStringProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;
  TAHMColorInBetweenProperty = class(TClassProperty)
  public
    Procedure Edit; override;
    function GetValue: string; override;
    Function GetAttributes: TPropertyAttributes; override;
  end;
  TAHMSlidesProperty = class(TClassProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
  end;

implementation
{$R AHMSlideForm.res}
uses Forms, StdCtrls,ExtCtrls,Dialogs,Buttons,AHMEnhancedClass,ComCtrls;

type
  TAHMColorSelectionForm = class(TForm)
  private
    ListBox1: TListBox;
    CD1: TColorDialog;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
  public
    Procedure SetupForm;
    { Public declarations }
  end;
  TAHMCaptionEditForm = class(TForm)
  private
    CaptionBox: TMemo;
    Panel1: TPanel;    
    procedure Activate; override;
    procedure BitBtn1Click(Sender: TObject);
  protected
  public
    Procedure SetupForm;
  end;
  TAHMHintEditForm = class(TForm)
  private
    Hintbox: TMemo;
    Statusbar: TEdit;
    Panel1: TPanel;
    procedure Activate; override;
    procedure BitBtn1Click(Sender: TObject);
  protected
  public
    Procedure SetupForm;
  end;
  TAHMSlideEditorForm = class(TForm)
  private
    Panel2: TPanel;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    ListBox1: TListBox;
    TabSheet2: TTabSheet;
    Memo1: TMemo;
    TabSheet3: TTabSheet;
    Panel1: TPanel;
    RadioGroup1: TRadioGroup;
    Image1: TImage;
    ComboBox1: TComboBox;
    Image2: TImage;
    Image3: TImage;
    PaintBox1: TPaintBox;
    OpenDialog1: TOpenDialog;
    CheckBox1: TCheckBox;
    procedure Buildform;
    procedure FormShow(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure ArrowBtn1Click(Sender: TObject);
    procedure ArrowBtn2Click(Sender: TObject);
    procedure Office97Btn3Click(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
    procedure Memo1Exit(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    allSlides : TAHMSlides;
    TheOwner : TComponent;
    maxx,maxy : longint;
    xw,xh : Integer;
    procedure SetupForm;
    { Public declarations }
  end;


procedure TAHMSlidesProperty.Edit;
var i : integer;
begin
  with TAHMSlideEditorForm.createNew(Application) do
  try
    SetupForm;
    listbox1.items.clear;
    if TAHMSlides(getordvalue).count>-1 then
      for i:=0 to TAHMSlides(getordvalue).count-1 do
        listbox1.items.add(TAHMSlides(getordvalue).items[i].Id);
    AllSlides := TAHMSlides(getordvalue);
    TheOwner:=TAHMSlides(getordvalue).TheOwner;
    xh:=(TheOwner as TAHMPresentation).height;
    xw:=(TheOwner as TAHMPresentation).width;
    if Showmodal=mrOk then Modified;
  finally
    free;
  end;
end;

function TAHMSlidesProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paReadonly];
end;

procedure TAHMSlideEditorForm.SpeedButton4Click(Sender: TObject);
begin
  if image2.tag=0 then
  begin
    AHMPaintEffect(combobox1.itemindex,image2.picture.bitmap.canvas,
                paintbox1.canvas,paintbox1.width,paintbox1.height);
    image2.tag:=1;
  end else
  begin
    AHMPaintEffect(combobox1.itemindex,image3.picture.bitmap.canvas,
               paintbox1.canvas,paintbox1.width,paintbox1.height);
    image2.tag:=0;
  end
end;

procedure TAHMSlideEditorForm.CheckBox1Click(Sender: TObject);
begin
  allslides.items[allslides.selecteditem].Stretch:=Checkbox1.checked;
end;

procedure TAHMSlideEditorForm.SetupForm;
begin
  HorzScrollBar.Visible := False;
  VertScrollBar.Visible := False;
  ActiveControl := ListBox1;
  BorderStyle := bsToolWindow;
  Caption := ahmscslideconfig;
  ClientHeight := 160;
  ClientWidth := 360;
  Position := poScreenCenter;
  OnShow := FormShow;
  Panel2:=TPanel.Create(Self);
  with Panel2 do
  begin
    Parent:=Self;
    Left := 0;
    Top := 0;
    Width := 356;
    Height := 157;
    Align := alClient;
    BevelOuter := bvNone;
    TabOrder := 0;
    PageControl1:= TPageControl.Create(Self);
    with PageControl1 do
    begin
      Parent:=Panel2;
      Left := 0;
      Top := 0;
      Width := 356;
      Height := 157;
      ActivePage := TabSheet1;
      Align := alClient;
      TabOrder := 0;
      TabSheet1:=TTabSheet.Create(PageControl1);
      with TabSheet1 do
      begin
        PageControl:=PageControl1;
        Parent:=PageControl1;
        Caption := ahmsctab1;
        Image2:= TImage.Create(Self);
        with Image2 do
        begin
          Parent:=Tabsheet1;
          Left := 235;
          Top := 88;
          Width := 109;
          Height := 41;
          try
          Picture.Bitmap.LoadFromResourceName(HInstance,'TAHMSlideForm4');
          except
          end;
          Visible := False;
        end;
        Image3:=TImage.Create(Self);
        with Image3 do
        begin
          Parent:=Tabsheet1;
          Left := 235;
          Top := 88;
          Width := 109;
          Height := 41;
          try
          Picture.Bitmap.LoadFromResourceName(HInstance,'TAHMSlideForm5');
          except end;
          Visible := False;
        end;
        with TLabel.Create(Self) do
        begin
          Parent:=TabSheet1;
          Left := 124;
          Top := 88;
          Width := 112;
          Height := 13;
          Caption := ahmsceffect;
        end;
        Paintbox1:=TPaintbox.Create(Self);
        with Paintbox1 do
        begin
          Parent:=TabSheet1;
          Left := 240;
          Top := 44;
          Width := 107;
          Height := 37;
        end;
        with TSpeedButton.Create(Self) do
        begin
          Parent:=TabSheet1;
          Left := 236;
          Top := 0;
          Width := 29;
          Height := 21;
          try
          Glyph.LoadFromResourceName(HInstance,'TAHMSlideForm0');
          except end;
          NumGlyphs := 2;
          OnClick := ArrowBtn1Click;
        end;
        with TSpeedButton.Create(Self) do
        begin
          Parent:=TabSheet1;
          Left := 236;
          Top := 21;
          Width := 29;
          Height := 21;
          try
          Glyph.LoadFromResourceName(HInstance,'TAHMSlideForm1');
          except end;
          NumGlyphs := 2;
          OnClick := ArrowBtn2Click;
        end;
        with TSpeedButton.Create(Self) do
        begin
          Parent:=TabSheet1;
          Left := 320;
          Top := 104;
          Width := 25;
          Height := 25;
          try
          Glyph.LoadFromResourceName(HInstance,'TAHMSlideForm3');
          except end;
          NumGlyphs := 2;
          OnClick := Button1Click;
        end;
        with TSpeedButton.Create(Self) do
        begin
          Parent:=TabSheet1;
          Left := 272;
          Top := 104;
          Width := 21;
          Height := 21;
          try
          Glyph.LoadFromResourceName(HInstance,'TAHMSlideForm2');
          except end;
          NumGlyphs := 2;
          OnClick := SpeedButton4Click;
        end;
        Listbox1:=TListbox.Create(Self);
        with Listbox1 do
        begin
          Parent:=TabSheet1;
          Left := 124;
          Top := 0;
          Width := 109;
          Height := 85;
          ItemHeight := 13;
          Style := lbOwnerDrawFixed;
          TabOrder := 0;
          OnClick := ListBox1Click;
        end;
        RadioGroup1:=TRadioGroup.Create(Self);
        with RadioGroup1 do
        begin
          Parent:=TabSheet1;
          Left := 8;
          Top := 56;
          Width := 109;
          Height := 69;
          Caption := ahmecselectedslide;
          ItemIndex := 0;
          Items.Text:=ahmecslidetype;
          TabOrder := 1;
          OnClick := RadioGroup1Click;
        end;
        ComboBox1:= TComboBox.Create(Self);
        with Combobox1 do
        begin
          Parent:=TabSheet1;
          Left := 124;
          Top := 104;
          Width := 149;
          Height := 21;
          ItemHeight := 13;
          Items.Text := '00 - Random'+#13+'01 - None'+#13+'02 - Wipe Top To Bottom'+#13+'03 - Wipe Bottom To Top'
            +#13+'04 - Wipe Left To Right'+#13+'05 - Wipe Right To Left'+#13+'06 - Stretch Up'+#13+'07 - Stretch Down'
            +#13+'08 - Stretch Left'+#13+'09 - Stretch Right'+#13+'10 - Close Horizontal Curtain'+#13+'11 - Open Horizontal Curtain'
            +#13+'12 - Close Vertical Curtain'+#13+'13 - Open Vertical Curtain'+#13+'14 - Vertical Interlace'
            +#13+'15 - Horizontal Interlace'+#13+'16 - Left-Right Doppel'+#13+'17 - Top-Bottom Doppel'+#13+'18 - Right-Left Doppel'
            +#13+'19 - Bottom-Top Doppel'+#13+'20 - Left-Right Doppel In Out'+#13+'21 - Top-Bottom Doppel In Out'
            +#13+'22 - Right-Left Doppel In Out'+#13+'23 - Bottom-Top Doppel In Out'+#13+'24 - Left-Top To Right-Bottom Wipe'
            +#13+'25 - Left-Bottom To Right-Top Wipe'+#13+'26 - Right-Top To Left-Bottom Wipe'+#13+'27 - Right-Bottom To Left-Top Wipe'
            +#13+'28 - LTRB Closing Curtain'+#13+'29 - RTLB Closing Curtain'+#13+'30 - Quad Vertical Interlace'
            +#13+'31 - Quad Horizontal Interlace'+#13+'32 - Doppel Vertical Interlace'+#13+'33 - Doppel Horizontal Interlace'
            +#13+'34 - Vertical Quad Up'+#13+'35 - Vertical Doppel Down'+#13+'36 - Vetical Quad Down'+#13+'37 - Vertical Doppel Up'
            +#13+'38 - Wipe Effect 1'+#13+'39 - Wipe Effect 2'+#13+'40 - Wipe Effect 3'+#13+'41 - BitBlt'
            +#13+'42 - Drip Vertical'+#13+'43 - Drip Horizontal'+#13+'44 - Step Wipe Vertical'+#13+'45 - Step Wipe Horizontal'
            +#13+'46 - Screen Off'+#13+'47 - Fade Down'+#13+'48 - Wipe Effect 4'+#13+'49 - Wipe Effect 5'+#13+'50 - Wipe Effect 6'
            +#13+'51 - Horizontal Quad Left'+#13+'52 - Horizontal Doppel Right'+#13+'53 - Horizontal Quad Right'+#13+'54 - Horizontal Doppel Left';
          TabOrder := 2;
          OnChange := ComboBox1Change;
        end;
        with TBitBtn.Create(Self) do
        begin
          Parent:=TabSheet1;
          Left := 4;
          Top := 4;
          Width := 109;
          Height := 21;
          Caption := 'Add Slide';
          TabOrder := 3;
          OnClick := Button8Click;
        end;
        with TBitbtn.Create(Self) do
        begin
          Parent:=TabSheet1;
          Left := 4;
          Top := 24;
          Width := 109;
          Height := 21;
          Caption := 'Delete Slide';
          TabOrder := 4;
          OnClick := Button9Click;
        end;
      end;
      TabSheet2:=TTabSheet.Create(PageControl1);
      with TabSheet2 do
      begin
        PageControl:=PageControl1;
        Parent:=PageControl1;
        Caption := 'Text';
        with TLabel.Create(Self) do
        begin
          Parent:=TabSheet2;
          Left := 4;
          Top := 0;
          Width := 135;
          Height := 13;
          Caption := 'Insert the Text to be shown :';
        end;
        Memo1:=TMemo.Create(Self);
        with Memo1 do
        begin
          Parent:=TabSheet2;
          Left := 4;
          Top := 16;
          Width := 337;
          Height := 109;
          TabOrder := 0;
          OnExit := Memo1Exit;
        end;
      end;
      TabSheet3:=TTabSheet.Create(PageControl1);
      with TabSheet3 do
      begin
        Parent:=PageControl1;
        PageControl:=PageControl1;
        Caption := 'Bitmap';
        Panel1:=TPanel.Create(self);
        with Panel1 do
        begin
          Parent:=TabSheet3;
          Left := 4;
          Top := 4;
          Width := 205;
          Height := 121;
          BevelInner := bvLowered;
          BorderWidth := 3;
          TabOrder := 0;
          Image1:=TImage.Create(Self);
          with Image1 do
          begin
            Parent:=Panel1;
            Left := 5;
            Top := 5;
            Width := 195;
            Height := 111;
            Align := alClient;
            Center := True;
          end;
        end;
        with TBitBtn.Create(Self) do
        begin
          Parent:=TabSheet3;
          Left := 236;
          Top := 104;
          Width := 105;
          Height := 21;
          Caption := 'Insert Bitmap';
          TabOrder := 1;
          OnClick := Office97Btn3Click;
        end;
        Checkbox1:=TCheckbox.Create(Self);
        with Checkbox1 do
        begin
          Parent:=TabSheet3;
          Left := 228;
          Top := 68;
          Width := 97;
          Height := 17;
          Caption := 'Stretch';
          TabOrder := 2;
          OnClick := CheckBox1Click;
        end;
      end;
    end;
  end;
  PageControl1.ActivePage:=Tabsheet1;
  OpenDialog1:=TOpenDialog.Create(Self);
  with OpenDialog1 do
  begin
    DefaultExt := '*.bmp';
    Filter := 'Windows Bitmaps|*.bmp';
    Left := 300;
    Top := 128;
  end;
end;

procedure TAHMSlideEditorForm.FormShow(Sender: TObject);
begin
  buildform;
end;

procedure TAHMSlideEditorForm.Button8Click(Sender: TObject);
begin
  allSlides.add;
  allSlides.selectedItem:=allSlides.count-1;
  allSlides.items[allSlides.selecteditem].Id:='Slide - '+inttostr(allSlides.selectedItem);
  listbox1.items.add(allSlides.items[allSlides.selecteditem].Id);
  if ListBox1.Items.Count>0 then
  Listbox1.itemindex:=allSlides.selectedItem;
  allSlides.items[allSlides.count-1].text:='';
  Combobox1.Itemindex:=0;
  Radiogroup1.Itemindex:=0;
  Image1.Picture:=nil;
  Memo1.text:='';
  buildform;
end;

procedure TAHMSlideEditorForm.Button9Click(Sender: TObject);
var i : integer;
begin
  if (Listbox1.Items.Count>0) and (Listbox1.itemindex>-1) then
  begin
    allSlides.selectedItem:=Listbox1.itemindex;
    allSlides.delete(allslides.selecteditem);
    Listbox1.clear;
    if allslides.count>0 then
    begin
      for i:=0 to allslides.count-1 do
        listbox1.items.add(allslides.items[i].Id);
      if listbox1.items.count>0 then Listbox1.itemindex:=0;
      allslides.selecteditem:=0;
    end
    else allslides.selecteditem:=-1;
  end;
  Listbox1.refresh;
end;

procedure TAHMSlideEditorForm.ListBox1Click(Sender: TObject);
begin
 Buildform;
end;

procedure TAHMSlideEditorForm.Button1Click(Sender: TObject);
begin
 close;
end;

procedure TAHMSlideEditorForm.Buildform;
begin
  if (Listbox1.itemindex>-1) and (listbox1.items.count>0) then allSlides.selectedItem:=listbox1.itemindex
  else exit;
  Image1.picture.bitmap.assign(allSlides.items[allSlides.selectedItem].Bitmap);
  Memo1.Text:=(allSlides.items[allSlides.selectedItem].text);
  Combobox1.Itemindex:=(allSlides.items[allSlides.selectedItem].effect);
  RadioGroup1.Itemindex:=(allSlides.items[allSlides.selectedItem].style);
  refresh;
end;

procedure TAHMSlideEditorForm.ArrowBtn1Click(Sender: TObject);
begin
  if (Listbox1.Items.Count>0) and (listbox1.itemindex>-1) then
  begin
   allSlides.move(listbox1.itemindex,listbox1.itemindex-1);
   listbox1.itemindex:=listbox1.itemindex-1;
   allSlides.selecteditem:=listbox1.itemindex-1;
  end;
end;

procedure TAHMSlideEditorForm.ArrowBtn2Click(Sender: TObject);
begin
  if (Listbox1.Items.Count>0) and (listbox1.itemindex<listbox1.items.count-1) then
  begin
    allSlides.move(listbox1.itemindex,listbox1.itemindex+1);
    listbox1.itemindex:=listbox1.itemindex+1;
    allSlides.selecteditem:=listbox1.itemindex+1;
  end;
end;

procedure TAHMSlideEditorForm.Office97Btn3Click(Sender: TObject);
begin
  if opendialog1.execute then
  with opendialog1 do
  begin
    Image1.Picture.bitmap.loadfromfile(opendialog1.filename);
    allSlides.items[allSlides.selectedItem].Bitmap.assign(Image1.Picture.Bitmap);
  end;
end;

procedure TAHMSlideEditorForm.ComboBox1Change(Sender: TObject);
begin
  if (Listbox1.Items.Count>0) and (listbox1.itemindex>-1) then
  begin
    allSlides.items[allSlides.selecteditem].effect:=combobox1.itemindex;
    if image2.tag=0 then
    begin
      AHMPaintEffect(combobox1.itemindex,image2.picture.bitmap.canvas,
                  paintbox1.canvas,paintbox1.width,paintbox1.height);
      image2.tag:=1;
    end else
    begin
      AHMPaintEffect(combobox1.itemindex,image3.picture.bitmap.canvas,
                  paintbox1.canvas,paintbox1.width,paintbox1.height);
      image2.tag:=0;
    end
  end;
end;

procedure TAHMSlideEditorForm.RadioGroup1Click(Sender: TObject);
begin
  if (Listbox1.Items.Count>0) and (listbox1.itemindex>-1) then
  begin
    allSlides.selecteditem:=Listbox1.itemindex;
    allSlides.items[allSlides.selecteditem].style:=Radiogroup1.itemindex;
  end;
  buildform;
end;

procedure TAHMSlideEditorForm.Memo1Exit(Sender: TObject);
begin
  if (Listbox1.Items.Count>0) and (listbox1.itemindex>-1) then
  begin
    allSlides.selecteditem:=Listbox1.itemindex;
    allslides.items[allslides.selecteditem].text:=memo1.text;
  end;
  Buildform;
end;

  

procedure TAHMColorSelectionForm.Button1Click(Sender: TObject);
begin
  if CD1.execute then listbox1.items.add(colortostring(cd1.color));
end;

procedure TAHMColorSelectionForm.Button2Click(Sender: TObject);
begin
    if (Listbox1.Items.Count>0) and (listbox1.itemindex>-1) then listbox1.items.delete(listbox1.itemindex);
end;

procedure TAHMColorSelectionForm.Button3Click(Sender: TObject);
begin
    if (Listbox1.Items.Count>0) and (listbox1.itemindex>-1) then listbox1.items.move(listbox1.Itemindex, listbox1.Itemindex-1);
end;

procedure TAHMColorSelectionForm.Button4Click(Sender: TObject);
begin
  if (Listbox1.Items.Count>0) and (listbox1.itemindex>-1) then
  if Listbox1.Itemindex<Listbox1.items.count-1 then listbox1.items.move(listbox1.Itemindex,listbox1.Itemindex+1);
end;

procedure TAHMColorSelectionForm.SetupForm;
begin
  BorderStyle := bsToolWindow;
  Caption := 'Add more Colors....';
  Clientwidth:=122;
  Clientheight:=262;
  KeyPreview := True;
  Position := poScreenCenter;
  with TBevel.Create(Self) do
  begin
    Parent:=self;
    Left := 0;
    Top := 0;
    Width := 120;
    Height := 120;
    Shape := bsFrame;
  end;
  ListBox1:=TListBox.Create(Self);
  with Listbox1 do
  begin
    Parent:=self;
    Left := 10;
    Top := 10;
    Width := 100;
    Height := 100;
    Style := lbOwnerDrawFixed;
    TabOrder := 0;
  end;
  with TButton.Create(Self) do
  begin
    Parent:=self;
    Left := 10;
    Top := 125;
    Width := 100;
    Height := 25;
    Caption := '&Add Color';
    TabOrder := 1;
    OnClick := Button1Click;
  end;
  with TButton.Create(Self) do
  begin
    Parent:=self;
    Left := 10;
    Top := 152;
    Width := 100;
    Height := 25;
    Caption := '&Delete Color';
    TabOrder := 2;
    OnClick := Button2Click;
  end;
  with TButton.Create(Self) do
  begin
    Parent:=self;
    Left := 10;
    Top := 179;
    Width := 100;
    Height := 25;
    Caption := 'Move Color &Up';
    TabOrder := 3;
    OnClick := Button3Click;
  end;
  with TButton.Create(Self) do
  begin
    Parent:=self;
    Left := 10;
    Top := 206;
    Width := 100;
    Height := 25;
    Caption := 'Move Color &Down';
    TabOrder := 4;
    OnClick := Button4Click;
  end;
  with TButton.Create(Self) do
  begin
    Parent:=self;
    Left := 10;
    Top := 233;
    Width := 100;
    Height := 25;
    Caption := 'Apply && &Close';
    TabOrder := 5;
    ModalResult:=mrOk;
  end;
  CD1:=TColorDialog.Create(Self);
end;

Procedure TAHMColorInBetweenProperty.Edit;
begin
  with TAHMColorSelectionForm.CreateNew(Application) do
  try
    SetupForm;
    listbox1.items.clear;
    listbox1.items.assign(TStrings(GetOrdValue));
    if showmodal=mrOk then
    begin
      TStrings(getordvalue).clear;
      TStrings(getordvalue).assign(Listbox1.items);
      Modified;
    end;
  finally
    free;
  end;
end;

Function TAHMColorInBetweenProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog,paReadonly];
end;

Function TAHMColorInBetweenProperty.GetValue: string;
begin
  FmtStr(Result, '(%s)', ['Extra Colors']);
end;


function TAHMHintProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paMultiSelect, paAutoUpdate];
end;

procedure TAHMHintProperty.Edit;
var x: Integer;
    S: String;
begin
  with TAHMHintEditForm.CreateNew(Application) do
  try
    SetupForm;
    S := GetStrValue;
    x := Pos('|', S);
    if (x > 0) then
    begin
      Hintbox.Text:=Copy(S, 1, x - 1);
      Statusbar.Text := Copy(S, x + 1, Length(S));
   end else if (S <> '') then Hintbox.Text:=S;
  if (ShowModal = mrOk) then
  begin
    S := '';
    S:=Hintbox.Text;
    if (Statusbar.Text <> '') then
    S := S + '|' + Statusbar.Text;
    SetStrValue(S);
  end;
  finally
    Free;
  end;
end;

procedure TAHMHintEditForm.Activate;
begin
  inherited Activate;
  Hintbox.SelectAll;
end;

procedure TAHMHintEditForm.BitBtn1Click(Sender: TObject);
begin
  ShowEnhancedAbout;
end;

procedure TAHMHintEditForm.SetupForm;
begin
  Caption:=ahmechintform;
  KeyPreview := True;
  BorderStyle:=bsToolWindow;
  Position:=poScreenCenter;
  Width:=320;
  Height:=150;
  Hintbox:=TMemo.Create(Self);
  with Hintbox do
  begin
    Parent:=self;
    Left:= 4;
    Top:= 21;
    Width:= 200;
    Height:= 60;
    MaxLength:=255;
    TabOrder:= 0;
    WordWrap:= False;
  end;
  Statusbar:=TEdit.Create(Self);
  with Statusbar do
  begin
    Parent:=self;
    Left:= 4;
    Top:= 102;
    Width:= 200;
    Height:= 21;
    MaxLength:= 100;
    TabOrder:=1;
  end;
  with TLabel.Create(Self) do
  begin
    Parent:=self;
    Left:= 4;
    Top:= 4;
    Width:= 100;
    Height:= 20;
    Caption:= 'Hint &Box Hint';
    FocusControl:=Hintbox;
    Transparent:= True;
  end;
  with TLabel.Create(Self) do
  begin
    Parent:=self;
    Left:= 4;
    Top:= 84;
    Width:= 82;
    Height:= 20;
    Caption:= '&Statusbar Hint';
    FocusControl:= Statusbar;
    Transparent:= True;
  end;
  Panel1:=TPanel.Create(Self);
  with Panel1 do
  begin
    Parent:=self;
    Left:=self.width-85;
    Top:=0;
    Width:= 85;
    Height:= self.height;
    Align:= alright;
    BevelOuter:= bvNone;
    TabOrder:= 2;
    with TButton.Create(Self) do
    begin
      Parent:=Panel1;
      Default:=true;
      Left:= Panel1.width-80;
      Top:= 4;
      Width:= 75;
      Height:= 25;
      Caption:= 'Ok';
      modalresult:=mrOk;
    end;
    with TButton.Create(Self) do
    begin
      Parent:=Panel1;
      Left:= Panel1.width-80;
      Top:= 33;
      Width:= 75;
      Height:= 25;
      Caption:= 'Cancel';
      modalresult:=mrCancel;
    end;
    with TButton.Create(Self) do
    begin
      Parent:=Panel1;
      Left:= Panel1.width-80;
      Top:= 62;
      Width:= 75;
      Height:= 25;
      Caption:= 'About';
      OnClick:= BitBtn1Click;
    end;
  end;
end;


procedure TAHMCaptionEditForm.SetupForm;
begin
  KeyPreview := True;
  Caption:=ahmechintform;
  BorderStyle:=bsToolWindow;
  Position:=poScreenCenter;
  Width:=320;
  Height:=150;
  KeyPreview := True;
  Captionbox:=TMemo.Create(Self);
  with Captionbox do
  begin
    Parent:=self;
    Left:= 4;
    Top:= 21;
    Width:= 200;
    Height:= 100;
    MaxLength:=255;
    TabOrder:= 0;
    WordWrap:= False;
  end;
  with TLabel.Create(Self) do
  begin
    Parent:=self;
    Left:= 4;
    Top:= 4;
    Width:= 100;
    Height:= 20;
    Caption:= 'Caption';
    FocusControl:=Captionbox;
    Transparent:= True;
  end;
  Panel1:=TPanel.Create(Self);
  with Panel1 do
  begin
    Parent:=self;
    Left:=self.width-85;
    Top:=0;
    Width:= 85;
    Height:= self.height;
    Align:= alright;
    BevelOuter:= bvNone;
    TabOrder:= 2;
    with TButton.Create(Self) do
    begin
      Parent:=Panel1;
      Default:=true;
      Left:= Panel1.width-80;
      Top:= 4;
      Width:= 75;
      Height:= 25;
      Caption:= 'Ok';
      modalresult:=mrOk;
    end;
    with TButton.Create(Self) do
    begin
      Parent:=Panel1;
      Left:= Panel1.width-80;
      Top:= 33;
      Width:= 75;
      Height:= 25;
      Caption:= 'Cancel';
      modalresult:=mrCancel;
    end;
    with TButton.Create(Self) do
    begin
      Parent:=Panel1;
      Left:= Panel1.width-80;
      Top:= 62;
      Width:= 75;
      Height:= 25;
      Caption:= 'About';
      OnClick:= BitBtn1Click;
    end;
  end;
end;

procedure TAHMCaptionEditForm.Activate;
begin
  inherited Activate;
  Captionbox.SelectAll;
end;


function TAHMCaptionProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paMultiSelect, paAutoUpdate];
end;

procedure TAHMCaptionProperty.Edit;
var  S: String;
begin
  with TAHMCaptionEditForm.CreateNew(Application) do
  try
    SetupForm;
    S := GetStrValue;
    Captionbox.Text:=s;
    if (ShowModal = mrOK) then
    begin
      S := '';
      S:=CaptionBox.Text;
      SetStrValue(S);
    end;
  finally
    Free;
  end;
end;

procedure TAHMCaptionEditForm.BitBtn1Click(Sender: TObject);
begin
  ShowEnhancedAbout;
end;



end.
