Folder::Move

Description

Move a folder or window

Syntax

BOOL Move( LPCSTR lpcszItemName, LPCSTR lpcszPathName, BOOL bMoveFolder = false )

Parameters

lpcszItemName
[input] name of the folder or short name of the page to be moved
lpcszPathName
[input]path, relative or absolute to move the item into
bMoveFolder
[input] indicate if lpcszItemName is a Page name or a Folder name (since a folder could have the same name as a window within the folder)

Return

TRUE on success, FALSE on failure

Examples

EX1

// Demonstrate moving Windows and Folders
// Code assumes you have a worksheet active (default after new project)
void    Folder_Move_Ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if(wks)
    {
        Folder root = Project.RootFolder;
        Folder subfld_1 = root.AddSubfolder("sub1");
        Folder subfld_2 = root.AddSubfolder("sub2");
        // Move the active worksheet into the new "sub1" folder
        if( !root.Move(wks.GetPage().GetName(), "/"+subfld_1.GetName()+"/") ) // move the current window to folder "sub1".
            printf("Can't move this window!");
        // Move the new "sub2" folder into the new "sub1" folder
        if( !root.Move(subfld_2.GetName(), "/"+subfld_1.GetName()+"/", true) ) // move subfolder "sub2" to folder "sub1".
            printf("Can't move this subfolder!");
    }
}

Remark

Move a window or folder from source path to destination path.

Note that the Move method cannot used on a folder object to move itself

See Also

header to Include

origin.h