CompatibilityMode documentation [1] lacks the information about its return value, and about its boolean argument being optional. It only sets new compatibility mode when the optional argument is present; it always returns the mode that is active after its execution (i.e., if called with argument, it returns the new mode; if called without argument, it returns active mode without modifying it). The source code is at [2]. Also, there are examples making use of this function: e.g., [3]. They do not reset the compatibility mode back after changing it for a task; that is bad practice, and *may* create a false impression in readers that the mode that is set by the function is local to current method scope - while the new mode will be active to all the code run after leaving current method, potentially creating unwanted changes in logic. Those samples should be corrected to properly record the original state, and restore it after completing the necessary operations. [1] https://help.libreoffice.org/7.2/en-US/text/sbasic/shared/compatibilitymode.html [2] https://opengrok.libreoffice.org/xref/core/basic/source/runtime/methods1.cxx?r=81a7d46d&mo=77319&fi=2960#2960 [3] https://help.libreoffice.org/7.2/en-US/text/sbasic/shared/01020300.html
Additionally, the help page mentions both 'Option Compatible' and 'Option VBASupport', but it is not apparent from the discussion which of the two is actually relevant here. Setting compile-time 'Option Compatible' does *not* automatically make 'CompatibilityMode()' called without arguments to return true; while 'Option VBASupport 1' does. IMO the mention of the 'Option Compatible' should be removed from this page completely, except for a proposed "note that this function is not related to Option Compatible, and relates to Option VBASupport" notice. It is not clear how can this *run-time* function affect "Creating enumerations with Enum statement" compile-time thing (also mentioned on this help page) - maybe it should be removed from here, and moved to 'Option Compatible' page.
Hi Mike For those no reading C++ like, can you descibe a bit more compMode() arguments? I may then be able to rework the affected help pages
I borrowed from: [Compatibility of Star/OpenOffice Basic to VBA] (https://jezzper.com/jezzper/discussions.nsf/0/3C030B7CC3F24D5FC1256F65002BC1B5) ..to write 'Option Compatible' and 'CompatibilityMode()' help content. It surely needs refreshment
(In reply to Alain Romedenne from comment #2) > For those no reading C++ like, can you descibe a bit more compMode() > arguments? Sorry, what is "compMode"?
Alain Romedenne committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/help/commit/8e0ace084d46ae8758b8f6ba36be31059f201537 tdf#145752 Correction to CompatibilityMode() help page