home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kolekce / d456 / DCSLIB25.ZIP / DCCapEdit.pas < prev    next >
Pascal/Delphi Source File  |  2001-01-20  |  2KB  |  83 lines

  1. {
  2.  BUSINESS CONSULTING
  3.  s a i n t - p e t e r s b u r g
  4.  
  5.          Components Library for Borland Delphi 4.x, 5.x
  6.          Copyright (c) 1998-2000 Alex'EM
  7.  
  8. }
  9. unit DCCapEdit;
  10.  
  11. interface
  12.  
  13. uses
  14.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  15.   StdCtrls, ExtCtrls, DCStdCtrls;
  16.  
  17. type
  18.   TStringEditDlg = class(TForm)
  19.     Memo: TMemo;
  20.     Bevel1: TBevel;
  21.     OKBtn: TButton;
  22.     CancelBtn: TButton;
  23.     procedure UpdateStatus(Sender: TObject);
  24.     procedure MemoKeyDown(Sender: TObject; var Key: Word;
  25.       Shift: TShiftState);
  26.   private
  27.     LineCount: TDCHeaderPanel;
  28.   public
  29.     constructor Create(AComponent: TComponent); override;
  30.     destructor Destroy; override;
  31.   end;
  32.  
  33. implementation
  34.  
  35. {$R *.DFM}
  36.  
  37. procedure TStringEditDlg.UpdateStatus(Sender: TObject);
  38. var
  39.   Count: Integer;
  40. begin
  41.   Count := Memo.Lines.Count;
  42.   if Count = 1 then
  43.     LineCount.Caption := Format('/ow{5}%d Line',  [Count])
  44.   else
  45.     LineCount.Caption := Format('/ow{5}%d Lines', [Count]);
  46. end;
  47.  
  48.  
  49. procedure TStringEditDlg.MemoKeyDown(Sender: TObject; var Key: Word;
  50.   Shift: TShiftState);
  51. begin
  52.   if Key = VK_ESCAPE then CancelBtn.Click;
  53. end;
  54.  
  55. constructor TStringEditDlg.Create(AComponent: TComponent);
  56. begin
  57.   inherited;
  58.   LineCount := TDCHeaderPanel.Create(Self);
  59.   with LineCount do
  60.   begin
  61.     Parent := Self;
  62.     Left := 0;
  63.     Top := 0;
  64.     Width := 345;
  65.     Height := 19;
  66.     Alignment := taLeftJustify;
  67.     Caption := 'LineCount';
  68.     Color := clBtnFace;
  69.     TabOrder := 3;
  70.     VertCentered := True;
  71.     ButtonAllign := False;
  72.     CloseButtonExist := False;
  73.   end;
  74. end;
  75.  
  76. destructor TStringEditDlg.Destroy;
  77. begin
  78.   LineCount.Free;
  79.   inherited;
  80. end;
  81.  
  82. end.
  83.