Floating a control over a dbgrid
Posted on 1998-01-18
I am kind of stuck with the following:
I am currently floating a control (datepicker from rxlib) over a grid with the following code:
procedure TLog.LogGridDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
If DataCol = 0 then begin
If LogModule.tblLog.State in [dsEdit, dsInsert] then begin
If (gdFocused in State) then begin
Date.Left := LogGrid.Left + Rect.Left;
Date.Top := LogGrid.Top + Rect.Top;
Date.Width := Rect.Right - Rect.Left;
Date.Visible := True;
And when I want to make the control invisible again I use the following code:
procedure TLog.LogGridColExit(Sender: TObject);
If LogGrid.Columns.Title.Caption = Date.Name then
Date.Visible := False;
Ok now to my question:
How do I make the control invisible when I click on the horizontal scroll bar and also when I click on a component outside of the grid.
P.S. If you try the code above you will see it only makes the control invisible when I click on another field in the grid.
Thanks in advance for any help you can provide.
Note to Igor
If it would not take up much of your time then I think coming up with a
away to override the dbgrid would be the best bet. And since this sound like a big task I have increased the points as you can see.