Removing a table from RichViewEdit

General TRichView support forum. Please post your questions here
Post Reply
Aeperd
Posts: 21
Joined: Thu Dec 26, 2024 1:30 pm

Removing a table from RichViewEdit

Post by Aeperd »

Please bear with me as im new here and new to the component, how may i remove a table inserted in the richviewedit?
Sergey Tkachenko
Site Admin
Posts: 17839
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Removing a table from RichViewEdit

Post by Sergey Tkachenko »

In TRichViewEdit, you can place the caret before and after the table.
If the caret is before the table, pressing DELETE removes the table.
If the caret is after the table, pressing BACKSPACE removes the table.
If the table is selected, deleting selection (by DELETE or BACKSPACE) removes the table.
Also, In RichViewActions, the command that deletes the table is implemented by TrvActionTableDeleteTable
Aeperd
Posts: 21
Joined: Thu Dec 26, 2024 1:30 pm

Re: Removing a table from RichViewEdit

Post by Aeperd »

TrvActionTableDeleteTable

how to use this one sir? and what needs to declare?
Sergey Tkachenko
Site Admin
Posts: 17839
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Removing a table from RichViewEdit

Post by Sergey Tkachenko »

First, please note that RichViewActions are currently implemented only for VCL and Lazarus for Windows.
Versions for FireMonkey and Lazarus for Linux will be implemented later.

This action can be used just like other actions. Place TActionList component on a form, add actions to it at design time using "New Standard Action" command in the design-time editor of TActionList. Then assign it to Action property of a button or a menu item.
As you can see, you do not need to write code to use actions.
If you never used actions before, you can find information on the web, for example: https://docwiki.embarcadero.com/RADStud ... ction_List

As for RichViewActions (including the above-mentioned action), the simplest way to use them is to start from the ActionTest demo.
For new versions of Delphi (10.3 and newer), the demo is in <TRichView Dir>\RichViewActions\Demos\DelphiUnicode\ActionTest_MultiRes\ folder.
There are also versions of this demo for older versions of Delphi, Lazarus, and C++Builder.

This demo contains TActionList with actions, and datamodules with images for them.
See "Table | Delete Table" command in the main menu.
Aeperd
Posts: 21
Joined: Thu Dec 26, 2024 1:30 pm

Re: Removing a table from RichViewEdit

Post by Aeperd »

Thank you so much sir, but sorry i forgot to say i need for fmx.
Sergey Tkachenko
Site Admin
Posts: 17839
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Removing a table from RichViewEdit

Post by Sergey Tkachenko »

You can use this code to delete the current table:

Code: Select all

var
  Table: TRVTableItemInfo;
  rve: TCustomRichViewEdit;
begin
  if RichViewEdit1.GetCurrentItemEx(TRVTableItemInfo, rve, TCustomRVItemInfo(Table)) then
  begin
    rve.SetSelectionBounds(Table.GetMyItemNo, 0, Table.GetMyItemNo, 1);
    rve.DeleteSelection;
  end;
end;
Aeperd
Posts: 21
Joined: Thu Dec 26, 2024 1:30 pm

Re: Removing a table from RichViewEdit

Post by Aeperd »

thanks so much sir, it worked like a charm...
Post Reply