Page 1 of 1
Stack overrun in field.OnChange
Posted: Tue 25 Apr 2006 16:08
by Ludek
I'm getting stack overrun, when I change a field value in an "onchange" event of another field of the same dataset, for example:
Code: Select all
procedure TTestF.QGruppePreislisteaufschlagChange(Sender: TField);
begin
inherited;
QGruppePreislisteDB.AsFloat := 1;
end;
if QGruppePreislisteaufschlag is a column in a TDBGrid, user writes some value to this column and presses ENTER or something like it to jump from the currently edited column, a stackoverrun comes. could you help me? I'm using the newest "3.70.1.26" SDAC version and delphi 2006 update pack 1. thx.
Ludek
Posted: Wed 26 Apr 2006 05:58
by Guest
Note: the same code works fine using Delphi 7 and al older SDAC version!!
Posted: Wed 26 Apr 2006 08:37
by Jackson
This is VCL problem(Unit DBGrids.pas, TGridDataLink.RecordChanged method). Please install Borland Developer Studio 2006 Update 2 to correct this problem.
Posted: Wed 26 Apr 2006 16:23
by Ludek
I'm having still the same problem, although i installed the update pack 2

I'll send you sources a small executable, as soon as I have one...
Posted: Wed 26 Apr 2006 16:49
by Ludek
That's it:
dfm file:
Code: Select all
object TestF: TTestF
Left = 245
Top = 148
Caption = 'Gruppen'
ClientHeight = 465
ClientWidth = 810
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = True
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object DBGGruppePreisliste: TDBGrid
Left = 0
Top = 0
Width = 810
Height = 465
Align = alClient
DataSource = DSGruppePreisliste
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'Tahoma'
TitleFont.Style = []
Columns =
end
object QGruppePreisliste: TMSQuery
Connection = MSConnection1
SQL.Strings = (
'select 0.0 as db, 0.0 as aufschlag'
'from sysdatabases')
CachedUpdates = True
Left = 488
Top = 96
object QGruppePreislisteaufschlag: TFloatField
FieldName = 'aufschlag'
OnChange = QGruppePreislisteaufschlagChange
DisplayFormat = '0.00 %'
end
object QGruppePreislistedb: TFloatField
FieldName = 'db'
DisplayFormat = '0.00 %'
end
end
object DSGruppePreisliste: TDataSource
DataSet = QGruppePreisliste
Left = 456
Top = 96
end
object MSConnection1: TMSConnection
Database = 'master'
Authentication = auServer
Username = 'sa'
Password = ''
Server = '.'
Connected = True
Left = 408
Top = 168
end
end
pas file
Code: Select all
unit TestU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, ImgList, Menus, DBCtrls, ComCtrls, ToolWin,
ExtCtrls, Grids, DBGrids, StdCtrls, Mask, ActnList, Buttons,
DBAccess, MSAccess, MemDS, ActnMan, ActnColorMaps, ActnCtrls,
ActnMenus;
type
TTestF = class(TForm)
QGruppePreisliste: TMSQuery;
DSGruppePreisliste: TDataSource;
QGruppePreislisteaufschlag: TFloatField;
QGruppePreislistedb: TFloatField;
DBGGruppePreisliste: TDBGrid;
MSConnection1: TMSConnection;
procedure FormCreate(Sender: TObject);
procedure QGruppePreislisteaufschlagChange(Sender: TField);
private
{ Private declarations }
public
{ Public declarations }
end;
var
TestF: TTestF;
implementation
{$R *.DFM}
procedure TTestF.FormCreate(Sender: TObject);
begin
inherited;
QGruppePreisliste.Open;
end;
procedure TTestF.QGruppePreislisteaufschlagChange(Sender: TField);
begin
inherited;
QGruppePreislisteDB.AsFloat := 1;
end;
end.
simply compile it, enter a new number in the grid and press ENTER or TAB. The executable crashes.
Posted: Thu 27 Apr 2006 08:30
by Ludek
This f***ing change in TDBGridDataLink is written in
http://qc.borland.com/wc/qcmain.aspx?d=2633
Who is Jeff Overcash and where I find him? I'm gonna kill this stupid boy!!

[/url]