trichview.com

trichview.support




Re: OnChange in Tables


Return to index


Author

Message

Sergey Tkachenko

Posted: 05/08/2005 22:22:09


No, InsertRowsAbove does not call OnChange. Moreover, it does not reformat

document. It was made by efficiency reasons, to allow multiple table

operations without delay and flickering.

I modified your code - added Begin/EndItemModify and Change.


procedure TfmDiary.TableOperation(id:Integer);

var item: TCustomRVItemInfo;

    table: TRVTableItemInfo;

    Data: Integer;

    rve1: TCustomRichViewEdit;

    ItemNo: Integer;

begin

try

  if not Rve.CanChange or

     not Rve.GetCurrentItemEx(TRVTableItemInfo, rve1, item) then

    exit;

  table := TRVTableItemInfo(item);

  ItemNo := rve1.GetItemNo(table);

  case id of

    1: {insert row above}

      begin

       if table.GetEditedCell(r,c)<>nil then nilcell:=false else

nilcell:=true;

       rve1.BeginItemModify(ItemNo, Data);

       table.InsertRowsAbove(1);

       rve1.EndItemModify(ItemNo, Data);

       rve1.Change;

       if not nilcell then table.EditCell(r,c);

      end;

  end; {case}

except

end;

end;






Powered by ABC Amber Outlook Express Converter