I encounter an issue with the display of string value in DB grid.
Here is a screenshot of the pb:

You can reproduce it following this way:
- Feed the grid with data, having Field.DataType like dtExtString, dtExtWideString
- Modify the value of a field (here LIBQTER).
- Stay on the line, quit the field, and come back in it
- Press escape key
- The display of string field suech as ENS1E is corrupted
Here is a video of the issue:
http://v8.tinypic.com/player.swf?file=14ne1hg&s=8
http://fr.tinypic.com/player.php?v=14ne1hg&s=8
The app is connected to an oracle database.
Here is the source code of the application:
Code: Select all
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, OraCall, Data.DB,
DBAccess, Ora, Vcl.ExtCtrls, Vcl.Grids, Vcl.DBGrids, Bde.DBTables, MemDS;
type
TForm2 = class(TForm)
OraSession1: TOraSession;
Panel1: TPanel;
Label1: TLabel;
Button1: TButton;
EdtServer: TEdit;
Label3: TLabel;
EdtLogin: TEdit;
Label4: TLabel;
EdtPwd: TEdit;
Panel2: TPanel;
DBGrid1: TDBGrid;
OraQuery1: TOraQuery;
OraDataSource1: TOraDataSource;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure OraDataSource1StateChange(Sender: TObject);
procedure OraDataSource1DataChange(Sender: TObject; Field: TField);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form2 : TForm2;
FPost : boolean;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
FPost := false;
if not OraSession1.Connected then
begin
OraSession1.Server := EdtServer.Text ;
OraSession1.UserName := EdtLogin.Text;
OraSession1.PassWord := EdtPwd.Text;
OraSession1.Open ;
end;
if OraSession1.Connected then
showmessage('Connection is Ok.')
else
showmessage('Connection KO !!!');
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
OraQuery1.Open;
end;
procedure TForm2.OraDataSource1DataChange(Sender: TObject; Field: TField);
begin
if field <> nil then
Fpost := true;
end;
procedure TForm2.OraDataSource1StateChange(Sender: TObject);
begin
if (OraDataSource1.DataSet.State = dsBrowse) and (Fpost) then
begin
Fpost := false;
OraDataSource1.DataSet.Edit;
OraDataSource1.DataSet.Post;
end;
end;
end.
Code: Select all
object Form2: TForm2
Left = 0
Top = 0
Caption = 'Dispose buffer issue'
ClientHeight = 390
ClientWidth = 1064
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Panel1: TPanel
Left = 0
Top = 0
Width = 1064
Height = 105
Align = alTop
TabOrder = 0
ExplicitWidth = 517
object Label1: TLabel
Left = 25
Top = 11
Width = 32
Height = 13
Caption = 'Server'
end
object Label3: TLabel
Left = 25
Top = 38
Width = 25
Height = 13
Caption = 'Login'
end
object Label4: TLabel
Left = 25
Top = 65
Width = 20
Height = 13
Caption = 'Pwd'
end
object Button1: TButton
Left = 217
Top = 8
Width = 104
Height = 33
Caption = 'Connect DB'
TabOrder = 0
OnClick = Button1Click
end
object EdtServer: TEdit
Left = 73
Top = 8
Width = 125
Height = 21
TabOrder = 1
Text = ''
end
object EdtLogin: TEdit
Left = 73
Top = 35
Width = 125
Height = 21
TabOrder = 2
Text = ''
end
object EdtPwd: TEdit
Left = 73
Top = 62
Width = 125
Height = 21
PasswordChar = '*'
TabOrder = 3
Text = ''
end
object Button2: TButton
Left = 217
Top = 47
Width = 104
Height = 33
Caption = 'Feed grid'
TabOrder = 4
OnClick = Button2Click
end
end
object Panel2: TPanel
Left = 0
Top = 105
Width = 1064
Height = 285
Align = alClient
TabOrder = 1
ExplicitLeft = 392
ExplicitTop = 176
ExplicitWidth = 185
ExplicitHeight = 41
object DBGrid1: TDBGrid
Left = 1
Top = 1
Width = 1062
Height = 283
Align = alClient
DataSource = OraDataSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'Tahoma'
TitleFont.Style = []
end
end
object OraSession1: TOraSession
Left = 584
Top = 16
end
object OraQuery1: TOraQuery
Session = OraSession1
SQL.Strings = (
'select ... from ... where ...' +
)
Left = 480
Top = 16
end
object OraDataSource1: TOraDataSource
DataSet = OraQuery1
OnStateChange = OraDataSource1StateChange
OnDataChange = OraDataSource1DataChange
Left = 392
Top = 16
end
end
It is not easy to modify the source code of this method.
Please help !