Page 1 of 1

How to get default Enabled in Trv*Action.OnUpdate?

Posted: Fri May 19, 2006 12:51 pm
by aoven
I have a few special situations, where I need to disable some of the actions, even though they are enabled by default. For example, I'd like to prevent insertion of a page break in a paragraph with a certain style.

I tried simply writing the OnUpdate handler but then the default handling is completely bypassed, which is not what I want. I'd like to keep the default handling with additional check for my special cases.

Something along these lines:

Code: Select all

procedure TSourceDocDesigner.rvActionInsertPageBreakUpdate(Sender: TObject);
begin
  TAction(Sender).Enabled := GetDefaultEnabled(Sender) and MyCondition;
end;
How do I do the GetDefaultEnabled part?

Posted: Sun May 21, 2006 10:40 am
by Sergey Tkachenko
1) You can disable all RichViewActions by assigning False to RVAControlPanel.ActionsEnabled
2) You can disable the given RichView-action by assigning True action.Disabled.

Posted: Sun May 21, 2006 12:14 pm
by aoven
1) You can disable all RichViewActions by assigning False to RVAControlPanel.ActionsEnabled
That's no good for me, because I want to be able to disable a specific action only.
2) You can disable the given RichView-action by assigning True action.Disabled.
Ah, yes - I missed that one! Thanks!