Page 1 of 1

[Solved] ListBox inside a table

Posted: Fri Mar 15, 2019 3:01 pm
by dionisio77
Hello, I'm new at OpenOffice.
I'm working with Writer, I have a table. Inside that table I have 2 ListBoxes A and B.
I want to populate the ListBox B based on the selected item of ListBox A.

The problem that I have is that i'm not able to get the ListBox control in the code inside the macro

Re: ListBox inside a table

Posted: Fri Mar 15, 2019 6:36 pm
by Villeroy
Base does not have any "lookup fields" like MS Access. Base tables and queries show raw data. List boxes belong to input forms where they are used to represent foreign keys with a visible string and another table's primary key as value. Search this forum for "cascading listbox".

Re: ListBox inside a table

Posted: Fri Mar 15, 2019 7:22 pm
by Zizi64
The problem that I have is that i'm not able to get the ListBox control in the code inside the macro
Please upload an ODF type sample file and your macro code here.

Re: ListBox inside a table

Posted: Fri Mar 15, 2019 9:16 pm
by Zizi64
OpenOffice: 6.0.6.2 on Windows 7
The 6.0.6.2 is not Apache OpenOffice (there is not such version yet). That is LibreOffice. Please update your signature in this forum.

Re: ListBox inside a table

Posted: Fri Mar 15, 2019 11:38 pm
by JeJe
Is the attached file what you're trying to do?

Re: ListBox inside a table

Posted: Mon Mar 18, 2019 2:11 pm
by dionisio77
JeJe wrote:Is the attached file what you're trying to do?
Yes, this is what i want! :super:
I was executing a macro in the lost focus event instead.

Thanks

Re: [Solved] ListBox inside a table

Posted: Mon Mar 18, 2019 2:33 pm
by JeJe
The focus events are for when the listbox as a whole loses or gains focus.

Note - the item status changed event will fire when the selection changes - so if you use the up and down arrow keys the item will be copied too.

You could use the Mouse Button Released event... maybe with some code to check if the item has already been copied if you don't want that happening more than once.