[Solved]Dialog ctrl ComboBox show matching autocomplete list

Creating a macro - Writing a Script - Using the API

[Solved]Dialog ctrl ComboBox show matching autocomplete list

Postby JulianR » Tue Jan 22, 2019 3:22 pm

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
JulianR
 
Posts: 20
Joined: Mon Mar 12, 2018 9:41 am

Re: Dialog control ComboBox show matching autocomplete list

Postby JeJe » Tue Jan 22, 2019 5:09 pm

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

Re: Dialog control ComboBox show matching autocomplete list

Postby Villeroy » Tue Jan 22, 2019 11:01 pm

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, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26980
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Dialog control ComboBox show matching autocomplete list

Postby JulianR » Wed Jan 23, 2019 11:56 am

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
JulianR
 
Posts: 20
Joined: Mon Mar 12, 2018 9:41 am

Re: Dialog control ComboBox show matching autocomplete list

Postby JeJe » Thu Jan 24, 2019 12:33 am

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 35 times
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 552
Joined: Wed Mar 09, 2016 2:40 pm

Re: Dialog control ComboBox show matching autocomplete list

Postby JeJe » Sun Feb 10, 2019 9:22 pm

Solution here:

viewtopic.php?f=39&t=74909

Code: Select all   Expand viewCollapse view
dlg.getcontrol("ComboBox1").AccessibleContext.doAccessibleAction(0)
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 552
Joined: Wed Mar 09, 2016 2:40 pm

Re: Dialog control ComboBox show matching autocomplete list

Postby JulianR » Mon Feb 11, 2019 10:46 am

Thank you JeJe, it works flawlessly.
Apache OpenOffice 4.1.1 / LibreOffice 5.3 / LibreOffice 6.0 / LibreOffice 6.2 on Windows 7
JulianR
 
Posts: 20
Joined: Mon Mar 12, 2018 9:41 am


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests