Discussion:
Help please: How to undo?
Lennox Jacob
2007-02-01 00:39:58 UTC
Permalink
Hello,
I have an editfield with some text in it. Then I change (select then Enter) some of the text. I now want to Undo that.
I have a pushbutton named Undo, what do I put in Undo pushbutton's action event?
Thanks.
Lennox


---------------------------------
Never Miss an Email
Stay connected with Yahoo! Mail on your mobile. Get started!
Arnaud Nicolet
2007-02-01 09:21:09 UTC
Permalink
You'll have to remember the text at a certain point.

Make a property in your window, for example: MyLastText As String

Then, for the example, put this code in the open event (when the text
you want as the default is in the edit field):

MyLastText=me.text

In your push button, write EF1.text=MyLastText (assuming your
editfield is named EF1).

Hope this help
Post by Lennox Jacob
Hello,
I have an editfield with some text in it. Then I change (select
then Enter) some of the text. I now want to Undo that.
I have a pushbutton named Undo, what do I put in Undo pushbutton's action event?
Thanks.
Lennox
Lennox Jacob
2007-02-01 12:24:40 UTC
Permalink
Thanks as usual Arnaud,
At least this is a good starting point.
Lennox.

Arnaud Nicolet <***@tribu.ch> wrote: You'll have to remember the text at a certain point.

Make a property in your window, for example: MyLastText As String

Then, for the example, put this code in the open event (when the text
you want as the default is in the edit field):

MyLastText=me.text

In your push button, write EF1.text=MyLastText (assuming your
editfield is named EF1).

Hope this help
Post by Lennox Jacob
Hello,
I have an editfield with some text in it. Then I change (select
then Enter) some of the text. I now want to Undo that.
I have a pushbutton named Undo, what do I put in Undo pushbutton's action event?
Thanks.
Lennox
_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives of this list here:




---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and
always stay connected to friends.
Lennox Jacob
2007-02-01 12:48:50 UTC
Permalink
Hi Arnaud,

I did not put it in the Open event, but I put it in the Activate and got focus events.

The activate event for opening an existing document and the got focus for changes in an already open document.

Works great.

Lennox.

Arnaud Nicolet <***@tribu.ch> wrote: You'll have to remember the text at a certain point.

Make a property in your window, for example: MyLastText As String

Then, for the example, put this code in the open event (when the text
you want as the default is in the edit field):

MyLastText=me.text

In your push button, write EF1.text=MyLastText (assuming your
editfield is named EF1).

Hope this help
Post by Lennox Jacob
Hello,
I have an editfield with some text in it. Then I change (select
then Enter) some of the text. I now want to Undo that.
I have a pushbutton named Undo, what do I put in Undo pushbutton's action event?
Thanks.
Lennox
_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives of this list here:




---------------------------------
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
Arnaud Nicolet
2007-02-01 14:37:02 UTC
Permalink
Hi Lennox,

By doing so, you have to be aware of a fact (if it's relevant for
what you're doing).

If you change your text, then simply switch to the Finder to make
anything and then switch back, the remembered text will be the one
after the switch (because the Activate event is called not only when
a document is opened, but also when the window is simply brought to
the front).
Same fact apply if you simply move to another edit field (assuming
there is more than one) and then come back to your target edit field.
Post by Lennox Jacob
The activate event for opening an existing document
I think it'll be more reliable to do it in the same method where you
open your document (maybe just call another function).
Post by Lennox Jacob
and the got focus for changes in an already open document.
You're certainly doing something I don't understand here.

Hope this helps
Post by Lennox Jacob
Hi Arnaud,
I did not put it in the Open event, but I put it in the Activate and got focus events.
The activate event for opening an existing document and the got
focus for changes in an already open document.
Works great.
Lennox.
text at a certain point.
Make a property in your window, for example: MyLastText As String
Then, for the example, put this code in the open event (when the text
MyLastText=me.text
In your push button, write EF1.text=MyLastText (assuming your
editfield is named EF1).
Hope this help
Post by Lennox Jacob
Hello,
I have an editfield with some text in it. Then I change (select
then Enter) some of the text. I now want to Undo that.
I have a pushbutton named Undo, what do I put in Undo pushbutton's action event?
Thanks.
Lennox
_______________________________________________
---------------------------------
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
Lennox Jacob
2007-02-01 16:12:00 UTC
Permalink
Hi Arnaud,

By doing so, you have to be aware of a fact (if it's relevant for
what you're doing).

If you change your text, then simply switch to the Finder to make
anything and then switch back, the remembered text will be the one
after the switch (because the Activate event is called not only when
a document is opened, but also when the window is simply brought to
the front).
Same fact apply if you simply move to another edit field (assuming
there is more than one) and then come back to your target edit field.

By doing so, you have to be aware of a fact (if it's relevant for
what you're doing).

If you change your text, then simply switch to the Finder to make
anything and then switch back, the remembered text will be the one
after the switch (because the Activate event is called not only when
a document is opened, but also when the window is simply brought to
the front).
Same fact apply if you simply move to another edit field (assuming
there is more than one) and then come back to your target edit field.
Post by Lennox Jacob
The activate event for opening an existing document
I think it'll be more reliable to do it in the same method where you
open your document (maybe just call another function).
I realized that and had corrected it before reading your post, thanks still.
Post by Lennox Jacob
Post by Lennox Jacob
and the got focus for changes in an already open document.
You're certainly doing something I don't understand here.
OK, what happens here is that I do not know how to do undo multiple times (any advice?).
So, I use got focus to remember the text before I do further changes. Then, if I make some more changes (and once I do not lose focus), Undo will take me back to the point before i got focus.

Works for me for now until I become more proficient.

Lennox







---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.
Arnaud Nicolet
2007-02-01 17:02:02 UTC
Permalink
Post by Lennox Jacob
OK, what happens here is that I do not know how to do undo multiple times (any advice?).
You will have to have an array instead of a simple variable.
Like MyTexts() As String

Then, every time you want to remember the text, you add the text to
the array.
When you want to make the undo, you set the text back to the last
item of your array. You then remove it (so further undos works as well).
You may try in that way (remember that you can always try with a
small (and unsaved project) to make tests that behaves as you want).
Post by Lennox Jacob
So, I use got focus to remember the text before I do further
changes. Then, if I make some more changes (and once I do not lose
focus), Undo will take me back to the point before i got focus.
If it's good for you, then that's fine.

Hope this helps.
Lennox Jacob
2007-02-01 17:11:59 UTC
Permalink
Thanks Arnaud,
I'll try it (multiple undo via an array).
Thanks again.
Lennox
Post by Lennox Jacob
OK, what happens here is that I do not know how to do undo multiple times (any advice?).
You will have to have an array instead of a simple variable.
Like MyTexts() As String

Then, every time you want to remember the text, you add the text to
the array.
When you want to make the undo, you set the text back to the last
item of your array. You then remove it (so further undos works as well).
You may try in that way (remember that you can always try with a
small (and unsaved project) to make tests that behaves as you want).
Post by Lennox Jacob
So, I use got focus to remember the text before I do further
changes. Then, if I make some more changes (and once I do not lose
focus), Undo will take me back to the point before i got focus.
If it's good for you, then that's fine.

Hope this helps.
_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives of this list here:




---------------------------------
Access over 1 million songs - Yahoo! Music Unlimited.

Continue reading on narkive:
Loading...