[Solved]Dialog ctrl ComboBox show matching autocomplete list

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
JulianR
Posts: 26
Joined: Mon Mar 12, 2018 9:41 am

[Solved]Dialog ctrl ComboBox show matching autocomplete list

Post by JulianR »

Hi!

My users want a ComboBox that shows a list of matching items as the user types in the name of item.

Is there a way to force ComboBox dialog control to display the list of items programatically? I can't seem to find any such method or property with xray when inspecting one.

I can make a Function, that will generate necessary String Item List, but that alone without auto displaying the narrowed down list makes little sense.
Last edited by JulianR on Mon Feb 11, 2019 10:48 am, edited 1 time in total.
Apache OpenOffice 4.1.1 / LibreOffice 5.3 / LibreOffice 6.0 / LibreOffice 6.2 on Windows 7
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: Dialog control ComboBox show matching autocomplete list

Post by JeJe »

I tried myself to look if I could open an OO combobox dropdown from OOBasic but failed to find a way.
It can be opened with the keyboard rather than the mouse by pressing Alt + the down arrow.
You could try a combination of textbox + listbox instead of a combobox.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Dialog control ComboBox show matching autocomplete list

Post by Villeroy »

Use a multi-line list box (drop down property = No) and tell your users that you can type into a focussed list box.
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
JulianR
Posts: 26
Joined: Mon Mar 12, 2018 9:41 am

Re: Dialog control ComboBox show matching autocomplete list

Post by JulianR »

Thanks guys, I'll give those options a try.
Apache OpenOffice 4.1.1 / LibreOffice 5.3 / LibreOffice 6.0 / LibreOffice 6.2 on Windows 7
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: Dialog control ComboBox show matching autocomplete list

Post by JeJe »

It might be possible to get the combo to open by simulating a mouse click with Windows api calls (like mouse_event) - though I couldn't manage that.

Another option would be to make something combo-like using a second dialog as your dropdown - see attached example. As you're on Windows, for speed, I've used code from VBHelper to change the window style of the 'dropdown' dialog to remove the titlebar.

http://www.vb-helper.com/howto_change_window_style.html

An OO dialog without titlebar can be created by modifying this code:
viewtopic.php?f=21&t=92867
Attachments
mock windows combo.odt
(13.8 KiB) Downloaded 201 times
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: Dialog control ComboBox show matching autocomplete list

Post by JeJe »

Solution here:

viewtopic.php?f=39&t=74909

Code: Select all

dlg.getcontrol("ComboBox1").AccessibleContext.doAccessibleAction(0)
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JulianR
Posts: 26
Joined: Mon Mar 12, 2018 9:41 am

Re: Dialog control ComboBox show matching autocomplete list

Post by JulianR »

Thank you JeJe, it works flawlessly.
Apache OpenOffice 4.1.1 / LibreOffice 5.3 / LibreOffice 6.0 / LibreOffice 6.2 on Windows 7
Post Reply