I have a DBgrid and one column is a look up to a table. When the the drop down list is envoked and when the form is being resized or moved around, the list will still be shown at the same spot where it first was envoked. I don't know what seems to be the problem.
how to fix delphi dbgrid dropdown list problem
Collapse
X
-
Code:procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin if (gdFocused in State) then begin if (Field.FieldName = DBLookupCombo1.DataField) then begin DBLookupCombo1.Left := Rect.Left + DBGrid1.Left; DBLookupCombo1.Top := Rect.Top + DBGrid1.top; DBLookupCombo1.Width := Rect.Right - Rect.Left; { DBLookupCombo1.Height := Rect.Bottom - Rect.Top; } DBLookupCombo1.Visible := True; end; end; end;
-
procedure TForm1.DBGrid1D rawDataCell(Sen der: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState) ;
begin
if (gdFocused in State) then
begin
if (Field.FieldNam e = DBLookupCombo1. DataField) then
begin
DBLookupCombo1. Left := Rect.Left + DBGrid1.Left;
DBLookupCombo1. Top := Rect.Top + DBGrid1.top;
DBLookupCombo1. Width := Rect.Right - Rect.Left;
{ DBLookupCombo1. Height := Rect.Bottom - Rect.Top; }
DBLookupCombo1. Visible := True;
end;
end;
end;
hope dis helpsComment
-
Comment