Page 1 of 1

TableSort.Pas Problems

Posted: Mon Jan 28, 2008 3:52 pm
by DickBryant
Hi Sergey,

I'm still not quite able to get this to work. In order to get TableSort.Pas to compile I needed to make the following substitutions (you may want to correct the unit for these):

table.RowCount -> table.Rows.Count
table.ColCount -> table.Rows[0].Count

rve.RefreshAll -> rve.Refresh (not sure if this is, perhaps, the problem)

After making these changes in TableSort.Pas and putting the following code on a button:

procedure TFStatsAdv.BBSortClick(Sender: TObject);
var
rvet: TCustomRichViewEdit;
table: TRVTableItemInfo;
Column: integer;
Ascending, IgnoreCase : Boolean;
begin
Column := 4;
IgnoreCase := True;
Ascending := True;
if not RichViewEdit1.GetCurrentItemEx(TRVTableItemInfo, rvet, TCustomRVItemInfo(table)) then
exit;
// display your modal form allowing choosing sort options
// and column (in range 0..table.ColCount-1)
SortCurrentTable(RichViewEdit1, Column, Ascending, IgnoreCase);
end;

The SortCurrentTable appears to execute properly, calling CreateSortedTable, etc. However, the operation completes with the original table totally selected but not sorted in any way. I think that what is not occurring is that the sorted copy of the table is not replacing the original copy of the table but I don't know why.

Any suggestions?

Dick

Posted: Mon Jan 28, 2008 6:18 pm
by Sergey Tkachenko
You use quite old version of TRichView, if these properties and methods are not defined. Please consider to update it.

As for the problem - may be RichViewEdit1.ReadOnly = True, or you use other kind of protection?