熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Delphi編程 >> 正文

Delphi 開發數據庫控件的方法[3]

2022-06-13   來源: Delphi編程 

  procedure Register;
  implementation
  procedure Register;
  begin
  RegisterComponents(`Samples` [TDBFieldComboBox]);
  end;
  constructor TDBFieldComboBoxcreate(Aowner:Tcomponent);
  var Ij:integer;
  begin
   inherited Create(Aowner);
   FDataLink:=TFieldDataLinkCreate ;
   ondropdown:=dropdown;
   text:=``;
  end;
  destructor TDBFieldComboBoxDestroy;
  begin
   FDataLinkFree ;
   inherited Destroy;
  end;
  function TListBoxGetField:string;
  var
   Ij:integer;
  begin
  j:=FDataLinkDataSourceDataSet FieldCount ;
   for I := to j- do
   begin
   if FDataLinkDataSourceDataSetFields[I]Displayname=text then
   begin
   Result:=FDataLinkDataSourceDataSetFields[I]FieldName;
   exit;
   end;
   end;
  end;
  procedure TDBFieldComboBoxSetDataSource ( Value:TDataSource);
  begin
   FDataLinkDataSource :=value;
  end;
  function TDBFieldComboBoxGetDataSource :TDataSource;
  begin
   Result:=FDataLinkDataSource ;
  end;
  procedure TDBFieldComboBoxStartDrag(Sender: Tobject; var DragObject: TDragObject);
  begin
  end;
  procedure TDBFieldComboBoxDropDown(Sender: Tobject);
   var
   Ij:integer;
  begin
   j:=;
   j:=FDataLinkDataSourceDataSet FieldCount;
   I:=;
   repeat
   itemsAdd (FDataLinkDataSetFields[I]DisplayName );//FieldName);
   I:=I+;
   until I>j-;
  end;
  end

[]  []  []  


From:http://tw.wingwit.com/Article/program/Delphi/201311/8534.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.