Thanks
Ed Wilson
Training Technologies, Inc.
EM_UNDO
> I just want an example of how one would go about implmenting
> an undo/redo
Delphi encapsulates this for you:
if Screen.ActiveControl is TCustomEdit then
TCustomEdit(Screen.ActiveControl).Undo;
If you want undo/redo to work with more than just edit controls, you'll need
to implement appropriate logic in your application, such as a command stack.
- Rick
Insert char into text : push position+char
..
Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
Ed Wilson wrote:
>
> Anyone out there know where I can find an example of how to implement an
> undo/redo system for an application? I know that undo for an edit is a
> Windows message and the actual code is kept within Microspot's secret
Ed Wilson
Training Technologies, Inc.
Rick Rogers (TeamB) wrote:
> > I know that undo for an edit is a Windows message and the actual
> > code is kept within Microspot's secret archives...
>
> EM_UNDO
>
> > I just want an example of how one would go about implmenting
> > an undo/redo
>
Yes, this is manifestly obvious.
> what I'm LOOKING for is an example of how to do multiple
> undo/redo commands
I gave you the general approach in the last paragraph of my previous message
(please re-read). You could also see the book _Design Patterns_ by Gamma et
al. which documents a design for a command stack.
- Rick
replace all 'A' by 'B' ..
The less actions you allow, the less you have to reverse.
You may understand why there is no such component.
Good luck.
Rene
--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
Ed Wilson wrote:
>
> Ok... guess I'll have to actually use my braincells... was looking for an
> example of the "wheel" rather than to have to re-invent it again... :)
>
> Rene Tschaggelar wrote:
>
> > You make a stack of commands, where each push has sufficinent
> > information to undo the operation. A pop retrieves this command
> > and reverses the action.
> >
> > Insert char into text : push position+char
> > ..
> >
> > Rene
> > --
> > Ing.Buero R.Tschaggelar - http://www.ibrtses.com
> >
> > Ed Wilson wrote:
> > >
> > > Anyone out there know where I can find an example of how to implement an
> > > undo/redo system for an application? I know that undo for an edit is a
> > > Windows message and the actual code is kept within Microspot's secret
> > > archives... I just want an example of how one would go about implmenting
> > > an undo/redo setup in a program.
> > >
> > > Thanks
> > >
>It is not that difficult. You can use a stack as listed on
>one of my delphi pages. The point is that you have to be able
>to reverse some actions. Therefore you have to think before
>you implement the actions itself. How do you reverse :
>replace all 'A' by 'B' ..
<snip>
Rene...
is what you are trying to illustrate by your example above that
the equivalent "undo" operation is -not- a simple
Replace All 'B' by 'A'
because that will change pre-existing B's to A's that were not
A's in the first place?
Just askin'
Oz
The Design Patterns book discusses an Undo/Redo list under the Command
Pattern (sec 2.7).
Barry Brown
ba...@vnahelp.com
Ed Wilson wrote in message <37F0CFCF...@traintech.com>...