Hello,
I have some dialog in Calc, and combobox on this dialog. How to deselect text in combobox? When I click on dropdown list, selected item will be appear in comboboxs "screen". This item is whole in blue colored background, because it is selected. This is problem to me, because this item and other items on dropdown list are now case sensitive to my touch mouse "roller" on my lap top, and without my knowledge I can change seleceted item. Please a little help.
How to deselect text in Combobox? (Calc, Basic)
How to deselect text in Combobox? (Calc, Basic)
Apache OpenOffice 4.1.0, Win
Re: How to deselect text in Combobox? (Calc, Basic)
Hello
Maybe you can set a property of the combobox. There is a property hide Selection. Also control^Home seems to work.
Romke
Maybe you can set a property of the combobox. There is a property hide Selection. Also control^Home seems to work.
Romke
LibreOffice 7.1.4.2 on openSUSE Leap 15.2
-
- Volunteer
- Posts: 1160
- Joined: Mon Oct 08, 2007 1:26 am
- Location: France, Paris area
Re: How to deselect text in Combobox? (Calc, Basic)
Are you sure you need a ComboBox ?
A Combobox is useful only when you need the facility to enter something else than one of the list items.
If you only need to select one of the items of the list, use a ListBox.
How to unselect all items at opening of the dialog :
A Combobox is useful only when you need the facility to enter something else than one of the list items.
If you only need to select one of the items of the list, use a ListBox.
How to unselect all items at opening of the dialog :
- With a ComboBox : in the IDE, properties, tab "General", property Text : clear this field.
- With a ListBox : in the IDE, properties, tab "General", property Selection : clear this field.
Bernard
OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
Re: How to deselect text in Combobox? (Calc, Basic)
Thanks for your replies. I tried to implement suggestions but they do not solved my problems. As I can see, to stopping roller of mause to acting as I described in first post, I must implement some code for mouse event, what is... well, maybe little difficult for me. Second, because I have search results in other textfields based from text in combobox, it is much easier to me to put command .setFocus() in next field in the end of code which serve for searching. When focus is out of combobx the roller could not make a problems. I think this is satisfactory solution for me.
But I still have this question: how to select/deselect text in combobox with code (basic)?
But I still have this question: how to select/deselect text in combobox with code (basic)?
Apache OpenOffice 4.1.0, Win
Re: How to deselect text in Combobox? (Calc, Basic)
I have the same problem. The code that I expect to do this would be , but running this does nothing. Interestingly, if you have a listbox with nothing selected and interrogate the property selectItemPos, it returns -1, which implies that should work. I have also tried which also just does nothing. My suspicion is that this is an oversight on the part of the developers. Certainly in VBA selecting a list position of -1 does the trick.
Code: Select all
listbox.selectItemPos(-1, true)
Code: Select all
selectItemPos(-1,true)
Code: Select all
selectItem("")
Openoffice 4.1.5 on Windows 10
Re: How to deselect text in Combobox? (Calc, Basic)
Tshep - have you tried setting the focus to another control? It could be a control that doesn't do anything and is outside the visible area of the dialog so hidden.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: How to deselect text in Combobox? (Calc, Basic)
Tshep, ara you using one of the existing object inspection tools (Xray, MRI)? You can display all of the available properties and methods (and others) by usage of these tools.
Please upload your ODF type sample file here with the embedded macro routine what you tried to create.
Please upload your ODF type sample file here with the embedded macro routine what you tried to create.
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.
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.
Re: How to deselect text in Combobox? (Calc, Basic)
Hello Tibor, sorry to have been away so long. I don't use xray or MRI - I've got my own routine that I use to inspect properties and methods. My file is too long to upload, but here's what you can do to replicate the problem. Create a dialog, drop a listbox and button on it. Add a few entries to the listbox list (apples, oranges, apricots, bananas etc). Set the button to run a macro when clicked and add these lines to the macro (say you called it "test"):
sub test(e as event)
'see what itemPos is with no selection at startup, then with an item selected
msgbox (e.Source.Context.getControl("ListBox1").selectedItemPos)
e.Source.Context.getControl("ListBox1").selectItemPos(-1,true)
end sub
What you will see is that at startup, no items selected, itemPos is -1. Go ahead and select an item. You will see it's position as selected. Click the button. Nothing happens. The item remains selected, even if you move the focus to any other control on the dialog. In fact, you can do nothing at all to un-select an item in the box short of restarting the dialog. Logically, setting itemPos to -1 should do this.
- Tshep
sub test(e as event)
'see what itemPos is with no selection at startup, then with an item selected
msgbox (e.Source.Context.getControl("ListBox1").selectedItemPos)
e.Source.Context.getControl("ListBox1").selectItemPos(-1,true)
end sub
What you will see is that at startup, no items selected, itemPos is -1. Go ahead and select an item. You will see it's position as selected. Click the button. Nothing happens. The item remains selected, even if you move the focus to any other control on the dialog. In fact, you can do nothing at all to un-select an item in the box short of restarting the dialog. Logically, setting itemPos to -1 should do this.
- Tshep
Openoffice 4.1.5 on Windows 10