1. Undo stack in RichEdit
- Posted by Antonio Alessi <a.admin at myway.it> Apr 12, 2006
- 545 views
When text is changed into a RichEdit window, the Undo feature become active and at every change it is increased one step. Note that this does not occurr on every single character change, but after a string, or some text is changed. I need to know the current number of these steps, or the stack length( ) of the Undo feature. Is there a way to get this info? Thanks to everybody for an answer. Antonio Alessi
2. Re: Undo stack in RichEdit
- Posted by Al Getz <Xaxo at aol.com> Apr 12, 2006
- 520 views
Antonio Alessi wrote: > > > When text is changed into a RichEdit window, the Undo feature become active > > and at every change it is increased one step. > Note that this does not occurr on every single character change, but after > a string, or some text is changed. > > I need to know the current number of these steps, or the stack length( ) > of the Undo feature. Is there a way to get this info? > > Thanks to everybody for an answer. > > Antonio Alessi Hi there Antonio, I think you can use EM_SETUNDOLIMIT and there might be a GET version too, but dont remember offhand. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."
3. Re: Undo stack in RichEdit
- Posted by Antonio Alessi <a.admin at myway.it> Apr 12, 2006
- 522 views
Al Getz wrote: > > Antonio Alessi wrote: > > > > > > When text is changed into a RichEdit window, the Undo feature become active > > > > and at every change it is increased one step. > > Note that this does not occurr on every single character change, but after > > a string, or some text is changed. > > > > I need to know the current number of these steps, or the stack length( ) > > of the Undo feature. Is there a way to get this info? > > > > Thanks to everybody for an answer. > > > > Antonio Alessi > > Hi there Antonio, > > I think you can use EM_SETUNDOLIMIT > and there might be a GET version too, but dont remember offhand. > > Hi Al, thanks for the advice; but I don't refer to the absolute POSSIBLE number of these steps (the LIMIT is 100, with the win32lib 0-59), but the current stack counter, i.e. how many Undo commands can be executed, or the true number of changes that culd be undone in any moment. Somebody else? antonio
4. Re: Undo stack in RichEdit
- Posted by Al Getz <Xaxo at aol.com> Apr 12, 2006
- 555 views
Antonio Alessi wrote: > > Al Getz wrote: > > > > Antonio Alessi wrote: > > > > > > > > > When text is changed into a RichEdit window, the Undo feature become > > > active > > > > > > and at every change it is increased one step. > > > Note that this does not occurr on every single character change, but after > > > > > > a string, or some text is changed. > > > > > > I need to know the current number of these steps, or the stack length( ) > > > of the Undo feature. Is there a way to get this info? > > > > > > Thanks to everybody for an answer. > > > > > > Antonio Alessi > > > > Hi there Antonio, > > > > I think you can use EM_SETUNDOLIMIT > > and there might be a GET version too, but dont remember offhand. > > > > > Hi Al, > > thanks for the advice; > but I don't refer to the absolute POSSIBLE number of these steps > (the LIMIT is 100, with the win32lib 0-59), but the current stack counter, > i.e. how many Undo commands can be executed, or the true number of changes > that culd be undone in any moment. > > Somebody else? > > antonio Hi Antonio, Oh i see, well, did you try sending EM_GETREDONAME a multiple number of times? Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."
5. Re: Undo stack in RichEdit
- Posted by Antonio Alessi <a.admin at myway.it> Apr 12, 2006
- 528 views
> > > > > Hi Al, > > > > thanks for the advice; > > but I don't refer to the absolute POSSIBLE number of these steps > > (the LIMIT is 100, with the win32lib 0-59), but the current stack counter, > > i.e. how many Undo commands can be executed, or the true number of changes > > that culd be undone in any moment. > > > > Somebody else? > > > > antonio > > Hi Antonio, > > > Oh i see, well, did you try sending > EM_GETREDONAME > a multiple number of times? > > Hi again Al, EM_GETREDONAME = (WM_USER + 87) for i = 1 to 5 do ? sendMessage( TxtArea, EM_GETREDONAME, 0, 0) end for 1 1 1 1 1 Is that what you mean? However, if cannot get a direct answer, I've already found another way! antonio
6. Re: Undo stack in RichEdit
- Posted by Al Getz <Xaxo at aol.com> Apr 12, 2006
- 515 views
Antonio Alessi wrote: > > > > > > > > Hi Al, > > > > > > thanks for the advice; > > > but I don't refer to the absolute POSSIBLE number of these steps > > > (the LIMIT is 100, with the win32lib 0-59), but the current stack counter, > > > > > > i.e. how many Undo commands can be executed, or the true number of changes > > > > > > that culd be undone in any moment. > > > > > > Somebody else? > > > > > > antonio > > > > Hi Antonio, > > > > > > Oh i see, well, did you try sending > > EM_GETREDONAME > > a multiple number of times? > > > > > Hi again Al, > > EM_GETREDONAME = (WM_USER + 87) > > for i = 1 to 5 do > ? sendMessage( TxtArea, EM_GETREDONAME, 0, 0) > end for > > 1 > 1 > 1 > 1 > 1 > > Is that what you mean? > However, if cannot get a direct answer, I've already found another way! > > antonio Apparently you're saying you can only get the most recent 'do', or did you do lots of stuff before calling that function? If you only 'do' one thing and it keeps returing a '1' then i guess this method doesnt work. As usual, MS implies that something like this WORKS because if you read the doc's they say you can create a drop down list of undo actions the user wants to do. Sorry if it doesnt work. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."
7. Re: Undo stack in RichEdit
- Posted by Antonio Alessi <a.admin at myway.it> Apr 12, 2006
- 522 views
> > > > > > Hi Antonio, > > > > > > > > > Oh i see, well, did you try sending > > > EM_GETREDONAME > > > a multiple number of times? > > > > > > > > Hi again Al, > > > > EM_GETREDONAME = (WM_USER + 87) > > > > for i = 1 to 5 do > > ? sendMessage( TxtArea, EM_GETREDONAME, 0, 0) > > end for > > > > 1 > > 1 > > 1 > > 1 > > 1 > > > > Is that what you mean? > > However, if cannot get a direct answer, I've already found another way! > > > > antonio > > Apparently you're saying you can only get the most > recent 'do', or did you do lots of stuff before > calling that function? > If you only 'do' one thing and it keeps returing a '1' > then i guess this method doesnt work. > As usual, MS implies that something like this WORKS because > if you read the doc's they say you can create a drop down > list of undo actions the user wants to do. > Sorry if it doesnt work. It was not the most recent; I did some changes before undoing the last one and my counter was to 5. Unless I have made a mistake, it probably doesn't work as expected, but it's not a problem when that medicine called "do it yourself" can supply.. Note that when I speak of direct answer, I mean the result of a query to the OS of course, not to the EUforum :) about the 'docs', give a look to my reply to the Cuvier Christian's comments.. have a nice evening. antonio
8. Re: Undo stack in RichEdit
- Posted by Al Getz <Xaxo at aol.com> Apr 12, 2006
- 522 views
Antonio Alessi wrote: > > > > > > > > > Hi Antonio, > > > > > > > > > > > > Oh i see, well, did you try sending > > > > EM_GETREDONAME > > > > a multiple number of times? > > > > > > > > > > > Hi again Al, > > > > > > EM_GETREDONAME = (WM_USER + 87) > > > > > > for i = 1 to 5 do > > > ? sendMessage( TxtArea, EM_GETREDONAME, 0, 0) > > > end for > > > > > > 1 > > > 1 > > > 1 > > > 1 > > > 1 > > > > > > Is that what you mean? > > > However, if cannot get a direct answer, I've already found another way! > > > > > > antonio > > > > Apparently you're saying you can only get the most > > recent 'do', or did you do lots of stuff before > > calling that function? > > If you only 'do' one thing and it keeps returing a '1' > > then i guess this method doesnt work. > > As usual, MS implies that something like this WORKS because > > if you read the doc's they say you can create a drop down > > list of undo actions the user wants to do. > > Sorry if it doesnt work. > > It was not the most recent; I did some changes before undoing the last one > and my counter was to 5. Unless I have made a mistake, it probably doesn't > work as expected, but it's not a problem when that medicine called > "do it yourself" can supply.. > > Note that when I speak of direct answer, I mean the result of a query > to the OS of course, not to the EUforum :) > > about the 'docs', give a look to my reply to the Cuvier Christian's comments.. > > have a nice evening. > antonio Hi again, Try 'doing' only one action first, then call that function several times. If that keeps returning a '1' then this doesnt work, but you cant do 5 or 6 or more things and call it 5 times and expect to see a different value returned unless you did something different for one 'do'. Like i said though, if this doesnt work it's not my fault but it's worth a try. If you solve it another way you're now obligated to tell use what it was Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."
9. Re: Undo stack in RichEdit
- Posted by Antonio Alessi <a.admin at myway.it> Apr 13, 2006
- 537 views
Al Getz wrote: > Hi again, > > Try 'doing' only one action first, then call that function several times. > If that keeps returning a '1' then this doesnt work, but you cant > do 5 or 6 or more things and call it 5 times and expect to see > a different value returned unless you did something different for > one 'do'. > Like i said though, if this doesnt work it's not my fault > but it's worth a try. > > If you solve it another way you're now obligated to tell use what > it was > > > Al I edit the text with several changes, then I try again this way:
VOID = sendMessage( TxtArea, WM_UNDO, 0, 0) for i = 1 to 5 do ? sendMessage( TxtArea, EM_GETREDONAME, 0, 0) end for
and also:
for i = 1 to 5 do ? sendMessage( TxtArea, EM_GETUNDONAME, 0, 0) end for
The result this time was always a repeated 2, or a repeated 5 then a 2 again, but nothing that had to do with the true Undo/redo counter that's working aside. May be something is wrong, since I don't know Windows programming. ______________ My way is not a secret of course; it deals with to stack every change, through the keyboard and mouse event trapping. The problem was to know when RichEdit delimits any change: any contiguous character editing or typing is embedded by RE into a single change, that ends on the 1st movement of the caret, by keyboard or mouse, or Cut, Paste, DEL, etc.. This match a character whose ASCII is lower than "0" = {48, 0}, (eg. Home = '$' = {36, 0}, while the true "$" is a {52, 1} or a Shift-4) thus allowing a new change to begin. Knowing that, I could also get the choice to select how to Undo/Redo the changes, since to force RE store a single byte change I simply had to do a setIndex( ) after each keystroke, this way:
line = getSelection( TxtArea) setIndex( TxtArea, {line[1]+1, line[1]+1}) setIndex( TxtArea, line)
Having to update my counters for each byte, cannot lauch such a loop at every step, since I could have to count up to 99 sendMessage everytime to be added to other ops..., but my counters seem to work fine, also helping to evaulate the state of the file on save or close. Hope this can help. antonio
10. Re: Undo stack in RichEdit
- Posted by Al Getz <Xaxo at aol.com> Apr 13, 2006
- 511 views
Hi Antonio, I guess you've tried this enough then. Sorry it doesnt work the way the MS doc's seem to suggest it will (big surprise there huh? he he). Maybe they wanted it to work that way but never got around to adding that functionality because they were drinking too much beer that day and Bill came in and yelled at them. Again, sorry it doesnt work, i just suggested this in case it did like the doc's suggest. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."