473,782 Members | 2,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

does vb2005 have builtin UnDo feature for apps? or do I have to wr

Hello,

Does vb2005 have a built-in UnDo feature / object for applications so that I
can undo actions like other windows apps? Or do I have to write my own UnDo
routine?

If vb2005 does have a builtin Undo feature / object / command -- how to
implement it? invoke it?

If there is no builtin undo feature - is there a recommended way to write an
undo action? what would this way be?

Thanks,
Rich
Mar 15 '07 #1
4 1593

"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:D5******** *************** ***********@mic rosoft.com...
Hello,

Does vb2005 have a built-in UnDo feature / object for applications so that
I
can undo actions like other windows apps? Or do I have to write my own
UnDo
routine?

If vb2005 does have a builtin Undo feature / object / command -- how to
implement it? invoke it?

If there is no builtin undo feature - is there a recommended way to write
an
undo action? what would this way be?

Thanks,
Rich
I have seen code for what you are looking for. Here are the steps.

1. Define a set of actions which can happen that will "Do" things.

2. Each action will have a Do and an UnDo routine

3. Then ensure that all updates (Do's) get executed by a kind of funnel
routine. This routine will both cause the action to be performed and if
that action is performed log the action in a collection somewhere in your
application. The application should be a stack FIFO.

4. Now you could use the CLT-Z hot key to reverse each action. Use a Pop to
get the latest action from the stack, and that Pop will remove it from the
stack.

That is the framework for what you are attempting.

Lloyd Sheen

Mar 15 '07 #2
Thanks for your reply. This sounds kind of interesting, except that the last
time I did anything which involved the "words" stack/push/pop - was in C++
in the classroom environment about 10 years ago.

When you say stack - are you refering to the Heap stack? or are you using
"Stack" metaphorically? As in - I log each action in a collection object or
a datatable or something where for example - a user updates a field in a row
in some table on the database but needs to undo that action - so the app
looks at the last row in the collection datatable where I have stored the
criteria used to update this field and what the value was before the update
and restore the previous value?

My goal is to not re-invent the Undo Wheel if it already exists in VB2005.
If I can use the Heap to reverse an action - that would be great. But if
that isn't what you are refering to, then I was planning on writing my own
undo routine where I store each action as I described above stuff to their
previous states - which would actually be a new action.

If you ARE referring to the Heap, could you refresh my brain on how to push
and pop stuff on the heap?

Thanks,
Rich

"Lloyd Sheen" wrote:
>
"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:D5******** *************** ***********@mic rosoft.com...
Hello,

Does vb2005 have a built-in UnDo feature / object for applications so that
I
can undo actions like other windows apps? Or do I have to write my own
UnDo
routine?

If vb2005 does have a builtin Undo feature / object / command -- how to
implement it? invoke it?

If there is no builtin undo feature - is there a recommended way to write
an
undo action? what would this way be?

Thanks,
Rich

I have seen code for what you are looking for. Here are the steps.

1. Define a set of actions which can happen that will "Do" things.

2. Each action will have a Do and an UnDo routine

3. Then ensure that all updates (Do's) get executed by a kind of funnel
routine. This routine will both cause the action to be performed and if
that action is performed log the action in a collection somewhere in your
application. The application should be a stack FIFO.

4. Now you could use the CLT-Z hot key to reverse each action. Use a Pop to
get the latest action from the stack, and that Pop will remove it from the
stack.

That is the framework for what you are attempting.

Lloyd Sheen

Mar 16 '07 #3

"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:32******** *************** ***********@mic rosoft.com...
Thanks for your reply. This sounds kind of interesting, except that the
last
time I did anything which involved the "words" stack/push/pop - was in
C++
in the classroom environment about 10 years ago.

When you say stack - are you refering to the Heap stack? or are you using
"Stack" metaphorically? As in - I log each action in a collection object
or
a datatable or something where for example - a user updates a field in a
row
in some table on the database but needs to undo that action - so the app
looks at the last row in the collection datatable where I have stored the
criteria used to update this field and what the value was before the
update
and restore the previous value?

My goal is to not re-invent the Undo Wheel if it already exists in VB2005.
If I can use the Heap to reverse an action - that would be great. But if
that isn't what you are refering to, then I was planning on writing my own
undo routine where I store each action as I described above stuff to their
previous states - which would actually be a new action.

If you ARE referring to the Heap, could you refresh my brain on how to
push
and pop stuff on the heap?

Thanks,
Rich

"Lloyd Sheen" wrote:
>>
"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:D5******* *************** ************@mi crosoft.com...
Hello,

Does vb2005 have a built-in UnDo feature / object for applications so
that
I
can undo actions like other windows apps? Or do I have to write my own
UnDo
routine?

If vb2005 does have a builtin Undo feature / object / command -- how
to
implement it? invoke it?

If there is no builtin undo feature - is there a recommended way to
write
an
undo action? what would this way be?

Thanks,
Rich

I have seen code for what you are looking for. Here are the steps.

1. Define a set of actions which can happen that will "Do" things.

2. Each action will have a Do and an UnDo routine

3. Then ensure that all updates (Do's) get executed by a kind of funnel
routine. This routine will both cause the action to be performed and if
that action is performed log the action in a collection somewhere in your
application. The application should be a stack FIFO.

4. Now you could use the CLT-Z hot key to reverse each action. Use a Pop
to
get the latest action from the stack, and that Pop will remove it from
the
stack.

That is the framework for what you are attempting.

Lloyd Sheen

The Stack I am talking about is a "Collection " class in Dot.Net V2.0. Check
out System.Collecti ons.Generic.Sta ck(Of T). The 'T' is the type of object
you are storing. If you create a set of Action objects then they should all
inherit from a base class that has the methods defined that you will use
'Do' and UnDo'. Then the declaration for the Stack would be

Dim MyStack as System.Collecti ons.Generic.Sta ck(Of BaseClassForAct ions)

Then to add a new action you create the action (after it is succesfully
completed) to the stack with the following code (assuming an class named
ActionAdd has been defined and has a method Do which returns a boolean
indicating the success of the action) :

Dim MyAction as new ActionAdd
MyAction.NewTex t = 'NewText'
if MyAction.Do then
' action worked
MyStack.Push(My Action)
end if
Now if you want to handle an UnDo the code would be as follows:

Dim UnDoAction as BaseClassForAct ions ' Note we use the baseclass so that
all action objects returned from a Pop will have the UnDo method

if MyStack.count 0 then
UnDoAction = MyStack.Pop
UnDoAction.UnDo
end if

This should provide a start for the general framework. The actual action
objects are according to the type of application you have.

Lloyd Sheen

Mar 16 '07 #4
Thanks. This sounds like a little more fun than I was planning on. I will
give this a try on a test app.

"Lloyd Sheen" wrote:
>
"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:32******** *************** ***********@mic rosoft.com...
Thanks for your reply. This sounds kind of interesting, except that the
last
time I did anything which involved the "words" stack/push/pop - was in
C++
in the classroom environment about 10 years ago.

When you say stack - are you refering to the Heap stack? or are you using
"Stack" metaphorically? As in - I log each action in a collection object
or
a datatable or something where for example - a user updates a field in a
row
in some table on the database but needs to undo that action - so the app
looks at the last row in the collection datatable where I have stored the
criteria used to update this field and what the value was before the
update
and restore the previous value?

My goal is to not re-invent the Undo Wheel if it already exists in VB2005.
If I can use the Heap to reverse an action - that would be great. But if
that isn't what you are refering to, then I was planning on writing my own
undo routine where I store each action as I described above stuff to their
previous states - which would actually be a new action.

If you ARE referring to the Heap, could you refresh my brain on how to
push
and pop stuff on the heap?

Thanks,
Rich

"Lloyd Sheen" wrote:
>
"Rich" <Ri**@discussio ns.microsoft.co mwrote in message
news:D5******** *************** ***********@mic rosoft.com...
Hello,

Does vb2005 have a built-in UnDo feature / object for applications so
that
I
can undo actions like other windows apps? Or do I have to write my own
UnDo
routine?

If vb2005 does have a builtin Undo feature / object / command -- how
to
implement it? invoke it?

If there is no builtin undo feature - is there a recommended way to
write
an
undo action? what would this way be?

Thanks,
Rich

I have seen code for what you are looking for. Here are the steps.

1. Define a set of actions which can happen that will "Do" things.

2. Each action will have a Do and an UnDo routine

3. Then ensure that all updates (Do's) get executed by a kind of funnel
routine. This routine will both cause the action to be performed and if
that action is performed log the action in a collection somewhere in your
application. The application should be a stack FIFO.

4. Now you could use the CLT-Z hot key to reverse each action. Use a Pop
to
get the latest action from the stack, and that Pop will remove it from
the
stack.

That is the framework for what you are attempting.

Lloyd Sheen


The Stack I am talking about is a "Collection " class in Dot.Net V2.0. Check
out System.Collecti ons.Generic.Sta ck(Of T). The 'T' is the type of object
you are storing. If you create a set of Action objects then they should all
inherit from a base class that has the methods defined that you will use
'Do' and UnDo'. Then the declaration for the Stack would be

Dim MyStack as System.Collecti ons.Generic.Sta ck(Of BaseClassForAct ions)

Then to add a new action you create the action (after it is succesfully
completed) to the stack with the following code (assuming an class named
ActionAdd has been defined and has a method Do which returns a boolean
indicating the success of the action) :

Dim MyAction as new ActionAdd
MyAction.NewTex t = 'NewText'
if MyAction.Do then
' action worked
MyStack.Push(My Action)
end if
Now if you want to handle an UnDo the code would be as follows:

Dim UnDoAction as BaseClassForAct ions ' Note we use the baseclass so that
all action objects returned from a Pop will have the UnDo method

if MyStack.count 0 then
UnDoAction = MyStack.Pop
UnDoAction.UnDo
end if

This should provide a start for the general framework. The actual action
objects are according to the type of application you have.

Lloyd Sheen

Mar 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
12649
by: Enigman O'Maly | last post by:
I've written, er, that is, recorded and re-written a lot of little useful macros to help me with a spreadsheet dealing with financial investments. Very handy they are, yes, but sometimes I wish I could undo what one of them just screwed up for me. Is there any sort of checkpoint capability I could bodge into the code? The help index doesn't seem to know what that checkpointing means, no surprise, since I dredged it up from my ancient...
2
2120
by: Tony Nelson | last post by:
I'm looking for a "pythonic" GTK Undo library/class. It would have a framework for Undo/Redo, and would provide Undo/Redo for TextView, Entry, and containers and other classes. In a "batteries included" fashion, just instantiating a "UndoableTextView" or "UndoableEntry" or "UndoableContainer" would provide Undo and Redo in the right-click menu; simply connecting such an object to an "UndoableUIManager" would take care of the stock items...
1
2169
by: lbbs | last post by:
Will access allow you to undo more than one step. On mine it seams that you can only undo the last thing you did. In excel for example you can undo at least a dozen steps backwards. In access help, it states that supposedly you can do multiple undo's. Any ideas? also, Is the a feature (like in excel) that you can leave a note or comment hidden in a cell?
11
15185
by: Mad Joe | last post by:
I'm using a richTextBox for editing a source code (with Syntax Highlighting) of my own programming language... How come that myRichTextBox doesn't respond to Undo/Redo functions by using default shortcut keys, or even programaticaly (by using Button_onClick event)? if(myRichTextBox.CanUndo == true) { myRichTextBox.Undo(); }
11
3228
by: Brian W | last post by:
Yet another editor problem To reproduce do the following 1) Open a Webform and switch to HTML edit mode 2) Enter the Following (include spaces) This is some text before <asp:hyperlink id="hl1" runat="server " navigateurl="http://www.microsoft.com">This is my link</asp:hyperlink> And this is my text after the Hyperlink
2
1609
by: Omar Abid | last post by:
Hi, This the best site where you can find Hi members, We are happy to tell that if you search for : jobs with high wage or to debug a program or to find a good source code and to make a good design 4 your apps our group is the best to help u just subscribe to :VB2005 EXPRESS at http://groups.google.com/group/vb2005 OMAR ABID GROUP MANAGER
12
5745
by: rdemyan via AccessMonster.com | last post by:
I'm having a complicated linking problem. Before I get into the particulars, I'd like to know how Access links to the back-end file at startup, AFTER I've distributed my application to the client. Here's the issue. While I'm working on my app, I'm linked to the backend on my computer. When I distribute the app, the backend file is obviously in a different location (on the client server). But the first time my app is started up at...
113
5310
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside the Python world, you're fine. But once you do, things go downhill. MySQLdb has version and platform compatibility problems. So does M2Crypto. The built-in SSL support is weak. Even basic sockets don't quite work right; the socket module...
1
1410
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, I just upgraded the motherboard and cpu on my computer (core2Duo). I also imaged the contents of my old harddrive to a new one(500g) - Windows XP sp2 (version2002). Everything appears fine, VS6 runs fine, VS2003 runs fine, but VS2005 won't load new projects. I can load old projects or if I create a project in VB2003 and then upgrade it to VB2005 then the project will load. But I can't run VB2005 apps I created from the...
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.