I tried adjusting this code, but it doesn't work (maybe it's Draw-Form-Specific, since the method "RemoveByName" is not supported in Calc dialogs) and gives me an error.
Here is the loop in which the *code to delete button* should fit:
Code: Select all
REM Previously defined: Elemento() as array containing the final part of the name of each control (the complete name is {"btn" & Elemento(i)}).
REM Previously defined: frmArchivio is my Dialog
Dim i As Integer, oButton As Object
For i=0 To UBound(Elemento)
oButton = frmArchivio.GetControl("btn" & Elemento(i))
'oButton.SetVisible(False) REM This is what I'm using now, it works for the eye but not for the mind, so I'd like to replace it with *code to delete button*
Next i
I guess it may have something to do with the "trialism" of each control (model, shape, view), but can't figure out how to solve it.
Thank you in advance, I'm learning much on this forum but still have a lot to learn,
Davide
SOLUTION:
Remove any Listener before disposing.
Code: Select all
oButton = frmArchivio.GetControl(bName)
oButton.removeActionListener(ElementListener)
oButton.Dispose