Einzelnen Beitrag anzeigen

Hansa

Registriert seit: 9. Jun 2002
Ort: Saarland
7.554 Beiträge
 
Delphi 8 Professional
 
#21

Re: Daten von DBLookUpListBox in ComboBox übernehmen

  Alt 5. Aug 2003, 21:17
Hier ist vielleicht was:

Delphi-Quellcode:
unit grid;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DBCtrls, DB, FIBDataSet, pFIBDataSet, FIBDatabase, pFIBDatabase,
  Grids, DBGrids;

type
  TForm1 = class(TForm)
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    pFIBDatabase1: TpFIBDatabase;
    pFIBTransaction1: TpFIBTransaction;
    pFIBDataSet1: TpFIBDataSet;
    DataSource2: TDataSource;
    pFIBDatabase2: TpFIBDatabase;
    pFIBTransaction2: TpFIBTransaction;
    pFIBDataSet2: TpFIBDataSet;
    DBLookupComboBox1: TDBLookupComboBox;
    procedure FormCreate(Sender: TObject);
    procedure DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
      Field: TField; State: TGridDrawState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  DBLookUpComboBox1.visible := false;
end;

procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect;
  Field: TField; State: TGridDrawState);
begin
  if (gdFocused in state) then begin
    if (Field.FieldName = DBLookupComboBox1.DataField) then begin
      DBLookUpComboBox1.Left := Rect.Left + DBGrid1.Left;
      DBLookUpComboBox1.Top := Rect.Top + DBGrid1.Top;
      DBLookUpComboBox1.Width := Rect.Right - Rect.Left;
// DBLookUpComboBox1.Height := Rect.Bottom - Rect.Top;
      DBLookUpComboBox1.Visible := true;
      DBLookUpComboBox1.DropDownRows := 5;
    end;
  end;
end;

end.
So in der Richtung müßte es gehen. Mit FIBplus geht es jedenfalls.
Gruß
Hansa
  Mit Zitat antworten Zitat