home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September / Chip_2002-09_cd1.bin / zkuste / delphi / kolekce / d56 / XMLCOMP.ZIP / test / model / DnAddress.pas next >
Pascal/Delphi Source File  |  2002-06-16  |  1KB  |  58 lines

  1. unit DnAddress;
  2.  
  3. interface
  4.  
  5. uses
  6.   Classes, DnCountry;
  7.  
  8. type
  9.   TAddress = class(TComponent)
  10.   private
  11.     FCity: string;
  12.     FNumber: string;
  13.     FZipcode: string;
  14.     FStreet: string;
  15.     FState: string;
  16.     FCountry: TCountry;
  17.     procedure SetCountry(const Value: TCountry);
  18.   public
  19.     procedure Notification(aComponent: TComponent; aOperation: TOperation); override;
  20.   published
  21.     property Street: string read FStreet write FStreet;
  22.     property Number: string read FNumber write FNumber;
  23.     property Zipcode: string read FZipcode write FZipcode;
  24.     property City: string read FCity write FCity;
  25.     property State: string read FState write FState;
  26.     property Country: TCountry read FCountry write SetCountry;
  27.   end;
  28.  
  29. implementation
  30.  
  31. { TAddress }
  32.  
  33. procedure TAddress.Notification(aComponent: TComponent;
  34.   aOperation: TOperation);
  35. begin
  36.   inherited;
  37.   if aOperation = opRemove then
  38.   begin
  39.     if aComponent = FCountry then
  40.       FCountry := nil;
  41.   end;
  42. end;
  43.  
  44. procedure TAddress.SetCountry(const Value: TCountry);
  45. begin
  46.   FCountry := Value;
  47.   if FCountry <> nil then
  48.     FCountry.FreeNotification(Self);
  49. end;
  50.  
  51. initialization
  52.   RegisterClasses([TAddress]);
  53.  
  54. finalization
  55.   UnregisterClasses([TAddress]);
  56.  
  57. end.
  58.