How to extend the standard updation of TrvAction
Posted: Sat Dec 15, 2012 7:28 am
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:
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.
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;