Universal Robots Forum

Save Program greyed out - UndoRedo

Hi,
I have a program node composed of two buttons and a textfield. Whenever I press the buttons their callback is invoked storing some parameters inside the DataModel.

undoRedoManager.recordChanges(new UndoableChanges() {
			@Override
			public void executeChanges() {
				model.set("param", value);
			}
		});

The data is stored and I can press the save icon (floppy disk). The problem happens when I change the textfield value the onOk() callback is invoked and the param is stored on the dataModel but the save icon is still greyed out and I can’t trigger the program save.
I tried on the simulator and it works there. Any suggestion?

Thank you

2 Likes

@federico.vendramin
I’m having the same issue with a JTextField, did you ever find a solution?

The other odd thing is that undo/redo buttons don’t see the setting of the text of a JTextField.
In a URCap of mine I use both an KeyboardInputCallback<Integer> and a KeyboardInputCallback<Double>. The save button and undo/redo buttons both notice the change when an integer keyboard is called, but not when a double keyboard is called.
The code for both keyboards is identical, here is the code from onOk for both:

Double keybaord:

@Override
public void onOk(Double, value)
{
    myView.getDoubleTextField().setText(Double.toString(value));
    model.set("double", value);
}

Integer Keyboard:

@Override
public void onOk(Integer, value)
{
    myView.getIntegerTextField().setText(Integer.toString(value));
    model.set("integer", value);
}

Certainly from this code I suspect that this is a bug with how polyscope triggers undoable changes?
Though it is worth noting that model.set(String, value) is still triggering isDefined() just fine

EDIT: putting an undoredoManager inside onOk() has no effect.

Hello, Sam.
Unfortunately I wasn’t able to find one.

Maybe someone can investigate this further.

Thanks,
Federico