Bug 131317 - BUTTON WITH MACRO IN CALC HAS TO BE PUSHED TWICE TO DO ALL THE WORK.
Summary: BUTTON WITH MACRO IN CALC HAS TO BE PUSHED TWICE TO DO ALL THE WORK.
Status: RESOLVED DUPLICATE of bug 70883
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-12 21:20 UTC by romrodz77@outlook.com
Modified: 2020-05-15 21:13 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
just a way to quickly check the bug (30.53 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-03-12 21:21 UTC, romrodz77@outlook.com
Details

Note You need to log in before you can comment on or make changes to this bug.
Description romrodz77@outlook.com 2020-03-12 21:20:14 UTC
Description:
If I run a macro via a button, I have to press it 2 or more times to get all the macro done. If you do it via the macro editor, it works flawlessly.
I have attached a .ods with an example.

It deletes the cell value on some columns and then pastes the value from the "master" colum. The first time you press the button, it just deletes everything. The second or third time, it normally finishes the work.

Steps to Reproduce:
1. Open the attachment
2. Push the button. Everything will be deleted as it should.
3. Push the button another time (or more). It pastes the numbers as it should
4. Repeat it via the macro editor. It works from the firs time.

Actual Results:
After pushing the button once, it deletes the values in the columns with a pink cell above.
After the second or third time, you see that it pastes the value from the "DA" column.

Expected Results:
After pushing the button 1, it should have deleted the values and restore them.

Running the macro via the macro editor works just fine.


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
It may be related to this bug:
https://bugs.documentfoundation.org/show_bug.cgi?id=70883
The first line of the macro is the "workaround" suggested in this bug report.

Also, if you clic on a random cell after pushing the button you may have the expected result from the first time.

Versión: 6.4.1.2 (x64)
Id. de compilación: 4d224e95b98b138af42a64d84056446d09082932
Subprocs. CPU: 8; SO: Windows 10.0 Build 18363; Repres. IU: GL; VCL: win; 
Configuración regional: es-ES (es_ES); Idioma de IU: es-ES
Calc: CL
Comment 1 romrodz77@outlook.com 2020-03-12 21:21:28 UTC
Created attachment 158659 [details]
just a way to quickly check the bug
Comment 2 romrodz77@outlook.com 2020-03-12 21:30:53 UTC
If I add the workaround suggested in the mentioned bug (add the following line to the beginning of the macro: ThisComponent.CurrentController.Frame.ContainerWindow.setFocus) after every other line of code, it works.
Comment 3 Xisco Faulí 2020-03-18 18:45:07 UTC
Hello,
Did it work in the pass ?
Comment 4 romrodz77@outlook.com 2020-03-18 19:20:56 UTC
Hi, for sure it did not work with version 6.3.4 nor 6.2.

And I´m pretty sure that neither with an earlier version, but I was a noob so I thought it was my fault.
Comment 5 QA Administrators 2020-03-19 02:35:48 UTC Comment hidden (obsolete)
Comment 6 Buovjaga 2020-05-15 18:16:17 UTC
Works fine for me. A single click both deletes and pastes.
Maybe try with 6.4.3 and maybe deactivate opengl Tools - Options - LibreOffice - View - Use OpenGL for all rendering

Version: 6.4.3.2 (x64)
Build ID: 747b5d0ebf89f41c860ec2a39efd7cb15b54f2d8
CPU threads: 4; OS: Windows 10.0 Build 18362; UI render: default; VCL: win; 
Locale: fi-FI (fi_FI); UI-Language: en-US
Calc: threaded
Comment 7 romrodz77@outlook.com 2020-05-15 20:11:30 UTC
I believe it is this same bug:
Bug 70883 - "uno: copy" via the dispatcher does not work when a button has focus

The work I "solved" it is by pasting after every copy or paste line in a macro: 
ThisComponent.CurrentController.Frame.ContainerWindow.setFocus

And never had the problem again.

The bug is still there though...
Comment 8 Buovjaga 2020-05-15 20:25:12 UTC
Ok, good catch. Let's close as duplicate

*** This bug has been marked as a duplicate of bug 70883 ***
Comment 9 romrodz77@outlook.com 2020-05-15 21:13:38 UTC
So it is never fixed :D