How to extend the standard updation of TrvAction

General TRichView support forum. Please post your questions here
Post Reply
vit
Posts: 115
Joined: Tue Feb 03, 2009 3:11 pm

How to extend the standard updation of TrvAction

Post by vit »

I’ve already wrote the similar question but I haven’t got the answer :( So now I repeat it in other words I hope you’ll help me.

I want to extend the updation of TrvAction. For example there is TrvActionTableInsertRowsBelow. It’s enabled when the cursor is at the table and document is not read-only and so on. I need to save this behavior and add some extra conditions. For example I want to action is only enabled if the table has 3 columns and 2 rows.
In order to achieve this I add TrvActionTableInsertRowsBelow to the action list and implement OnUpdate event:

Code: Select all

procedure TForm1.aInsertRowsBellowUpdate(Sender: TObject);
begin
  (Sender as TAction).Enabled := AreMyConditionsSatisfied;
end;
But this approach is not correct because it doesn’t use the standard conditions checking of TrvActionTableInsertRowsBelow. If I understood right, at this point (Sender as TAction).Enabled doesn't contain the value which is calculated by TrvActionTableInsertRowsBelow, this is just value remained from previous checking.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Probably, the best solution is creating an action inherited from TrvActionInsertRowsBelow.

Also, you can process focus change and OnCaretMove event, and set Disabled=True property for the action if your condition is not satisfied.
Post Reply