home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 October / Chip_2002-10_cd1.bin / zkuste / delphi / kolekce / d56 / FLEXCEL.ZIP / BiffEdit / UEditDialog.pas < prev    next >
Pascal/Delphi Source File  |  2002-05-13  |  1KB  |  55 lines

  1. unit UEditDialog;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, Buttons, ExtCtrls, UBiffEditUtil, ComCtrls;
  8.  
  9. type
  10.   TEditDialog = class(TForm)
  11.     edId: TEdit;
  12.     Label1: TLabel;
  13.     edSize: TEdit;
  14.     Label2: TLabel;
  15.     edData: TRichEdit;
  16.     btnOk: TBitBtn;
  17.     btnCancel: TBitBtn;
  18.     Label3: TLabel;
  19.     Bevel2: TBevel;
  20.     edVersion: TEdit;
  21.     lblVersion: TLabel;
  22.     StatusBar: TStatusBar;
  23.     procedure btnOkClick(Sender: TObject);
  24.     procedure edDataSelectionChange(Sender: TObject);
  25.   private
  26.     { Private declarations }
  27.   public
  28.     { Public declarations }
  29.   end;
  30.  
  31.  
  32. implementation
  33.  
  34. {$R *.DFM}
  35.  
  36. procedure TEditDialog.btnOkClick(Sender: TObject);
  37. begin
  38.   //Validate
  39.   try
  40.     StrToInt('$'+edId.Text);
  41.     if (StrToInt(edSize.Text)<0) then raise Exception.Create(ErrBadLen);
  42.     HexToStr(edData.Text,StrToInt(edSize.Text));
  43.   except
  44.     ModalResult:=mrNone;
  45.     raise;
  46.   end;
  47. end;
  48.  
  49. procedure TEditDialog.edDataSelectionChange(Sender: TObject);
  50. begin
  51.   StatusBar.SimpleText:= format(TxtCursorPos,[edData.SelStart div 3]);
  52. end;
  53.  
  54. end.
  55.