Open tznind opened 2 years ago
There is many situations where we want a read only combo box and in this cases must not allowing adding more items to the source.
At the moment though the behaviour is inconsistent.
If you toggle the dropdown with the mouse then it doesn't force the Text to match the list. While if you don't toggle the list it does force the Text to match.
I guess there are 2 questions here:
Yes, I know it is inconsistent and should be corrected. I just wanted to draw attention to this detail. The author of this control just intended to create a search box when typing in TextField
, such as the AutoComplete
, and I proposed that it could be transformed into a Combobox
, so it is still inconsistent. Therefore, any improvement that can be done only brings benefits.
I guess there are 2 questions here:
1. Is it supposed to clear it or not?
If it's a read only and the typed text does not matching the source then should clear. If match then it must show the equivalents. If not read only then the text typed can stay in the
TextField
and if needed to add to the source then must have an action by the developer to do the addition.2. Why does not not clear it if you toggle the dropdown down/up with mouse first
Must have the same behavior as 1.
If it's a read only and the typed text does not matching the source then should clear.
How do you control if a ComboBox is 'read only'? Or are you talking about the way we want it to be rather than how it currently is?
How do you control if a ComboBox is 'read only'. Or are you talking about the way we want it to be rather than how it currently is?
That is. There is a ReadOnly
property on the ComboBox
that don't allow typing, I think, but the user may want to type to search for it. It's complicated :-)
Ok cool. Thanks for explaining.
In the interests of documenting the current system state. My current workaround to force the combo box not to clear search is just to toggle the box open/collapse manually in code.
var expand = typeof(ComboBox).GetMethod("Expand");
var collapse = typeof(ComboBox).GetMethod("Collapse");
expand.Invoke(combo, new object[0]);
collapse.Invoke(combo,new object[0]);
For personal preference I also like setting up this keybinding which makes the interaction feel more natural:
combo.AddKeyBinding(Key.CursorDown, Command.Expand);
For personal preference I also like setting up this keybinding which makes the interaction feel more natural:
combo.AddKeyBinding(Key.CursorDown, Command.Expand);
Does this not will conflict with theAddKeyBinding (Key.CursorDown, Command.LineDown);
?
Does this not will conflict with the
AddKeyBinding (Key.CursorDown, Command.LineDown);
?
It doesn't seem to. New keybindings overwrite old ones so theres no Exception. And I think because the input focus changes on Expand to the listbox it all just seems to work (i.e. it doesn't break up/down).
It doesn't seem to. New keybindings overwrite old ones so theres no Exception. And I think because the input focus changes on Expand to the listbox it all just seems to work (i.e. it doesn't break up/down).
Ah right, it will change the focus to the ListView
and are this view that will handle it, thanks for the clarification.
@tznind, @tig I think the ComboBox
should always clear if the typed text doesn't exist on the source.
If the ComboBox
is open by F4 or mouse the ListView
will always be focused and the first item or the selected item will be the current, updating the search text through the SelectedItemChanged
event when cursor keys are used. Pressing Key.Escape
undoes the changes and close the ListView
.
Typing the exactly text or navigation through cursor to the item, pressing Key.Enter
or tabbing will accept the change.
If ReadOnly
is enabled only the first letter will be used on search.
This is the iteration with a already selected item:
This is a ComboBox
alone in a Dialog
as the author initially created and it never isn't auto hide. I want to ask if is this to maintain or not?
The ListView
shouldn't be a subview of ComboBox
, but be subview of Application.Top to allow the drop-down always visible even if not fit the superview of the ComboBox
. Here a reason why it should:
I'm still working on this but i need answers to my questions above, please. I think the ComboBox
alone in a Dialog
can be dropped, because it will be unused, I think.
@tznind, @tig which ColorScheme do you prefer, 1 or 2? 1: 2:
I vote for 1.
1 does have more visual distinction and would look better on Dialogs where the background is grey by default. So yeah I agree 1.
@tznind, @tig I think the ComboBox should always clear if the typed text doesn't exist on the source.
I think this needs a setting e.g. DropDownStyle in WinForms:
We should distinguish visually the two also. If the user cannot enter any text then the text box should not recieve focus (only the list should get focused) and should be grey.
DropDown | 1 | Specifies that the list is displayed by clicking the down arrow and that the text portion is editable. This means that the user can enter a new value and is not limited to selecting an existing value in the list. When using this setting, the Append value of AutoCompleteMode works the same as the SuggestAppend value. This is the default style. |
---|---|---|
DropDownList | 2 | Specifies that the list is displayed by clicking the down arrow and that the text portion is not editable. This means that the user cannot enter a new value. Only values already in the list can be selected. The list displays only if AutoCompleteMode is Suggest or SuggestAppend. |
For reference:
A ComboBox where the options are fixed and you cannot type anything
A ComboBox where you can type anything
I achieved a similar effect using Menu but that was a bit of a hack:
There are many cases where you want the user to be able to enter their own value e.g.
User can enter any link they want
User could enter 7.5pt if they wanted
But likewise there are cases where you don't want the user to be able to select any option:
User can only pick from the selection
I'm still working on this but i need answers to my questions above, please. I think the
ComboBox
alone in aDialog
can be dropped, because it will be unused, I think.
Thanks for looking into this! I know we can make an awesome view here.
I'm still working on this but i need answers to my questions above, please. I think the ComboBox alone in a Dialog can be dropped, because it will be unused, I think.
Thanks for looking into this! I know we can make an awesome view here.
@tznind thanks for your reply. I'm really thinking about replacing the ComboBox alone in a Dialog
with the Simple
of the ComboBoxStyle
:
In this case the drop down list will be a subview of the ComboBox
and will always visible and it must positioned in a way that it must fit the ComboBox
dimensions, like the Dialog
, but without it. What do you think?
Was this fixed recently with the ComboBox PRs? If so, please close.
Describe the bug There is a wierd bug with ComboBox where typing text into the box that does not appear in its Source gets cleared when you leave the control. The issue goes away if you open then collapse the listbox first.
To Reproduce Steps to reproduce the behavior:
Workaround:
Expected behavior Text should not be cleared upon leaving the combo box.
Screenshots
Desktop (please complete the following information):