1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
{
**********************************************************************
This file is part of the Free Pascal run time library.
See the file COPYING.FPC, included in this distribution,
for details about the license.
**********************************************************************
Select export format from available formats.
Copyright (c) 2007 by Michael Van Canneyt, member of the Free Pascal development team
}
unit frmSelectExportFormat;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
ButtonPanel, fpdbexport, sdb_consts;
type
{ TSelectExportFormatForm }
TSelectExportFormatForm = class(TForm)
BPButtons: TButtonPanel;
RGFormats: TRadioGroup;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
function GetSelected: TExportFormatItem;
procedure SetSelected(const AValue: TExportFormatItem);
private
{ private declarations }
public
{ public declarations }
Procedure FillFormats;
Property SelectedFormat : TExportFormatItem Read GetSelected Write SetSelected;
end;
var
SelectExportFormatForm: TSelectExportFormatForm;
implementation
{$R *.lfm}
{ TSelectExportFormatForm }
procedure TSelectExportFormatForm.FormShow(Sender: TObject);
begin
FillFormats;
end;
procedure TSelectExportFormatForm.FormCreate(Sender: TObject);
begin
//
Caption:= sdb_Selectdataexportformat;
RGFormats.Caption:=sdb_Availableexportformats;
//
end;
function TSelectExportFormatForm.GetSelected: TExportFormatItem;
begin
With RGFormats do
If (ItemIndex=-1) then
Result:=Nil
else
Result:=Items.Objects[ItemIndex] as TExportFormatItem;
end;
procedure TSelectExportFormatForm.SetSelected(const AValue: TExportFormatItem);
begin
With RGFormats do
begin
If (Items.Count=0) then
FillFormats;
If (AValue=Nil) then
ItemIndex:=-1
else
ItemIndex:=Items.IndexOfObject(AValue);
end;
end;
procedure TSelectExportFormatForm.FillFormats;
Var
F : TExportFormats;
I : Integer;
FI : TExportFormatItem;
begin
F:=ExportFormats;
For I:=0 to F.Count-1 do
begin
FI:=F[i];
RGFormats.Items.AddObject(FI.Description,FI);
end;
If RGFormats.Items.Count>0 then
RGFormats.ItemIndex:=0;
end;
end.
|