الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

dblookupcombobox in dbgrid

بدأه popdream في 25 ديسمبر 2013 · 1 رد · 1,132 مشاهدة · في لغة Delphi
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

بسم الله الرحمن الرحيم

 

طريقة استعمال dblookupcombobox داخل dbgrid

procedure TForm1.FormCreate(Sender: TObject);
begin
  DBLookupComboBox1.Visible    := False;
 end;
procedure TForm1.DBGrid1DrawColumnCell
  (Sender: TObject; 
   const Rect: TRect; 
   DataCol: Integer; 
   Column: TColumn; 
   State: TGridDrawState);
begin
  if (gdFocused in State) then
  begin
    if (Column.Field.FieldName = DBLookupComboBox1.DataField) then
    with DBLookupComboBox1 do 
    begin
      Left := Rect.Left + DBGrid1.Left + 2;
      Top := Rect.Top + DBGrid1.Top + 2;
      Width := Rect.Right - Rect.Left;
      Width := Rect.Right - Rect.Left;
      Height := Rect.Bottom - Rect.Top;

      Visible := True;
    end;
  end
end;
procedure TForm1.DBGrid1ColExit(Sender: TObject);
begin
  if DBGrid1.SelectedField.FieldName = DBLookupComboBox1.DataField then 
    DBLookupComboBox1.Visible := False
end;
procedure TForm1.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
  if (key = Chr(9)) then Exit;

  if (DBGrid1.SelectedField.FieldName = DBLookupComboBox1.DataField) then
  begin
    DBLookupComboBox1.SetFocus;
    SendMessage(DBLookupComboBox1.Handle, WM_Char, word(Key), 0);
  end
end;

منقول للافادة

2
#2

شكرا أخي الكريم

مواضيع مشابهة