You are not logged in.
Pages: 1
Hello,
Very nice framework.
I am trying the sample programs.
When added a grid I ran into a problem.
The text or integer values in a grid are displayed one char shorter than the original value.
So, an integer value 0 to 9 is not shown in the grid. Also not in the ID column.
I changed in SQLite3Commons
function TSQLTable.GetWP(Row, Field: integer; Dest: PWideChar; MaxDestChars: cardinal): integer;
var P: PUTF8Char;
begin
P := Get(Row,Field);
result := Utf8ToUnicode(Dest,MaxDestChars,PAnsiChar(P),StrLen(P))-1;
end;
to
result := Utf8ToUnicode(Dest,MaxDestChars,PAnsiChar(P),StrLen(P));
with presents the correct data in the grid.
I only don't know if this will give other problems.
Offline
I think it comes from a change in Delphi RTL.
In Delphi 6/7, here is how it's coded:
function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; Source: PChar; SourceBytes: Cardinal): Cardinal;
(...)
Result := count+1;
end;
It seems it has changed in later Delphi versions...
Which version do you use?
So I've added a new overloaded function named UTF8ToWideChar(), and changed the Utf8ToUnicode() RTL call to this new function.
Our UTF8ToWideChar function is even faster than RTL Utf8ToUnicode function.
Thanks for your feedback.
Offline
Yes, it is different in XE.
OK, that's nice, thank you for the new function.
Offline
Is it possible to Get Record from CurrentFocusedRow from TDrawGrid (TSQLTableToGrid)?
so i can write code like bellow (maybe)
procedure TForm1.DrawGrid1FocusedRow(Sender: TObject; aFocusedRow:TSQLRecord);
var
aPeople:TSQLPeople;
begin
aPeople:=aFocusedRow.
end;
and, if possible to Select multiple row.
var
i:integer;
aPeople:TSQLPeople;
begin
for i:=0 to Drawgrid1.selectedrows.count-1 do
begin
Drawgrid1.selectedrows[i].focused;
aPeople:=Drawgrid1.FocusedRow;
end;
end;
thanks.
Last edited by coblongpamor (2011-03-22 00:37:27)
Offline
Use SelectedID function to retrieve the focused row ID.
Then you can retrieve it in a TSQLRecord.
I've added a SelectedRecord function for rev. 1.13 to directly retrieve a TSQLRecord instance.
For multi-selection:
1. Call SetFieldLengthMean() with aMarkAllowed parameter = true to enable row selection (a checkbox is added left side of the grid)
2. Use MarkedTotalCount, MarkAvailable and Marked[] properties to retrieve (or set) the marked rows
3. You have SetMark() method to perform some standard actions on marking
Offline
Tanks AB for the response, i'll try the functions that you suggest.
Offline
Pages: 1