In BASIC macros, the MsgBox function takes a parameter which specifies which buttons to display, and returns an integer indicating which button was pressed. Constants for these values are documented at https://help.libreoffice.org/6.4/en-US/text/sbasic/shared/03010102.html However the contstants MB_ABORTRETRYCANCEL and IDIGNORE are not defined and referencing them returns an empty value, or if Option Explicit is used, a runtime error. However the mix-up is more complicated: MB_ABORTRETRYCANCEL (value 2) is documented to "display Abort, Retry, and *Ignore* buttons" (not "Abort"), and does so. So the name of the constant is misleading. Sure enough, there does exist a symbol MB_ABORTRETRYIGNORE defined by the runtime system with value 2. So that should be documented, not ...CANCEL. If MB_ABORTRETRYIGNORE is used and the user clicks the "Ignore" button, then 5 is returned. However there is no documented constant for 5 except for IDIGNORE, which is missing. ==== SUMMARY: 1. MB_ABORTRETRYCANCEL in the documentation should be replaced with MB_ABORTRETRYIGNORE 2. IDIGNORE, which appears to be correctly documented, needs to be defined so it can be used. (Check: Is there a different symbol defined for return value 5?) === I will attach a regression script which tests all the documented constants. STEPS TO REPRODUCE: 1. start calc or open any spreadsheet 2. Tools->Macros->Edit Macros 3. Navigate to 'Module1' (or any available module) and past in the attached test code. Do NOT use "Option Explicit" (or else run-time errors will occur rather than error messages from the tester). 4. Put cursor in "TestMain" and Run->Run (or press F5)
Created attachment 177697 [details] Regression test for the constants (see STEPS TO REPRODUCE)
About MB_ABORTRETRYCANCEL, it's been fixed with ebc9cb8ae21c5930887cf27e1dbbe2c7493f3e30 Update git submodules * Update helpcontent2 from branch 'master' to 84b6347bd05d0a7e5a7ea5075702f5f2892b5c1f - tdf#146299: MsgBox can have the parameter MB_ABORTRETRYIGNORE not MB_ABORTRETRYCANCEL This link https://help.libreoffice.org/7.3/en-US/text/sbasic/shared/03010102.html shows it's ok. Mike: ok to add IDIGNORE part? In comparison, git grep -n IDABORT gives: basic/source/inc/rtlproto.hxx:73:extern void SbRtl_IDABORT(StarBASIC * pBasic, SbxArray & rPar, bool bWrite); basic/source/runtime/props.cxx:108:void SbRtl_IDABORT(StarBASIC*, SbxArray& rPar, bool) { rPar.Get(0)->PutInteger(3); } basic/source/runtime/stdobj.cxx:452:{ u"IDABORT", SbxINTEGER, CPROP_, SbRtl_IDABORT }, wizards/source/scriptforge/python/scriptforge.py:633: IDABORT, IDCANCEL, IDIGNORE, IDNO, IDOK, IDRETRY, IDYES = 3, 2, 5, 7, 1, 4, 6 I can submit a patch with IDIGNORE by using these, what do you think?
(In reply to Julien Nabet from comment #2) Please do - it would be great!
(In reply to Mike Kaganski from comment #3) > (In reply to Julien Nabet from comment #2) > > Please do - it would be great! Thank you for your quick feedback! Done here: https://gerrit.libreoffice.org/c/core/+/128780
Julien Nabet committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/c1205c1cf6e08d94e6e2e2753679d99bc1842ca0 Related tdf#146909: add missing IDIGNORE in Basic It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Patch for 7.3 branch waiting for review there: https://gerrit.libreoffice.org/c/core/+/128685
Julien Nabet committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/6e6fcc5ed141b25acee31686ee8792b0507e75c5 Related tdf#146909: add missing IDIGNORE in Basic It will be available in 7.3.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.