{ $Id$ } { ***************************************************************************** See the file COPYING.modifiedLGPL.txt, included in this distribution, for details about the license. ***************************************************************************** Author: Michael Van Canneyt This unit registers the TMemDataset components of the FCL. } unit frmSelectDataset; {$mode objfpc}{$H+} interface uses Classes, SysUtils, DB, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, MemDS, ComponentEditors, PropEdits, LazarusPackageIntf; Type TMemDatasetEditor = Class(TComponentEditor) FStartIndex : Integer; Public procedure ExecuteVerb(Index: Integer); override; function GetVerb(Index: Integer): string; override; function GetVerbCount: Integer; override; Function GetMemDataset : TMemDataset; Procedure CopyDataset; virtual; Procedure CreateTable; virtual; end; { TSelectSrcDatasetForm } TSelectSrcDatasetForm = class(TForm) BOK: TButton; BCancel: TButton; CBMetaDataOnly: TCheckBox; LLBDatasets: TLabel; LBDatasets: TListBox; procedure BOKClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure LBDatasetsClick(Sender: TObject); private public end; Resourcestring SErrComponentNotFound = 'Error: Component "%s" not found'; SMenuCreateDataset = 'Create dataset'; SMenuCopyDataset = 'Copy data from Dataset'; SErrSelectDataset = 'Please select a dataset first'; SCaption = 'Select dataset to copy from'; SCopyMeta = 'Copy only metadata'; SDataset = '&Dataset to copy from:'; SOkBtn = 'OK'; SCancelBtn = 'Cancel'; var SelectSrcDatasetForm: TSelectSrcDatasetForm; procedure Register; implementation {$R *.lfm} {$R memdsicons.res} procedure RegisterUnitMemDS; begin RegisterComponents('Data Access',[TMemDataset]); end; procedure Register; begin RegisterUnit('MemDS',@RegisterUnitMemDS); RegisterComponentEditor(TMemDataset,TMemdatasetEditor) ; RegisterPropertyEditor(TypeInfo(String),TMemDataset,'FileName', TFileNamePropertyEditor); end; { TMemDatasetEditor } procedure TMemDatasetEditor.ExecuteVerb(Index: Integer); begin If IndexGetComponent) then LBDatasets.Items.Add(F.Components[i].Name); If ShowModal=mrOK then begin With LBDatasets do DSN:=Items[ItemIndex]; DS:=Nil; I:=0; While (DS=Nil) and (I