Subject TIB_Grid.CellLoseFocus firing too late on row change ?
Author G. Nau
I'm working with TIB_Grid at the moment and do convert user data
entry in the grid on cell changes with event CellLoseFocus.
It's working on column changes (left/right) but not correctly on row
changes.
The CellLoseFocus event is firing, but the grid is already positioned
on the NEW row. Is that intentional?
On row changes the CellLoseFocus should fire on the old row first,
then the rowchange (including query update if necessary) should
happen, then the CellGainfocus should fire on the new row.
But the celllosefocus is firing with the data of the NEW row.
Do I miss anything here?
----------------
To reproduce, simply place a ib_grid to the sample project and use
these two events:
procedure TForm1.dbgrid_BestellnrCellLoseFocus(Sender: TObject;
ACol,
ARow: Integer);
begin
allocconsole;
Write ('LoseFocus, Col:',Acol,' Row:',ARow,'
Data:',DBGrid_BestellNr.GridFields[ACol-1].AsString);
If IB_Query1.Modified then write (' modified');
Writeln;
Writeln ('---');
end;

procedure TForm1.dbgrid_BestellnrCellGainFocus(Sender: TObject;
ACol,
ARow: Integer);
begin
allocconsole;
Write ('GainFocus, Col:',Acol,' Row:',ARow,'
Data:',DBGrid_BestellNr.GridFields[ACol-1].AsString);
If IB_Query1.Modified then write (' modified');
Writeln;
end;
-----------------------
And here is a sample output:

GainFocus, Col:1 Row:3 Data:34234
LoseFocus, Col:1 Row:3 Data:34234
--- --> move right
GainFocus, Col:2 Row:3 Data:86-120-55
LoseFocus, Col:2 Row:3 Data:86-120-56 <- wrong! Value of the
new row! I miss old row values and "modified"
---> move down
GainFocus, Col:2 Row:4 Data:86-120-56 <- see, it's in Row 4
LoseFocus, Col:2 Row:4 Data:newvalue modified <- okay!
--- move one left
GainFocus, Col:1 Row:4 Data:1-148 modified <- okay! row is
modified!
LoseFocus, Col:1 Row:4 Data:34234 <- wrong! that's again the new
row (see below)
--- move up
GainFocus, Col:1 Row:3 Data:34234
LoseFocus, Col:1 Row:3 Data:newvalue2 <- that's again wrong,
value of Col.1/Row.4 (the mod I did above)
--- move down
GainFocus, Col:1 Row:4 Data:newvalue2


A bug in IB_Grid or something wrong in my example?

Regards
Gunther
__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Mit Yahoo! Suche finden Sie alles: http://suche.yahoo.de