Hi. I could really use your help.
I've used code I found in these forums (I think it was Erel's) to create a combo box that could update its list as the user types in something in the box (immediate search). The code calls a Java method that must be added to that module:
It worked perfectly fine, but now I have a class module in which such a combo box exists. But when I run the App, I get the error message:
error: non-static variable ba cannot be referenced from a static context
ba.raiseEventFromUI(box, EventName.toLowerCase() + "_textchanged", newValue);
I tried removing the static keyword, but that causes another problem: when that class module is opened twice, the content for the combo boxes gets mixed up, naturally.
Any ideas how I can fix this??
Thanks a lot in advance.
I've used code I found in these forums (I think it was Erel's) to create a combo box that could update its list as the user types in something in the box (immediate search). The code calls a Java method that must be added to that module:
B4X:
#If Java
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.ComboBox;
import anywheresoftware.b4a.BA;
public static void AddTextChanged(final ComboBox box, final String EventName) {
box.getEditor().textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable,
String oldValue, String newValue) {
ba.raiseEventFromUI(box, EventName.toLowerCase() + "_textchanged", newValue);
}
});
}
#End If
It worked perfectly fine, but now I have a class module in which such a combo box exists. But when I run the App, I get the error message:
error: non-static variable ba cannot be referenced from a static context
ba.raiseEventFromUI(box, EventName.toLowerCase() + "_textchanged", newValue);
I tried removing the static keyword, but that causes another problem: when that class module is opened twice, the content for the combo boxes gets mixed up, naturally.
Any ideas how I can fix this??
Thanks a lot in advance.