Re: DBGrid1.OnDrawColumnCell goes into infinite loop



Chris L. wrote:
Hi,
I use the following code in OnDrawColumnCell to embed DBCheckboxes into a
DBGrid. Everything works fine until I move (using mouse drag) a column with
a checkbox to another column location. The drawing of the active column
Checkbox going into infinite loop and causes the screen to freeze. There is
no code in OnColumnMoved method.

Any suggestion will be greatly appreciated.

[...]

  if (gdFocused in State) then
  begin
    if (Column.Field.FieldName = DBCheckBoxFiled.DataField) then
    begin
     //DBCheckBoxFiled.Left := Rect.Right + DBCheckBoxFiled.Width;
//Rect.Left + DBGrid1.Left + 2;
     //DBCheckBoxFiled.Left := 68; //Rect.Left + DBGrid1.Left +
DBCheckBoxFiled.Width;//Rect.Right + 6;
     DBCheckBoxFiled.Left := Round((Rect.Left + Rect.Right -
DBCheckBoxFiled.Width)/2) + 5; // the CheckBox "floats" on top of the
DBGrid, measured from the same Left starting point
     DBCheckBoxFiled.Top := Rect.Top + DBGrid1.top + 2;
     DBCheckBoxFiled.Width := 17; //Rect.Right - Rect.Left;
     DBCheckBoxFiled.Height := Rect.Bottom - Rect.Top;

DBCheckBoxFiled.Visible := True;

I'd guess there was something here - moving the checkbox around would possibly require another drawing of cells - etc...


Bjoerge
.



Relevant Pages

  • Re: Drag & Drop
    ... so I guess I should'nt bother you any more. ... - OnMouseDown only works if I click the mouse while on the DBGrid Titles (it ... - I can select a DBGrid cell, then drag the mouse from any part of the Title ... > can put that source data into the TEdit when the drag is dropped. ...
    (comp.lang.pascal.delphi.misc)
  • Dont worry! This is simple
    ... Since my question on Drag and drop from a DBGrid was too difficult, ... too complicated and inefficient) ... Prev by Date: ...
    (comp.lang.pascal.delphi.misc)