If I sort a table I noticed that only all rows>0 are correct sorted.
In your UNIT tablesort.pas I stop running program in line
table := CreateSortedTable(rve, table, Column, ..., FirstRow, LastRow); (proc function DoSortCurrentTable(rve: ...))
FirstRow is always 1.
If I set FirstRow to 0 ALL rows are correct sorted.
FirstRow:= 0; //jb
table := CreateSortedTable(rve, table, Column, ..., FirstRow, LastRow);
Is there a reason why FirstRow is always 1 or is that an error ?
tableSort sorts all rows except row 0
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: tableSort sorts all rows except row 0
I tried to sort only some rows of a table and my solution runs fine.
Can occur problems ?
1.
unit TableSort;
{$I RV_Defs.inc}
interface
uses
SysUtils, ...,
{$ENDIF}
RVStyle, RichView, RVEdit,
TableSort_Var_jb; //new created and saved in RichViewActions-folder
2.
unit TableSort_Var_jb; //new created
interface
var row1,row2: integer;
implementation
begin
row1:= -1; row2:= -1;
end.
3.
function DoSortCurrentTable(rve: TCustomRichViewEdit; ...
...
begin
Result := False;
GetRangeOfRowsForSorting(table, HasHeadingRow, False, FirstRow, LastRow);
//added
if (row1>-1) and (row2>-1) then begin
FirstRow:= row1; LastRow:= row2; //jb
end;
//end of added
table := CreateSortedTable(rve, table, Column, Ascending, IgnoreCase, DataType,
FirstRow, LastRow);
...
4.
... uses TableSort_Var_jb //added in my program
row1:= 3; row2:= 5; DataType:= (rvsdtString); //(rvsdtNumber);
if CanSortTable(rveTable) then sortCurrentTable(rve, rveTspalte1, richtung, grossKlein,false,DataType);
...
Can occur problems ?
1.
unit TableSort;
{$I RV_Defs.inc}
interface
uses
SysUtils, ...,
{$ENDIF}
RVStyle, RichView, RVEdit,
TableSort_Var_jb; //new created and saved in RichViewActions-folder
2.
unit TableSort_Var_jb; //new created
interface
var row1,row2: integer;
implementation
begin
row1:= -1; row2:= -1;
end.
3.
function DoSortCurrentTable(rve: TCustomRichViewEdit; ...
...
begin
Result := False;
GetRangeOfRowsForSorting(table, HasHeadingRow, False, FirstRow, LastRow);
//added
if (row1>-1) and (row2>-1) then begin
FirstRow:= row1; LastRow:= row2; //jb
end;
//end of added
table := CreateSortedTable(rve, table, Column, Ascending, IgnoreCase, DataType,
FirstRow, LastRow);
...
4.
... uses TableSort_Var_jb //added in my program
row1:= 3; row2:= 5; DataType:= (rvsdtString); //(rvsdtNumber);
if CanSortTable(rveTable) then sortCurrentTable(rve, rveTspalte1, richtung, grossKlein,false,DataType);
...
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: