2.2.4.45 UndoBlock


Name

UndoBlock

Remark

The UndoBlock class provides safe access to project functions UndoBlockBegin() and UndoBlockEnd().

Hierarchy

  • UndoBlock

Examples

EX1

void Project_UndoBlockId_ex1()
{
    // get format from Graph1 page
    GraphPage pageSrc("Graph1");
    Tree tree;
    tree = pageSrc.GetFormat();
    if( tree )
    {
        // get undo block ID before any changes
        int nIDbefore = Project.UndoBlockId();
 
        // better to limit scope of undo block
        {
            // start new undo block and save all changes there
            UndoBlock block;
 
            // apply format to Graph2 page
            GraphPage pageDst1("Graph2");
            BOOL bb = pageDst1.ApplyFormat(tree,true,false,true);
 
            // apply format to Graph3 page
            GraphPage pageDst2("Graph3");
            bb = pageDst2.ApplyFormat(tree,true,false,true);
        }
 
        // get undo block ID after all changes
        int nIDafter = Project.UndoBlockId();
 
        // undo all changes from the added undo block
        Project.Undo();
    }
}

Header to Include

origin.h

Reference

Members

Name Brief Example
UndoBlock constructor Examples