Dropdown = Yes
Item(s) not selected. How to dropdown the listbox with macro?
If the goal is to use a macro to “click” on the down arrow that expands the list, then there is a long way using the doAccessibleAction method . It is hardly advisable.
Yes, that’s right.
How can I adapt this code to the dialog listbox?
sub Drop_down_Listbox
oController = thiscomponent.CurrentController
oListbox = thisComponent.drawpage.forms.getbyname("MainForm").getbyname("myListbox")
oListboxControl = oController.getControl(oListbox)
oListboxControl.AccessibleContext.doAccessibleAction(0)'drops it down
end sub
@sokol92, thanks for the hint. It works.
If g_oDlg.getControl("lstGroups").SelectedItem = "" Then
MsgBox "You need to select a group from the list.", MB_ICONEXCLAMATION, "Group Selection"
g_oDlg.getControl("lstGroups").AccessibleContext.doAccessibleAction(0) 'drops it down
Exit Sub
End If