home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 September / Chip_2001-09_cd1.bin / zkuste / delphi / kolekce / d123456 / DFS.ZIP / BrowseDrReg.pas < prev    next >
Pascal/Delphi Source File  |  2001-06-27  |  2KB  |  76 lines

  1. {$I DFS.INC}
  2.  
  3. unit BrowseDrReg;
  4.  
  5. interface
  6.  
  7. uses
  8.   BrowseDr,
  9.   {$IFDEF DFS_NO_DSGNINTF}
  10.   DesignIntf,
  11.   DesignEditors;
  12.   {$ELSE}
  13.   DsgnIntf;
  14.   {$ENDIF}
  15.  
  16.  
  17. type
  18.   { A component editor (not really) to allow on-the-fly testing of the      }
  19.   { dialog.  Right click the component and select 'Test Dialog', or simply  }
  20.   { double click the component, and the browse dialog will be displayed     }
  21.   { with the current settings.                                              }
  22.   TBrowseDialogEditor = class(TDefaultEditor)
  23.   public
  24.     procedure ExecuteVerb(Index : Integer); override;
  25.     function GetVerb(Index : Integer): string; override;
  26.     function GetVerbCount : Integer; override;
  27.     procedure Edit; override;
  28.   end;
  29.  
  30. procedure Register;
  31.  
  32.  
  33. implementation
  34.  
  35. uses
  36.   SysUtils, Dialogs, Classes, DFSAbout;
  37.  
  38. // Component Editor (not really) to allow on the fly testing of the dialog
  39. procedure TBrowseDialogEditor.ExecuteVerb(Index: Integer);
  40. begin
  41.   {we only have one verb, so exit if this ain't it}
  42.   if Index <> 0 then Exit;
  43.   Edit;
  44. end;
  45.  
  46. function TBrowseDialogEditor.GetVerb(Index: Integer): AnsiString;
  47. begin
  48.   Result := 'Test Dialog';
  49. end;
  50.  
  51. function TBrowseDialogEditor.GetVerbCount: Integer;
  52. begin
  53.   Result := 1;
  54. end;
  55.  
  56. procedure TBrowseDialogEditor.Edit;
  57. begin
  58.   with TdfsBrowseDirectoryDlg(Component) do
  59.     if Execute then
  60.       MessageDlg(Format('Item selected:'#13#13'%s', [Selection]),
  61.                  mtInformation, [mbOk], 0);
  62. end;
  63.  
  64.  
  65.  
  66. procedure Register;
  67. begin
  68.   RegisterComponents('DFS', [TdfsBrowseDirectoryDlg]);
  69.   RegisterComponentEditor(TdfsBrowseDirectoryDlg, TBrowseDialogEditor);
  70.   RegisterPropertyEditor(TypeInfo(string), TdfsBrowseDirectoryDlg, 'Version',
  71.      TDFSVersionProperty);
  72. end;
  73.  
  74.  
  75. end.
  76.