Is there an action available that allows you to assign an event handler that gets the TRichViewEdit instance passed? If not, what should i subclass to create such action?
I'm looking for buttons that will nicely enable and disable when a TRichViewEdit is active and peform some custom operations like updating the preview inside the webbrowser.
Custom Actions
-
- Site Admin
- Posts: 17520
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Any action can do that.
You need to override methods:
For examples, see RichViewActions, RichViewActions.pas.
You need to override methods:
Code: Select all
function TrvAction.HandlesTarget(Target: TObject): Boolean;
begin
Result := Target is TCustomRichViewEdit;
end;
// updating actions properties
procedure TrvAction.UpdateTarget(Target: TObject);
begin
// Target is a TCustomRichViewEdit
// but it may be cell inplace editor
// To get the real editor, use
// TCustomRichViewEdit(Target).RootEditor;
// Here you can update the action's properties
// such as Enabled or Checked, depending
// on the RichViewEdit state and other
// circumstances
end;
// executing
procedure TrvAction.ExecuteTarget(Target: TObject);
begin
// Target is a TCustomRichViewEdit
// but it may be cell inplace editor
// To get the real editor, use
// TCustomRichViewEdit(Target).RootEditor;
// Execute the operation
end;
Requirments
What do i need to get this to work?Is there an action available that allows you to assign an event handler that gets the TRichViewEdit instance passed? If not, what should i subclass to create such action?