Hi,
I have a textbox and a list of values in a listbox. Regarding of the
input of the typed in value of the textbox the list will be filtered.
I've managed this so far, but it's not working as expected. For
example you typed in AAA then every value in the list which does not
contain AAA will be removed. But when you mark all the AAA and type
instead a B then my function will search for the string AAAB instead
of only B. This happens because I am building this string on the
keypresshandler, but if i do not build it like this I do not get
actual textfield value and the new typed in character...
Does anybody understand my problem and have a suggestion ?
thanks
public void onKeyPress(KeyPressEvent event) {
filterFormList(filterText.getText().trim() +
event.getCharCode())
}
public void filterFormList(String matchThis){
ArrayList<Integer> toDeleteList = new ArrayList<Integer>();
for (int i = 0; i < formList.getItemCount(); i++){
System.out.println("checking if " + matchThis
+ " is found in " +
formList.getItemText(i));
formList.getItemText(i).contains(matchThis);
if (formList.getItemText(i).contains(matchThis)){
System.out.println("found it---adding index " +
i + " to delete
list");
toDeleteList.add(new Integer(i));
}
else{
System.out.println("no match");
}
}
for (Integer integer: toDeleteList){
System.out.println("removing item " +
formList.getItemText
(integer.intValue()));
formList.removeItem(integer.intValue());
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---