[Cocoa] WMTigq[_|^ Being Written In Other TDBGrid Fields When Field Size Is Large
Original Reporter info from Mantis: emhartner
-
Reporter name: Eric Hartner
Original Reporter info from Mantis: emhartner
- Reporter name: Eric Hartner
Description:
I'm experiencing strange behavior when putting data in my TDBGrid in my Cocoa application that uses a SQLite database. When I put data into the first field, it puts text "WMTigq[_|^" into the other fields when I tab out of the first field. I find this "WMTigq[_|^" text in lazarus/lcl/interfaces/cocoa/cocoagdiobjects.pas. Note that this happens with both the latest trunk version and the current stable release.
A few things to note:
- As stated above, this happens with the most recent trunk version of Lazarus as well as the current stable version.
- I have no issues at all when the same code is compiled for Windows under the current stable version.
Steps to reproduce:
Strange things start to happen when the TStringField.Size exceeds 255, but you don't see the "WMTigq[_|^" text from TCocoaContext.GetTextMetrics showing up until the Size is much higher. And just to re-iterate, I do NOT see this problem when compiled and linked for Windows.
(1) Create the SQLite table:
SQLQuery1.SQL.Text := 'create table test1 (field1 WideChar, field2 WideChar, field3 WideChar)';
SQLQuery1.ExecSQL;
(2) Populate the table with some existing data:
for i := 1 to 10 do
begin
SQLQuery1.SQL.Text := 'insert into test1 (field1,field2,field3) values ('+IntToStr(i)+','+IntToStr(i)+','+IntToStr(i+10)+')';
SQLQuery1.ExecSQL;
end;
(3) Create the string fields, set the size to 2000 and issue the select:
SQLQuery2.SQL.Text := 'select field1, field2, field3 from test1';
SQLQuery2.Fields.Clear;
// create each of the three fields
for i := 1 to 3 do
with TStringField.Create(SQLQuery2) do
begin
FieldName := 'field'+IntToStr(i);
DisplayLabel := 'Field '+IntToStr(i);
DataSet := SQLQuery2;
Visible := True;
DisplayWidth := 20;
Size := 2000;
end;
SQLQuery2.Open;
// make sure SQLQuery2 is displying it's data into a TDBGrid
(4) Edit the first column in a row in the DB Grid and then tab to the next field. Upon doing this, the other columns in that row will either be blanked out or overwritten with "WMTigq[_|^".
Mantis conversion info:
- Mantis ID: 38714
- Version: 2.0.12