home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 January (DVD) / Chip_2003-01_DVD.iso / ChipCD / zkuste / delphi / kolekce / d567 / FLEXCEL.ZIP / Design / UFlexCelDbMemEditor.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2002-10-03  |  2.2 KB  |  93 lines

  1. unit UFlexCelDbMemEditor;
  2.  
  3. interface
  4.   uses
  5.   {$IFDEF LINUX}
  6.     QDialogs,
  7.   {$ENDIF}
  8.   {$IFDEF WIN32}
  9.     Dialogs,
  10.   {$ENDIF}
  11.  
  12.   {$IFDEF ConditionalExpressions}{$if CompilerVersion >= 14}  //Delphi 6 or above
  13.     DesignIntf, DesignEditors,
  14.   {$IFEND}
  15.   {$ELSE}
  16.     DsgnIntf,
  17.   {$ENDIF}
  18.     SysUtils, UFlxMemTable, UFlxMessages;
  19.  
  20. type
  21.   TFlexCelDbMemEditor = class(TDefaultEditor )
  22.   private
  23.     { Private declarations }
  24.   protected
  25.   {$IFDEF ConditionalExpressions}{$if CompilerVersion >= 14}  //Delphi 6 or above
  26.     procedure EditProperty(const PropertyEditor: IProperty; var Continue: Boolean); override;
  27.   {$IFEND}
  28.   {$ELSE}
  29.     procedure EditProperty(PropertyEditor: TPropertyEditor; var Continue, FreeEditor: Boolean); override;
  30.   {$ENDIF}
  31.     { Protected declarations }
  32.   public
  33.     { Public declarations }
  34.     function GetVerb(Index: Integer): String; override;
  35.     function GetVerbCount: Integer; override;
  36.     procedure ExecuteVerb(Index: Integer); override;
  37.   published
  38.     { Published declarations }
  39.   end;
  40.  
  41. procedure Register;
  42.  
  43. implementation
  44. function TFlexCelDbMemEditor.GetVerbCount: Integer;
  45. begin
  46.   Result := 2;
  47. end;
  48.  
  49. function TFlexCelDbMemEditor.GetVerb(Index: Integer): String;
  50.  
  51. begin
  52.   case Index of
  53.     0: Result := 'Edit Fields...';
  54.     1: Result := 'About...';
  55.   end;
  56. end;
  57.  
  58. procedure TFlexCelDbMemEditor.ExecuteVerb(Index: Integer);
  59. var
  60.   IsModified: boolean;
  61. begin
  62.   IsModified:=false;
  63.   case Index of
  64.     0: Edit; //(Component as TFlxMemTable).Columns.Edit;
  65.     1: ShowMessage(Format(MsgAbout,[FlexCelVersion]));
  66.   end;  //case
  67.   if IsModified then Designer.Modified;
  68. end;
  69.  
  70. procedure Register;
  71. begin
  72.   RegisterComponentEditor(TFlxMemTable, TFlexCelDbMemEditor);
  73. end;
  74.  
  75.  
  76. {$IFDEF ConditionalExpressions}{$if CompilerVersion >= 14}  //Delphi 6 or above
  77.   procedure TFlexCelDbMemEditor.EditProperty(const PropertyEditor: IProperty; var Continue: Boolean);
  78. {$IFEND}
  79. {$ELSE}
  80.   procedure TFlexCelDbMemEditor.EditProperty(PropertyEditor: TPropertyEditor; var Continue, FreeEditor: Boolean);
  81. {$ENDIF}
  82. begin
  83.   if (CompareText(PropertyEditor.GetName, 'Columns')=0) then
  84.   begin
  85.     PropertyEditor.Edit;
  86.     Continue:=false;
  87.   end
  88.   else inherited;
  89. end;
  90.  
  91.  
  92. end.
  93.