Чтение онлайн

ЖАНРЫ

Советы по Delphi. Версия 1.4.3 от 1.1.2001

Озеров Валентин

Шрифт:

SrcHandle: HDBICur;

 protected

function CreateHandle: HDBICur; override;

 public

procedure OpenClone(ASrcHandle: HDBICur);

 end;

function EditData(const DBHandle: HDBIDB; const DSHandle: HDBICur): Boolean; stdcall;

var DBEditForm: TDBEditForm;

implementation

{$R *.DFM}

{
Экспорт }

function EditData(const DBHandle: HDBIDB; const DSHandle: HDBICur): Boolean; stdcall;

var DBEditForm: TDBEditForm;

begin

DBEditForm := TDBEditForm.Create(Application);

 with DBEditForm do try

// Устанавливаем дескриптор Database1 на открытую в текущий момент базу данных

Database1.Handle := DBHandle;

TableClone := TTableClone.Create(DBEditForm);

try

TableClone.DatabaseName := 'DB1';

DataSource1.DataSet := TableClone;

TableClone.OpenClone(DSHandle);

Result := (ShowModal = mrOK);

if Result then begin

TableClone.UpdateCursorPos;

DbiSetToCursor(DSHandle, TableClone.Handle);

end;

finally

TableClone.Free;

end;

 finally

Free;

 end;

end;

{ TTableClone }

procedure TTableClone.OpenClone(ASrcHandle: HDBICur);

begin

 SrcHandle := ASrcHandle;

 Open;

 DbiSetToCursor(Handle, SrcHandle);

 Resync([]);

end;

function TTableClone.CreateHandle: HDBICur

begin

 Check(DbiCloneCursor(SrcHandle, False, False, Result));

end;

end.

{ EDITFORM.DFM }

object DBEditForm: TDBEditForm

 Left = 201

 Top = 118

 Width = 354

 Height = 289

 ActiveControl = Panel1

 Caption = 'DBEditForm'

 Font.Color = clWindow

 TextFont.Height = -11

 Font.Name = 'MS Sans Serif'

 Font.Style = []

 Position = poScreenCenter

 PixelsPerInch = 96

 TextHeight = 13

 object Panel1: TPanel

Left = 0

Top = 0

Width = 346

Height = 41

Align = alTop

TabOrder = 0

object DBNavigator: TDBNavigator

Left = 8

Top = 8

Width = 240

Height = 25

DataSource = DataSource1

Ctl3D = FalseParent

Ctl3D = False

TabOrder = 0

end

object OKButton: TButton

Left = 260

Top = 8

Width = 75

Height = 25

Caption = 'OK'

Default = True

ModalResult = 1

TabOrder = 1

end

 end

 object Panel2: TPanel

Left = 0

Top = 41

Width = 346

Height = 221

Align = alClient

BevelInner = bvLoweredBorder

Width = 4

Caption = 'Panel2'

TabOrder = 1

object ScrollBox: TScrollBox

Left = 6

Top = 6

Width = 334

Height = 209

HorzScrollBar.Margin = 6

HorzScrollBar.Range = 147

VertScrollBar.Margin = 6

VertScrollBar.Range = 198

Align = alClient

AutoScroll = False

BorderStyle = bsNone

TabOrder = 0

object Label1: TLabel

Left = 6

Поделиться с друзьями: