You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey,
im really impressed by this API, but i have one issue:
im using a CodeArea and add/replace text from a popup window like in ide´s, that open at the caret.
After a replacement of a selection, i want to set the caret to a specific location.
Thats not the problem.
It goes to the location, i have set. The problem is, if i type a letter the caret jumps to another location below.
The caret index is (sout) the same.
(By clicking the location of the caret before typing, solve it)
Here is the setup method for the popup, maybe needed:
private void setList() {
if(win == null) {
win = new Popup();
chooseView = new ListView();
}
ArrayList<ApiCondition> conditions = skUnity.getConditions();
ArrayList<ApiEffect> effects = skUnity.getEffects();
ArrayList<ApiEvent> events = skUnity.getEvents();
ArrayList<ApiExpression> expressions = skUnity.getExpressions();
ArrayList<ApiType> types = skUnity.getTypes();
for (int i = 1; i != conditions.size(); i++) {
chooseView.getItems().add(conditions.get(i).getId() + " Condition");
}
for (int i = 0; i != effects.size(); i++) {
chooseView.getItems().add(effects.get(i).getId() + " Effect");
}
for (int i = 0; i != events.size(); i++) {
chooseView.getItems().add(events.get(i).getId() + " Event");
}
for (int i = 0; i != expressions.size(); i++) {
chooseView.getItems().add(expressions.get(i).getId() + " Expression");
}
for (int i = 0; i != types.size(); i++) {
chooseView.getItems().add(types.get(i).getId() + " Type");
}
chooseView.getItems().addAll(new Supers().getSupervArray());
chooseView.setPrefSize(180, 200);
Tab tab = codeTabPane.getSelectionModel().getSelectedItem();
CodeArea area = (CodeArea) tab.getContent();
win.getContent().add(chooseView);
area.setPopupWindow(win);
area.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
if (showList) {
win.hide();
chooseView.setVisible(false);
showList = false;
}
}
});
}
Here is the method, that toggles the list(i already tried something another user, wrote, to move the caret):
@liz3 I haven't looked with that much depth into your code, but you might want to try using moveTo(caretPosition) instead of positionCaret, as latter method is actually supposed to be package-private.
liz3
changed the title
Problem with caret position after text replacement
Problem with caret position after text replacement(FIXED)
Sep 2, 2016
Hey,
im really impressed by this API, but i have one issue:
im using a CodeArea and add/replace text from a popup window like in ide´s, that open at the caret.
After a replacement of a selection, i want to set the caret to a specific location.
Thats not the problem.
It goes to the location, i have set.
The problem is, if i type a letter the caret jumps to another location below.
The caret index is (sout) the same.
(By clicking the location of the caret before typing, solve it)
Here is the setup method for the popup, maybe needed:
Here is the method, that toggles the list(i already tried something another user, wrote, to move the caret):
Pressing a key, triggers the toggle method, which checks and setup if needed.
Can someone help me out?
Liz3
The text was updated successfully, but these errors were encountered: