[Solved] ListBox inside a table

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
dionisio77
Posts: 3
Joined: Fri Mar 15, 2019 2:54 pm

[Solved] ListBox inside a table

Post 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
Last edited by dionisio77 on Mon Mar 18, 2019 2:14 pm, edited 1 time in total.
Openoffice 4.1.2 on Windows 7
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: ListBox inside a table

Post 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".
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: ListBox inside a table

Post 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.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: ListBox inside a table

Post 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.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: ListBox inside a table

Post by JeJe »

Is the attached file what you're trying to do?
Attachments
listbox example.odt
(11.89 KiB) Downloaded 198 times
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
dionisio77
Posts: 3
Joined: Fri Mar 15, 2019 2:54 pm

Re: ListBox inside a table

Post 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
Openoffice 4.1.2 on Windows 7
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: [Solved] ListBox inside a table

Post 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.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply