Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7854591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:06:48+00:00 2026-06-02T20:06:48+00:00

I have a rather large application I’m trying to make in Visual-C++, and I

  • 0

I have a rather large application I’m trying to make in Visual-C++, and I am now trying to add undo/redo functionality.

Having a rather large amount of events (button clicks, label text changed, etc.), I would like to find a way to undo/redo without adding code to every function.
For Instance, I would like a class that can read every event done and store it automatically. Then in my undo/redo events, I can just get the latest action stored.

If that is not possible, I would not mind some other way.

Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:06:49+00:00Added an answer on June 2, 2026 at 8:06 pm

    Declare a class that represent two operations – undo and redo.
    Also create two vectors of that class.

    For each operation you want to apply undo/redo, push an instance of that class into the undo vector. There should be as many derived classes as there are opreations you want to undo.

    For example, if a button click paints the background to green, you create a class instance whose undo metdho paints the background to the previous color, and its redo method paints the background to green, and stuff it into the undo vector.
    When you undo – you pop the last class instance and call its undo method, which will paint the background to the previous color. Then you push it to the redo vector.

    When you redo, you pop the redo vector for the class instance at the top and invoke its redo method, them stuff it back to the undo vector.

    There are some corner cases (boundaries), you’ll tackle them when encountered.. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rather large spring application, and all I'm trying to share is
I have a rather large application that has literally a hundred DDLs with Yes
We have a rather large and complex application written in Java which is running
I have a web application that is becoming rather large. I want to separate
we're having this big problem with our application. It's a rather large application with
I have a memory leak issue in my application which loads a large amount
I have built an application in flash, it is rather a large application that
I have a rather large application which, on the admin frontend, takes a few
I have a rather large database exposed to my application using LINQ-to-SQL. I need
I am building a rather large web application and have built a handful of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.