Page 1 of 1
Custom Actions
Posted: Thu Sep 15, 2005 1:45 pm
by wvd_vegt
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.
Posted: Sat Sep 17, 2005 9:06 am
by Sergey Tkachenko
Any action can do that.
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;
For examples, see RichViewActions, RichViewActions.pas.
Requirments
Posted: Fri Sep 23, 2005 1:31 pm
by Guest
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?
What do i need to get this to work?
Posted: Fri Sep 23, 2005 2:46 pm
by wvd_vegt
Hi,
I PM'ed a simple version to Sergey Tkachenko to see wether he likes it and want to add it to the RichView Actions.