Created attachment 99783 [details] Writer file with the simple test case to reproduce the problem described Problem description: ==================== Writer will not support running a Macro from the IDE (or debugging) if the Macro references a dialog. Any calls to event handlers that reference the dialog object cause a run time error. How to reproduce the problem: ============================= 1. Open the uploaded file “LibreOffice-simple-dialog-test-20140525a.odt” 2. Select Tools --> Macros --> Organize Macros --> LibreOffice Basic ... 3. Select Library TestDialogs, Module TestCase1, Function RunDlg1 4. Run 'RunDlg1' 5. Push the Start button in the dialog (this fails with a run-time error) 6. Click OK to the run time error and click OK to exit the dialog 7. Select Tools --> Macros --> Run Macros ... 8. Run TestDialogs/TestCase1/RunDlg1 (this works as correctly and puts text in the text box) Current behavior: ================= -- This causes a run time error, “Basic Run Time Error! Object Variable Not set”. -- Any breakpoints (e.g. at beginning of TestDlg1Start) are ignored. -- The same behavior is observed in both Linux (fc20) and Windows (Win7/64, XP/32) and LibreOffice version 4.2.4.2 and 4.2.3.3) -- If however the same macro is run using the macro selector, the dialog runs correctly. -- I have confirmed that the problem is not present in Calc, Impress, Draw, and when the TestDialogs library is imported into [My Macros & Dialogs]. This was verified by exporting the “TestDialogs” library, and then importing it into a new document (for example Calc), then editing the newly imported library and running TestDialogs/TestCase1/RunDlg1 in the IDE directly. Breakpoints also worked correctly. Importing into a new Writer document did not work. Expected behavior: ================== -- Macro should run with dialog Start button putting text into the text box and the Clear button clearing text from the text box. -- It should be possible to set breakpoints in the event handlers. Based on further investigation, it appears as if running the function directly from the IDE (for Writer) creates a separate context when the dialog is running. Creating the dialog with CreateUnoDialog() will create an object in the global variable, but that variable will not be available during the event handlers. Therefor all dialog operations will fail because there is not a valid dialog object available and initialized for their use when referencing the dialog object in a helper function. Further, all global and static variables are separate and can be set and changed independently of one another. Increment a global variable in the event handlers and that change will not be seen once the dialog exits. Operating System: All Version: 4.2.3.3 release
I'm unable to reproduce problem with Version: 4.4.0.0.alpha0+ Build ID: 7d06a0601ddccc50185ea97fddcdf2ea39299096 TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-07-28_06:17:50 Please, could you test it with newer version?
Works fine on Windows, too. Win 7 64-bit 4.3.3.2 and Version: 4.4.0.0.alpha1+ Build ID: b7d8a58ff2698ffc6e22943f64aa97c5ea253bd9 TinderBox: Win-x86@42, Branch:master, Time: 2014-11-05_00:40:38