Re: Active row in DBGrid?
From: cOOl (coolman_kk_at_yahoo.com)
Date: 11/26/03
- Next message: Jonas Wik: "Re: breakpoints not working"
- Previous message: Mike Williams (TeamB): "Re: Disappearing Components?"
- In reply to: Kurt Barthelmess: "Re: Active row in DBGrid?"
- Next in thread: Kurt Barthelmess: "Re: Active row in DBGrid?"
- Reply: Kurt Barthelmess: "Re: Active row in DBGrid?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 26 Nov 2003 19:16:23 +0200
> That code (on my system) displays the hint no matter what cell the
> mouse is over, not just the highlighted cell. However, the hint shown
> is always from the selected (highlighted) row of the grid. If you were
> hoping to get the cell and row over which the mouse is at that point,
> you will have to do some digging through the VCL code, particularly
> TCustomGrid.CalcCoordFromPoint, to see how to calculate the row and
> column numbers. The column should not be too hard because the Columns
> property will give you the width of each column, but there is no
> equivalent for the row heights.
Thank you
Source below work.
I have only one question for DBGrid.
How to change data in Grid before show it?
I have table:
C_IME CHAR(20),N_PRICE CHAR(7,2)
Grid show this data for table:
test1 1
test2 1,2
test3 1,33
test4 2,3
how to change format of N_PRICE like this:
test1 1,00
test2 1,20
test3 1,33
test4 2,30
Thank you.
-------------------------------
var
nSaveGridRow: Integer;
procedure TForm9.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
If gdSelected in State Then nSaveGridRow := Rect.Top;
end;
procedure TForm9.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
pt: TGridcoord;
begin
pt := DBGrid1.MouseCoord( x,y );
If ( ( pt.Y * 18 ) = nSaveGridRow ) And Not ( Form9.IBQuery1.IsEmpty )
Then Begin
DBGrid1.ShowHint := True;
DBGrid1.Hint := Format( 'Date created: %s' + #13 + 'Last update: %s',
[FormatDateTime( 'dddd, dd mmmm yyyy
[hh:mm:ss]',DBGrid1.DataSource.DataSet.FieldValues['D_CREATE'] ),
FormatDateTime( 'dddd, dd mmmm yyyy
[hh:mm:ss]',DBGrid1.DataSource.DataSet.FieldValues['D_UPDATE'] )] );
End Else Begin
DBGrid1.ShowHint := False;
DBGrid1.Hint := '';
End;
end;
- Next message: Jonas Wik: "Re: breakpoints not working"
- Previous message: Mike Williams (TeamB): "Re: Disappearing Components?"
- In reply to: Kurt Barthelmess: "Re: Active row in DBGrid?"
- Next in thread: Kurt Barthelmess: "Re: Active row in DBGrid?"
- Reply: Kurt Barthelmess: "Re: Active row in DBGrid?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|