RichTextBox Multi-Undo -ReDo 
Author Message
 RichTextBox Multi-Undo -ReDo

VB6
I have tried several multi-level UnDo ReDo schemes on the web but all to fail.
One uses a collection class.  Another not sure what it is.
I cannot find any working examples.

Are there any working examples?
Where are they hidden?

If I code my own, what is the easiest or best scheme to use?



Thu, 16 Feb 2012 05:11:01 GMT  
 RichTextBox Multi-Undo -ReDo
  Use the RichEdit20 library to get RE v. 2/3.
The RTB control, in addition to being a bit slower
and requiring that you ship the OCX, also uses
only RichEdit v. 1. Each version added new, useful
functionality. I think it was v. 2 that added unlimited
undo/redo support:

http://msdn.microsoft.com/en-us/library/bb787873(VS.85).aspx

  I've got my own version of an RTB control here:
www.jsware.net/jsware/vbcode.php5#rtbuc

  You just add the userControl to the project and it's
as easy to use as the RTB OCX. You can then pretty
much assume RichEdit v. 3 as long as you're writing
to Win98SE or later.

VBAccelerator also has an RTB here:
http://www.vbaccelerator.com/codelib/richedit/richedit.htm

And I think there are other versions around. The bulk of
the work is setting up API versions of common RTB
functions. All of these RTB controls have sample code
for that. The other big thing is arranging to have the control
be self-subclassing and linking the owner-drawn window
to the userControl. That's the "trick" to making your own
owner-drawn, userControl-based version as simple and
hassle-free as an OCX.
   My own version is using Paul Caton's (DEP-safe) assembly
code for self-subclassing. There's also the "new" subclassing
approach that Karl Peterson wrote about recently:

http://vb.mvps.org/samples/HookXP/

Very simple subclassing functions that have been available
for many years, but that were not documented by Microsoft
until recently.
http://www.geoffchappell.com/studies/windows/shell/comctl32/api/index...
http://msdn.microsoft.com/en-us/library/bb762102(VS.85).aspx

  That's a lot of details....maybe more than you want to know. :)
But to paraphrase: Once you get off of the RTB OCX you'll
never go back.

Quote:
> VB6
> I have tried several multi-level UnDo ReDo schemes on the web but all to
fail.
> One uses a collection class.  Another not sure what it is.
> I cannot find any working examples.

> Are there any working examples?
> Where are they hidden?

> If I code my own, what is the easiest or best scheme to use?



Thu, 16 Feb 2012 05:56:18 GMT  
 RichTextBox Multi-Undo -ReDo

I tried seven sample programs I found out there and none of them worked.  
not sure if it is due to different versions of RTB.
Many were similar and one based on VBAccelerator code.
These were full examples with a GUI.  No Go.
Seems strange all that claims a working example, did not actually work.
.ocx version?

I will look at yours.

As always, thanks!

Quote:

>   Use the RichEdit20 library to get RE v. 2/3.
> The RTB control, in addition to being a bit slower
> and requiring that you ship the OCX, also uses
> only RichEdit v. 1. Each version added new, useful
> functionality. I think it was v. 2 that added unlimited
> undo/redo support:

> http://msdn.microsoft.com/en-us/library/bb787873(VS.85).aspx

>   I've got my own version of an RTB control here:
> www.jsware.net/jsware/vbcode.php5#rtbuc

>   You just add the userControl to the project and it's
> as easy to use as the RTB OCX. You can then pretty
> much assume RichEdit v. 3 as long as you're writing
> to Win98SE or later.

> VBAccelerator also has an RTB here:
> http://www.vbaccelerator.com/codelib/richedit/richedit.htm

> And I think there are other versions around. The bulk of
> the work is setting up API versions of common RTB
> functions. All of these RTB controls have sample code
> for that. The other big thing is arranging to have the control
> be self-subclassing and linking the owner-drawn window
> to the userControl. That's the "trick" to making your own
> owner-drawn, userControl-based version as simple and
> hassle-free as an OCX.
>    My own version is using Paul Caton's (DEP-safe) assembly
> code for self-subclassing. There's also the "new" subclassing
> approach that Karl Peterson wrote about recently:

> http://vb.mvps.org/samples/HookXP/

> Very simple subclassing functions that have been available
> for many years, but that were not documented by Microsoft
> until recently.
> http://www.geoffchappell.com/studies/windows/shell/comctl32/api/index...
> http://msdn.microsoft.com/en-us/library/bb762102(VS.85).aspx

>   That's a lot of details....maybe more than you want to know. :)
> But to paraphrase: Once you get off of the RTB OCX you'll
> never go back.

> > VB6
> > I have tried several multi-level UnDo ReDo schemes on the web but all to
> fail.
> > One uses a collection class.  Another not sure what it is.
> > I cannot find any working examples.

> > Are there any working examples?
> > Where are they hidden?

> > If I code my own, what is the easiest or best scheme to use?



Thu, 16 Feb 2012 06:08:01 GMT  
 RichTextBox Multi-Undo -ReDo

posting problems again.

I can only find Riched32 on my XP SP2 laptop.

where are others?

The referenced web page says
"Windows XP SP1 Includes Rich Edit 4.1, Rich Edit 3.0, and a Rich Edit 1.0
emulator. "

Quote:

> I tried seven sample programs I found out there and none of them worked.  
> not sure if it is due to different versions of RTB.
> Many were similar and one based on VBAccelerator code.
> These were full examples with a GUI.  No Go.
> Seems strange all that claims a working example, did not actually work.
> .ocx version?

> I will look at yours.

> As always, thanks!


> >   Use the RichEdit20 library to get RE v. 2/3.
> > The RTB control, in addition to being a bit slower
> > and requiring that you ship the OCX, also uses
> > only RichEdit v. 1. Each version added new, useful
> > functionality. I think it was v. 2 that added unlimited
> > undo/redo support:

> > http://msdn.microsoft.com/en-us/library/bb787873(VS.85).aspx

> >   I've got my own version of an RTB control here:
> > www.jsware.net/jsware/vbcode.php5#rtbuc

> >   You just add the userControl to the project and it's
> > as easy to use as the RTB OCX. You can then pretty
> > much assume RichEdit v. 3 as long as you're writing
> > to Win98SE or later.

> > VBAccelerator also has an RTB here:
> > http://www.vbaccelerator.com/codelib/richedit/richedit.htm

> > And I think there are other versions around. The bulk of
> > the work is setting up API versions of common RTB
> > functions. All of these RTB controls have sample code
> > for that. The other big thing is arranging to have the control
> > be self-subclassing and linking the owner-drawn window
> > to the userControl. That's the "trick" to making your own
> > owner-drawn, userControl-based version as simple and
> > hassle-free as an OCX.
> >    My own version is using Paul Caton's (DEP-safe) assembly
> > code for self-subclassing. There's also the "new" subclassing
> > approach that Karl Peterson wrote about recently:

> > http://vb.mvps.org/samples/HookXP/

> > Very simple subclassing functions that have been available
> > for many years, but that were not documented by Microsoft
> > until recently.
> > http://www.geoffchappell.com/studies/windows/shell/comctl32/api/index...
> > http://msdn.microsoft.com/en-us/library/bb762102(VS.85).aspx

> >   That's a lot of details....maybe more than you want to know. :)
> > But to paraphrase: Once you get off of the RTB OCX you'll
> > never go back.

> > > VB6
> > > I have tried several multi-level UnDo ReDo schemes on the web but all to
> > fail.
> > > One uses a collection class.  Another not sure what it is.
> > > I cannot find any working examples.

> > > Are there any working examples?
> > > Where are they hidden?

> > > If I code my own, what is the easiest or best scheme to use?



Thu, 16 Feb 2012 06:23:01 GMT  
 RichTextBox Multi-Undo -ReDo

--
--

Quote:

> I tried seven sample programs I found out there and none of them worked.
> not sure if it is due to different versions of RTB.
> Many were similar and one based on VBAccelerator code.
> These were full examples with a GUI.  No Go.
> Seems strange all that claims a working example, did not actually work.
> .ocx version?

   I'd be curious to see those if you still have any links
to userControl versions (as opposed to compiled
OCX). I think the only one's I've seen are the VBAccelerator
version and, I think, a version made by Eduardo Morcillo.
Eduardo morcillo does interesting stuff, but with *no*
documentation and he has a very quirky style of coding.
The VBAccelerator stuff seems to generally be good,
but it can be a pain to use. They've got their own subclassing
library, for instance, that's needed for a lot of their stuff.
Personally I tend to look at their stuff for API reference,
mostly. Setting up their samples to run is often just too much
trouble.

  My own version uses ideas from Matthew Curland to
"attach" the RTB window to the UC. (There are some
little tricky things, like making sure the RichEdit window
stays with the UC window dimensions, dealing with
accelerator keys so that a Tab press won't jump out of
your RTB, etc.) But Matthew Curland's self-subclass code,
as nice as it was, conflicts with the extreme DEP settings
on newer systems.

   The Paul Caton
subclass code is fairly complex, but not very involved
once you know how it works. I've thought of switching
to the SetWindowSubclass approach, but my current
Caton subclass version is stable and tested, so I've
been loathe to start fiddling with it unnecessarily.



Thu, 16 Feb 2012 06:33:06 GMT  
 RichTextBox Multi-Undo -ReDo

JSWare does not have ReDo and the UnDo ends strangely and fails.

Quote:

>   Use the RichEdit20 library to get RE v. 2/3.
> The RTB control, in addition to being a bit slower
> and requiring that you ship the OCX, also uses
> only RichEdit v. 1. Each version added new, useful
> functionality. I think it was v. 2 that added unlimited
> undo/redo support:

> http://msdn.microsoft.com/en-us/library/bb787873(VS.85).aspx

>   I've got my own version of an RTB control here:
> www.jsware.net/jsware/vbcode.php5#rtbuc

>   You just add the userControl to the project and it's
> as easy to use as the RTB OCX. You can then pretty
> much assume RichEdit v. 3 as long as you're writing
> to Win98SE or later.

> VBAccelerator also has an RTB here:
> http://www.vbaccelerator.com/codelib/richedit/richedit.htm

> And I think there are other versions around. The bulk of
> the work is setting up API versions of common RTB
> functions. All of these RTB controls have sample code
> for that. The other big thing is arranging to have the control
> be self-subclassing and linking the owner-drawn window
> to the userControl. That's the "trick" to making your own
> owner-drawn, userControl-based version as simple and
> hassle-free as an OCX.
>    My own version is using Paul Caton's (DEP-safe) assembly
> code for self-subclassing. There's also the "new" subclassing
> approach that Karl Peterson wrote about recently:

> http://vb.mvps.org/samples/HookXP/

> Very simple subclassing functions that have been available
> for many years, but that were not documented by Microsoft
> until recently.
> http://www.geoffchappell.com/studies/windows/shell/comctl32/api/index...
> http://msdn.microsoft.com/en-us/library/bb762102(VS.85).aspx

>   That's a lot of details....maybe more than you want to know. :)
> But to paraphrase: Once you get off of the RTB OCX you'll
> never go back.

> > VB6
> > I have tried several multi-level UnDo ReDo schemes on the web but all to
> fail.
> > One uses a collection class.  Another not sure what it is.
> > I cannot find any working examples.

> > Are there any working examples?
> > Where are they hidden?

> > If I code my own, what is the easiest or best scheme to use?



Thu, 16 Feb 2012 06:39:01 GMT  
 RichTextBox Multi-Undo -ReDo

Quote:

> posting problems again.

> I can only find Riched32 on my XP SP2 laptop.

> where are others?

  There should be a riched20.dll, which is the file name
for both v. 2 and v. 3. It's installed on XP and I'm pretty
certain it's on Vista. I just did a search for: riched20.dll vista
and came across this:

http://support.microsoft.com/kb/938194

  One of the files in the update is a newer version of riched20.dll,
so it must be a Vista-native file. I've never had anyone write to
me to say that my software using an RTB wouldn't run. And I've
tested it on Win7 as well as Vista.

   I can't imagine why you don't have riched20.dll

Quote:
> The referenced web page says
> "Windows XP SP1 Includes Rich Edit 4.1, Rich Edit 3.0, and a Rich Edit 1.0
> emulator. "



Thu, 16 Feb 2012 06:47:08 GMT  
 RichTextBox Multi-Undo -ReDo

Quote:

> JSWare does not have ReDo and the UnDo ends strangely and fails.

  ?? Are you sure you have the right download? The
owner drawn RTB? (Not the sample RTB APIs
download.) The folder in the zip should be named
"RTB owner drawn". There's both undo and redo
included in the demo edit menu. And they both
work. The Undo seems to undo more than one typed
character, which is not the way it normally works.
I'm not sure ogffhand what's going on with that. The
exact same code is in my compiled software and
that does Undo 1 character at a time.


Thu, 16 Feb 2012 06:55:33 GMT  
 RichTextBox Multi-Undo -ReDo
vbAcc seems to work but what a lot of code to sift through just for UnDo ReDo.
Quote:

>   Use the RichEdit20 library to get RE v. 2/3.
> The RTB control, in addition to being a bit slower
> and requiring that you ship the OCX, also uses
> only RichEdit v. 1. Each version added new, useful
> functionality. I think it was v. 2 that added unlimited
> undo/redo support:

> http://msdn.microsoft.com/en-us/library/bb787873(VS.85).aspx

>   I've got my own version of an RTB control here:
> www.jsware.net/jsware/vbcode.php5#rtbuc

>   You just add the userControl to the project and it's
> as easy to use as the RTB OCX. You can then pretty
> much assume RichEdit v. 3 as long as you're writing
> to Win98SE or later.

> VBAccelerator also has an RTB here:
> http://www.vbaccelerator.com/codelib/richedit/richedit.htm

> And I think there are other versions around. The bulk of
> the work is setting up API versions of common RTB
> functions. All of these RTB controls have sample code
> for that. The other big thing is arranging to have the control
> be self-subclassing and linking the owner-drawn window
> to the userControl. That's the "trick" to making your own
> owner-drawn, userControl-based version as simple and
> hassle-free as an OCX.
>    My own version is using Paul Caton's (DEP-safe) assembly
> code for self-subclassing. There's also the "new" subclassing
> approach that Karl Peterson wrote about recently:

> http://vb.mvps.org/samples/HookXP/

> Very simple subclassing functions that have been available
> for many years, but that were not documented by Microsoft
> until recently.
> http://www.geoffchappell.com/studies/windows/shell/comctl32/api/index...
> http://msdn.microsoft.com/en-us/library/bb762102(VS.85).aspx

>   That's a lot of details....maybe more than you want to know. :)
> But to paraphrase: Once you get off of the RTB OCX you'll
> never go back.

> > VB6
> > I have tried several multi-level UnDo ReDo schemes on the web but all to
> fail.
> > One uses a collection class.  Another not sure what it is.
> > I cannot find any working examples.

> > Are there any working examples?
> > Where are they hidden?

> > If I code my own, what is the easiest or best scheme to use?



Thu, 16 Feb 2012 06:56:02 GMT  
 RichTextBox Multi-Undo -ReDo
I used a version of Canton subclass and it was very good for what I needed.
Made a virtual ListView Report.  I still have a few code errors so I did not
post the code.  Very fast and handles large arrays.  But off topic for now.
Quote:

> --
> --


> > I tried seven sample programs I found out there and none of them worked.
> > not sure if it is due to different versions of RTB.
> > Many were similar and one based on VBAccelerator code.
> > These were full examples with a GUI.  No Go.
> > Seems strange all that claims a working example, did not actually work.
> > .ocx version?

>    I'd be curious to see those if you still have any links
> to userControl versions (as opposed to compiled
> OCX). I think the only one's I've seen are the VBAccelerator
> version and, I think, a version made by Eduardo Morcillo.
> Eduardo morcillo does interesting stuff, but with *no*
> documentation and he has a very quirky style of coding.
> The VBAccelerator stuff seems to generally be good,
> but it can be a pain to use. They've got their own subclassing
> library, for instance, that's needed for a lot of their stuff.
> Personally I tend to look at their stuff for API reference,
> mostly. Setting up their samples to run is often just too much
> trouble.

>   My own version uses ideas from Matthew Curland to
> "attach" the RTB window to the UC. (There are some
> little tricky things, like making sure the RichEdit window
> stays with the UC window dimensions, dealing with
> accelerator keys so that a Tab press won't jump out of
> your RTB, etc.) But Matthew Curland's self-subclass code,
> as nice as it was, conflicts with the extreme DEP settings
> on newer systems.

>    The Paul Caton
> subclass code is fairly complex, but not very involved
> once you know how it works. I've thought of switching
> to the SetWindowSubclass approach, but my current
> Caton subclass version is stable and tested, so I've
> been loathe to start fiddling with it unnecessarily.



Thu, 16 Feb 2012 07:01:01 GMT  
 RichTextBox Multi-Undo -ReDo

I made a bad assumption that Ctrl-Z etc would work.
Ctrl-Z goes bad.
Ctrl- what for ReDo.

Want keystrokes to work.
Trying to figure out how Ctrl-R and Ctrl-L operate.

Menu does do both UnDo and ReDo.

Quote:

> > JSWare does not have ReDo and the UnDo ends strangely and fails.

>   ?? Are you sure you have the right download? The
> owner drawn RTB? (Not the sample RTB APIs
> download.) The folder in the zip should be named
> "RTB owner drawn". There's both undo and redo
> included in the demo edit menu. And they both
> work. The Undo seems to undo more than one typed
> character, which is not the way it normally works.
> I'm not sure ogffhand what's going on with that. The
> exact same code is in my compiled software and
> that does Undo 1 character at a time.



Thu, 16 Feb 2012 07:10:01 GMT  
 RichTextBox Multi-Undo -ReDo
Quote:
> vbAcc seems to work but what a lot of code to sift through just for UnDo
ReDo.

    After I posted my last post I thought that maybe
you're getting v. 1 emulation. RE v. 1 has single-level
undo and no redo. Starting with v. 2 there's both,
in multi-level. So maybe straightening out the eiched20.dll
issue is the first thing to deal with. Once you're using
v. 2 or higher there's no code needed for undo/redo.
It's built in. you just need a simple SendMessage call.


Thu, 16 Feb 2012 07:14:39 GMT  
 RichTextBox Multi-Undo -ReDo
Sorry, I do have msftedit and riched20 in system32 folder but cannot locate
in toolbox components.
What is it listed as?   Or maybe it isn't.
Quote:

> VB6
> I have tried several multi-level UnDo ReDo schemes on the web but all to fail.
> One uses a collection class.  Another not sure what it is.
> I cannot find any working examples.

> Are there any working examples?
> Where are they hidden?

> If I code my own, what is the easiest or best scheme to use?



Thu, 16 Feb 2012 07:38:01 GMT  
 RichTextBox Multi-Undo -ReDo

Quote:
> Ctrl- what for ReDo.

Ctrl+Y


Thu, 16 Feb 2012 07:40:26 GMT  
 RichTextBox Multi-Undo -ReDo

I see that these .dlls need methods to use them that I am not familiar with.
I can't find anything at MSDN or on the web .. yet to show me how.

Quote:

> Sorry, I do have msftedit and riched20 in system32 folder but cannot locate
> in toolbox components.
> What is it listed as?   Or maybe it isn't.


> > VB6
> > I have tried several multi-level UnDo ReDo schemes on the web but all to fail.
> > One uses a collection class.  Another not sure what it is.
> > I cannot find any working examples.

> > Are there any working examples?
> > Where are they hidden?

> > If I code my own, what is the easiest or best scheme to use?



Thu, 16 Feb 2012 07:56:01 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. UNDO & REDO System for RichTextBox

2. UNDO & REDO System for RichTextBox

3. multiple undo-redo with the RichTextBox for MDI

4. Multiple undo-redo with RichTextBox

5. accessing undo/redo list

6. Accessing the UnDo/Redo queue

7. Undo and Redo List, one step, not many steps, VBA

8. Broken Undo/Redo in RTB

9. using rich text box undo/redo properly?

10. How to implement Undo/Redo functionality

11. RTF Undo/Redo

12. Undo and Redo

 

 
Powered by phpBB® Forum Software