RadCheckedDropDownList Filter value by contains text - winforms

I use RadCheckedDropDownList in my windows form application
when I filter items by search value return items has started with text , but I want to return items that contain the text.
how to change filter mode from StartWith to Contains

Related

Codename One - get selected text from AutoComplete

How can I get the complete selected text from an AutoComplete TextField?
If I use getText(), I only get the few letters the user has input so far.
Example: I write "flo" and then select "Flowers" from the list, but getText() gives me "flo"
AutoCompleteTextField auto = new AutoCompleteTextField(arrayWithNames);
auto.setMinimumLength(4);
auto.addListListener((ActionEvent evt1) -> {
String lookedFor = auto.getText();
Hashtable<String,Object> match[] = findMatch(lookedFor);
if(hMatch.length>0){
contElements.removeAll();
for (Hashtable<String, Object> Match1 : match) {
...
...//fill the Container with the names found
...
}
}
});
How it works
I am using the AutoComplete TF as a search button.
I have an array with all the names in my list.
Then I populate the Auto with the array.
The user selects a name from the Auto and then I search the value that is being "lookedFor" using the findMatch(). It returns a new array with the found entries.
I need the complete name from the list so I can use the findMatch() method, but when I use getText() from the Auto, it only returns the letters the user entered, and not the whole name, so my method does not work, since I am comparing whole Strings.
(I am using the Auto because it is very convenient if people remember only a part of the name they are looking for)
If you subclass AutoCompleteTextField you can access the selected text internally via getSuggestionModel().getItemAt(getSuggestionModel().getSelectedIndex()). Now you can define a public getter method getSelectedText() or something on your derived class.
I am not sure you are using the AutoCompleteTextBox correctly.
The entire purpose of the AutoCompleteText box is to help you assist the user in selecting from a list of valid requests,
You should not be getting the value of getText() until the user is ready to submit the form where the AutoCompleteTB is located.
This WILL help if you haven't already looked here:
https://www.codenameone.com/javadoc/com/codename1/ui/AutoCompleteTextField.html#getPropertyTypes--
Good luck!

Kendo Grid Filter - Problems with check marks

I'm using a Grid Filterable (mode = row) and I have discovered that it does not filter as I expected in a Text Field.
If I look for Maria i would like to receive all names with Maria, María, Marïa...
I want to use it without write check marks.
Is it possible?

Excel VBA Combo Box returning index not value

I've got a combo box set up in Excel 2007 which gathers its list items from another sheet. When I try to access the value of the selected item through a macro all I am returned is the index value and not the actual value.
DateDropDown = Sheets("Input Form").Shapes("APPDateDropDown").ControlFormat.Value
The value in the combo box is listed as "Jan-12" but when I run the code above DateDropDown is returned as 37 (the index of the item).
How do I get it to return the value "Jan-12"?
With Sheets("Input Form").Shapes("APPDateDropDown")
DateDropDown = .ControlFormat.List(.ControlFormat.ListIndex)
End With

SmartGWT Dynamic Form edit record with boolean values

I've got following problem using SmartGWT 2.4:
we are having a DynamicForm showing several static text fields (so the form is in readonly mode). The form uses a datasource in the background and our own FormItemFactory to create proper form items based on our meta data. Some of the form items contain boolean values displayed as strings: like 'isHidden': false or 'canShow': true.
by user action (button click) we need to switch the form to edit mode.
We do it in following way:
we first gather the form values as rec = form.getValuesAsRecord() getting a Record object
then we create a new dynamic form and set into it the same datasource as original has
then we call the newForm.editRecord(rec) method of newly created dynamic form
This way the form static values are shown as editable input fields. However the problem is with those boolean values. They are correctly transformed into check boxes but all of them are checked by default.
I think that the string values 'false' or 'true' are not parsed into boolean values and set as value for respective check box item.
Can I somehow influence this process? I tried to provide an anonymous implementation of FormItemValueParser to CheckboxItem but it turns out to be use only by free text form items.
I'll be really thankful for any given hint.
Try setting the value explicitly to the formItem with record.getAttributeAsBoolean("formItemName")
BooleanItem boolItem = new BooleanItem("boolname");
DynamicForm form = new DynamicForm();
form.setItems(boolItem);
//Get record
Record rec = form.getValuesAsRecord();
boolItem.setValue("boolname",rec.getAttributeAsBoolean("boolname"));

ListBox CollectionViewSource.Filter method question

I have a listbox defined in XAML and I filter its items using the following code from text obtained from a textbox:
if (list.Items.Count > 0)
{
CollectionViewSource.GetDefaultView(list.Items).Filter =
new Predicate<object>((item) => {
string valtoCheck = item.ToString();
return valtoCheck.StartsWith(filterText,
StringComparison.CurrentCultureIgnoreCase);
});
}
Everything works fine, except in the case where the filter finds no items matching the criteria.
ex. Lets say I have 4 items in the list : Rob,Bob,Andy,John.
When I enter Ro, the list filters accordingly (shows rob).
When I enter b, the list gets filtered appropriately (shows bob).
However, if i enter z (the target list becomes empty), I get an empty list which is correct; but then List.Items.Count is set to zero from that point on. The list becomes empty. I would assume that typing a replacement b should show me Bob but it does not; the list's items are set to empty as soon as I enter text that is not contained in any of the items in the listbox!
Am I missing something here?
I dont see you cannot eliminate the if condition check and just have
CollectionViewSource.GetDefaultView(list.Items).Filter =
new Predicate<object>((item) => {
string valtoCheck = item.ToString();
return valtoCheck.StartsWith(filterText,
StringComparison.CurrentCultureIgnoreCase);
});
It's hard to tell without seeing more of the surrounding code but issues like this are usually related to Refresh not being called at the right times. It also looks like you may be reassigning the Filter over and over instead of setting it once and refreshing when the filter text changes.

Resources