From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- .../text/sbasic/shared/compatibilitymode.xhp | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 helpcontent2/source/text/sbasic/shared/compatibilitymode.xhp (limited to 'helpcontent2/source/text/sbasic/shared/compatibilitymode.xhp') diff --git a/helpcontent2/source/text/sbasic/shared/compatibilitymode.xhp b/helpcontent2/source/text/sbasic/shared/compatibilitymode.xhp new file mode 100644 index 000000000..f772f92c5 --- /dev/null +++ b/helpcontent2/source/text/sbasic/shared/compatibilitymode.xhp @@ -0,0 +1,92 @@ + + + + + + CompatibilityMode function + /text/sbasic/shared/compatibilitymode.xhp + + + + + CompatibilityMode + VBA compatibility mode + +
+

CompatibilityMode() Function

+ CompatibilityMode() function controls or queries runtime mode. It affects all code executed after setting or resetting the runtime mode. +
+ Use this feature with caution, limit it to document conversion for example. + + + + CompatibilityMode(Optional Enable As Boolean) As Boolean + + + + CompatibilityMode function always returns the mode that is active after its execution. That is if called with argument, it returns the new mode, if called without argument, it returns active mode without modifying it. + + + Enable: Sets or unsets new compatibility mode when the argument is present. + CompatibilityMode function relates to Option VBASupport 1, in which case it always returns True. It is unrelated to Option Compatible compiler directive. + + This function may affect or help in the following situations: + + Scoping of variables. + Running RmDir command in VBA mode. In VBA only empty directories are removed by RmDir while %PRODUCTNAME Basic removes a directory recursively. + Changing behavior of Basic Dir command. The directory flag (16) for the Dir command means that only directories are returned in %PRODUCTNAME Basic, while in VBA normal files and directories are returned. + + Color components calculation with the Red and Blue functions which are interchanged (The Green function is not affected). + + + + + Given a NOT empty directory at file:///home/me/Test + + Sub RemoveDir + MsgBox CompatibilityMode() ' False + + CompatibilityMode( True ) + RmDir( "file:///home/me/Test" ) + CompatibilityMode False + + MsgBox CompatibilityMode ' False + End Sub + + With CompatibilityMode( True ) the program raises an error, otherwise the Test directory and all its content is deleted. + + Modifying Dir behavior + + Sub VBADirCommand + CompatibilityMode( Enable := True ) ' Shows also normal files + Entry$ = Dir( "file:///home/me/Tmp/*.*", 16 ) + Total$ = "" + While Entry$ <> "" + Total$ = Total$ + Entry$ + Chr$(13) + Entry$ = Dir + Wend + MsgBox Total$ + CompatibilityMode Enable := False ' Shows only directories + End Sub + + +
+ + + + Variables scope modification in Using Procedures and Functions with CompatibilityMode() function. + + + + + +
+ +
-- cgit v1.2.3