TableSort.Pas Problems

General TRichView support forum. Please post your questions here
Post Reply
DickBryant
Posts: 148
Joined: Wed Dec 07, 2005 2:02 pm
Contact:

TableSort.Pas Problems

Post 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
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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?
Post Reply