home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / SOFT / EDCLEAR.ZIP / HQClearAll.pas next >
Encoding:
Pascal/Delphi Source File  |  1999-01-27  |  3.3 KB  |  99 lines

  1. {========================================================================}
  2. {=                      Copyright (c) 1998 MiSoftware                   =}
  3. {========================================================================}
  4. {=                          All Rights Reserved                         =}
  5. {========================================================================}
  6. {=  MiSoftware                  = Tel.: +61 417 572 065                 =}
  7. {========================================================================}
  8. {=  Actual versions on http://www.misoftware.com/delphi/                =}
  9. {========================================================================}
  10. {=  This code is for reference purposes only and may not be copied or   =}
  11. {=  distributed in any format electronic or otherwise except one copy   =}
  12. {=  for backup purposes.                                                =}
  13. {=                                                                      =}
  14. {=  No Delphi Component Kit or Component individually or in a collection=}
  15. {=  subclassed or otherwise from the code in this unit, or associated   =}
  16. {=  .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed     =}
  17. {=  without express permission from MiSoftware.                         =}
  18. {=                                                                      =}
  19. {=  For more licence informations please refer to the associated        =}
  20. {=  HelpFile.                                                           =}
  21. {========================================================================}
  22. {=  $Date: 1999/01/27 - 11:12:00 AM $                                     =}
  23. {========================================================================}
  24. unit HQClearAll;
  25.  
  26. interface
  27.  
  28. uses
  29.   Windows, Messages, SysUtils, Classes, Controls, StdCtrls, Forms;
  30.  
  31. type
  32.   THQClearAll = class(TComponent)
  33.   private
  34.     FCText    : String;
  35.     FCOptions : Boolean;
  36.     procedure SetOptions(Value: Boolean);
  37.     procedure SetText(Value: String);
  38.     function GetForm: TForm;
  39.   public
  40.     { Public declarations }
  41.     constructor Create(aOwner : TComponent); override;
  42.     procedure Start;
  43.   published
  44.     { Published declarations }
  45.     property ChangeText : string read FCText write SetText;
  46.     property Change     : boolean read FCOptions write SetOptions;
  47.   end;
  48.  
  49. {$R HQClearAll.RES}
  50.  
  51. procedure Register;
  52.  
  53. implementation
  54.  
  55. procedure Register;
  56. begin
  57.   RegisterComponents('DelphiHQ', [THQClearAll]);
  58. end;
  59.  
  60. constructor THQClearAll.Create(aOwner : TComponent);
  61. begin
  62.   inherited create(aOwner);
  63.   FCOptions := False;
  64. end;
  65.  
  66. procedure THQClearAll.SetText(Value: String);
  67. begin
  68.   FCText := Value;
  69. end;
  70.  
  71. procedure THQClearAll.SetOptions(Value: Boolean);
  72. begin
  73.   FCOptions := Value;
  74. end;
  75.  
  76. function THQClearAll.GetForm: TForm;
  77. begin
  78.   if Owner is TCustomForm then Result := TForm(Owner as TCustomForm)
  79.   else Result := nil;
  80. end;
  81.  
  82. procedure THQClearAll.Start;
  83. var
  84.   i : integer;
  85. begin
  86.   for i := 0 to GetForm.ComponentCount-1 do
  87.     begin
  88.       if (GetForm.Components[i] is TEdit) then
  89.       begin
  90.         if (FCOptions = True) then
  91.            (GetForm.Components[i] as TEdit).Text := FCText 
  92.         else
  93.            (GetForm.Components[i] as TEdit).Text := '';
  94.       end;
  95.   end;
  96. end;
  97.  
  98. end.
  99.