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

General TRichView support forum. Please post your questions here
Post Reply
aoven
Posts: 45
Joined: Wed Nov 09, 2005 7:28 pm

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

Post 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?
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
aoven
Posts: 45
Joined: Wed Nov 09, 2005 7:28 pm

Post 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!
Post Reply