Created attachment 138444 [details] Spreadsheet with macro demonstrating problem I have a spreadsheet with a button which runs a macro to insert a new row at the bottom of a table. It then selects a cell in that row. When a space is typed in to that cell, the macro runs again and adds another row. This does not occur if before typing I select another cell, then return. Attached is a file containing a macro, which demonstrates the problem. This did not occur before I updated to version 5.4.
I can also reproduce it in Versión: 4.4.0.3 Id. de compilación: de093506bcdc5fafd9023ee680b8c60e3e0645d7 Configuración regional: es_ES In which version did it work for you? I'm wondering if the macro is correctly programmed...
It first appeared in 5.4.2 which I installed on 21 Nov 2017. I do not remember what version I used before that - I do not install every update. It is a macro I have used for many years, but this does not mean it is correct. I would appreciate any constructive criticism of it.
I can reproduce it with LO 3.5.0 . It's not a bug - macro runs because button has a focus and space key act as push the button action. You can disable it - set Take Focus on click to false.
Created attachment 138453 [details] button properties
Thank you for diagnosing this and providing a solution. I was not aware that spacebar will activate a button with focus and, though I may have missed it, have not been able to find this in any documentation. However, the fact remains that I have seen a change of behaviour in more than one of my spreadsheets. Perhaps there has been a change in some default property somewhere. Thank you again.
I am afraid I must re-open this. While setting the control 'Take Focus on Click' to 'No' works immediately, if the sheet is saved, closed, and reopened (or reloaded), it has reverted to 'Yes'. I also suspect that, while this behaviour may have existed before when the space was the first character in the cell, it did not behave like this for an embedded space between printing characters.
(In reply to roger from comment #6) > I am afraid I must re-open this. > > While setting the control 'Take Focus on Click' to 'No' works immediately, > if the sheet is saved, closed, and reopened (or reloaded), it has reverted > to 'Yes'. > > I also suspect that, while this behaviour may have existed before when the > space was the first character in the cell, it did not behave like this for > an embedded space between printing characters. Hello, While setting the control 'Take Focus on Click' to 'No' works immediately, if the sheet is saved, closed, and reopened (or reloaded), it has reverted to 'Yes'. works for me in Version: 6.1.0.0.alpha0+ Build ID: 88f6ffeb9e0c0b942c2b0bc9d60af7bb7a6caaf8 CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3; Seems to be fixed in dev version. Please could you test with dev version? http://dev-builds.libreoffice.org/daily/master/ Thank you
I have tested this on Dev Version: 6.1.0.0.alpha0+ (x64), downloaded this morning. The program ran correctly immediately on loading, which implies to me that the 'take focus' flag was being set to 'Yes' when loaded by version 5.4, rather than when being saved. Since I do not wish to work with a development version, I will have to live with this problem until a new release resolves it. Thanks for your assistance.
I have made a work-around for this problem, until such time as it is resolved in an update. This may be of interest to others. I have set the following macro to run when my file is opened: Sub adjustButton Dim Sheet As Object Dim Doc as object Dim Form As Object Dim ctl As Object Doc = ThisComponent.CurrentController Sheet = Doc.activeSheet Form = Sheet.DrawPage.Forms.GetByIndex(0) Ctl = Form.getByName("New Entry") Ctl.FocusOnClick=false End Sub