HtmlEditor :  Phorum 5 The fastest message board... ever.

This is the discussion forum for the HtmlEditor. See also the HtmlEditor home page, where you can download the control, and the Documentation Wiki, a collaborative project for documenting the control.

Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
Disable undo and redo
Posted by: aTx (---.121.165.248.dyn.user.ono.com)
Date: Sunday, 10-May-2009, 11:20:45

Hello everyone. Is there any way to disable Undo and Redo, or clear the undo queue (like RichTextBox's ClearUndo function) into the HTMLEditor?

Re: Disable undo and redo
Posted by: Vincent Degrave (---.79-241-81.adsl-dyn.isp.belgacom.be)
Date: Saturday, 28-May-2011, 01:45:16

Hi!

To reset the undo buffer i used the following code (in delphi)
(The interface declarations have been added after the code sample)
hope this helps

procedure TIEEditor.ResetUndoBuffer;
var
sp : IServiceProvider;
undoMgr : IOleUndoManager;
hr : HRESULT;
const
IID_IOleUndoManager : TGUID = '{d001f200-ef97-11ce-9bc9-00aa00608e01}';
begin
sp := fieController.HTmlDocument as IServiceProvider;
if not assigned(sp) then exit; //raise? or find other sollution

hr := sp.QueryService(IID_IOleUndoManager, IID_IOleUndoManager, undoMgr);
if hr <> s_ok then exit;
if undoMgr = nil then exit;

undoMgr.DiscardFrom(nil);
end;



// Undo buffer related stuff
// Interface definitions created to have access to the subsystem
type
IOleParentUndoUnit = interface(IUnknown)
end;
IOleUndoUnit =interface(IUnknown)
['{894AD3B0-EF97-11CE-9BC9-00AA00608E01}']
end;

IOleUndoManager = interface(IUnknown)
['{d001f200-ef97-11ce-9bc9-00aa00608e01}']
function Open(parentUndo: IOleParentUndoUnit): integer; stdcall;
function Close(parentUndo: IOleParentUndoUnit ; fCommit: boolean): integer;stdcall;
function Add(undoUnit :IOleUndoUnit ): integer;stdcall;
function GetOpenParentState(): integer;stdcall;
function DiscardFrom(undoUnit :IOleUndoUnit ): integer;stdcall;
procedure UndoTo(undoUnit: IOleUndoUnit );stdcall;
procedure RedoTo(undoUnit: IOleUndoUnit );stdcall;
function EnumUndoable: IUnknown; //:IEnumOleUndoUnits;//stdcall;
function EnumRedoable: IUnknown;stdcall;
function GetLastUndoDescription(): string;stdcall;
function GetLastRedoDescription(): string;stdcall;
procedure Enable(fEnable: boolean);stdcall;
end;



Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
NTdbY
This is a moderated forum. Your message will remain hidden until it has been approved by a moderator or administrator
This forum powered by Phorum.