This morning using the IDE I set a break point on the offending line in the
AddingButton and a watch on
EnterBox. The watch revealed that
EnterBox was returning a Null value despite being declared Public. It then occurred to me that of course it's Null because the assignment was made before the Dialog was executed. So …
Code: Select all
Sub AddingButton
Dim textarea as string
EnterBox=oDlg.getControl("TextField1")
SaveBox=oDlg.getControl("ListBox1")
textarea = EnterBox.Text
SaveBox.additem(textarea, SaveBox.getItemCount)
EnterBox.Text = ""
End Sub
I added a couple of things.
additem(textarea,0) inserts the new entry at the top of the list,
additem(textarea, SaveBox.getItemCount) adds it to the bottom of the list.
Also the last line clears the Text Box, ready for a new entry.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11