2.2.4.13.18 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 
// Code assumes you have a worksheet active (default after new project)
void    Folder_Move_Window()
{
    Worksheet wks = Project.ActiveLayer();
    if(wks)
    {
        Folder root = Project.RootFolder;
        Folder subfld_1 = root.AddSubfolder("sub1");
        
        // Move the active worksheet into the new "sub1" folder
        Page pg = wks.GetPage();
        if( !pg.GetFolder().Move(pg.GetName(), subfld_1.GetPath()) )
            printf("Can't move this window!");
    }
}

EX2

// Demonstrate moving Folders
void    Folder_Move_Folder()
{
	Folder root = Project.RootFolder;
	Folder subfld_1 = root.AddSubfolder("sub1");
	Folder subfld_2 = root.AddSubfolder("sub2");
	
	// Move the new "sub2" folder into the new "sub1" folder
	if( !root.Move(subfld_2.GetName(), "/"+subfld_1.GetName()+"/", true) )
		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