Hello everyone! I am using LibreOffice Cal v22.214.171.124, on Lubuntu 16.04. I recorded a macro (I’m not good at writing code but CTRL+C/CTRL+V) that runs with a button that I defined as “Enabled: NO” (“General” tab, “Properties: Button” box). Problem: I need that button to change to “Enabled: YES” with a trigger that will be a cell that changes from FALSE to TRUE. Thanks for the time and help!
I don’t think you can get the functionality with a recorded macro.
But even talking of a written macro: How do you think to get the button to listen?
The other way round: The CheckBox needs to identify the button.
"Properties: Button" box?
Thank you for your time It is definitely better to extend a little more and explain my specific case: In sheet1 I have 6 cells that must be filled to feed a table (BD) that is in Sheet2. I created a button for a macro to automatically add a consecutive number and the date of the record in the DB, in addition to adding a row to the table and saving the document. It is needed that user cannot click on the button until all 6 cells have been filled. I have already created a function in an cell of the DB so that when all 6 cells are full it changes from false to true. Now what I need and have not been able to solve is the way for the button property to change from DISABLE to ENABLE (it is noticeable with the change of the font color from gray to black) as soon as that cell changes from false to true. I mean “Properties: Button” box, the dialog box by right clicking on the button in design mode, option “control …” general tab 3rd position right there is what I need to change from NO to YES
2/2 I agree when you say “don’t think you can get the functionality with a recorded macro…” It is inevitable that this solution involves writing code, the point is that I am not an expert in this matter and what I could do is look for the macro and open it in the IDE and change a specific part of the code to change that button property. Again, thanks a lot for your time…
Well, I wouldn’t claim to understand everything now.
However, you can change properties of one FormControl by code called by an event on the other. The one thing is to identify the object to act on by the object acting unambiguously.
The FormControlls are hosted by shapes for matters of positioning and the like, and thus in two ways embedded: The shape in the DrawPage, and the (logical) control in a Form. The Form in turn belongs to a collection (Forms). In all my cases I only used one Form.
For the purpose under discussion here, you can identify the button to act on by the Form object it belongs to (single in my case) and by its name. The name should best be assigned to the
.Tag property of the acting control.
Sub onChecBoxToggleButtonChange(pEvent) activeM = pEvent.Source.Model myButtonName = activeM.Tag theForm = activeM.Parent myButton = theForm.getByName(myButtonName) If activeM.State=0 Then myButton.Enabled = False myButton.Label = "Disabled" Else myButton.Enabled = True myButton.Label = "Enabled" End If End Sub
See attached example.
Hi Lupp! In the next few days I will resume this project, I am sure that your guide will be key to solving the problem. Thanks for your time