Skip to main content

TCustomdxPSExplorerItem.CanRenameTo(string) Method

Returns a value indicating whether the item can accept the name specified.

Declaration

function CanRenameTo(const AName: string): Boolean; virtual;

Parameters

Name Type
AName string

Returns

Type
Boolean

Remarks

Report explorers enable end-users to edit folder and item captions. When an item’s caption is in edit mode, end-users can press the ENTER key or click outside of the edit region to accept the current caption. In this case, the item’s CanRenameTo method is called to determine if the new name can be accepted. The name to be tested is passed as the AName parameter. If the method returns True, the item’s name is changed to the entered value. Otherwise, an error message box is displayed and the item’s caption is reset to the initial value without closing the caption editor. The message box’s text is specified by the CannotRenameMessageText method’s return value.

As implemented in the TCustomdxPSExplorerItem class, the CanRenameTo method returns a value indicating whether the explorer allows renaming. For instance, the file-based report explorer validates the file name before accepting it.

TCustomdxPSExplorerItem descendants override the CanRenameTo method to return False if the item’s parent folder already contains a folder/file with the specified name.

See Also