# Save Program greyed out - UndoRedo

**URL:** <https://forum.universal-robots.com/t/save-program-greyed-out-undoredo/2911>\
**Category:** URCap Development\
**Tags:** datamodel, keyboard, undo-redo\
**Created:** [October 12, 2018, 2:02pm UTC](https://forum.universal-robots.com/t/save-program-greyed-out-undoredo/2911 "2018-10-12T14:02:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon57702353](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@anon57702353](https://forum.universal-robots.com/u/anon57702353)\
**Post date:** [October 12, 2018, 2:02pm UTC](https://forum.universal-robots.com/t/save-program-greyed-out-undoredo/2911/1 "2018-10-12T14:02:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sam.verity-hilton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sam.verity-hilton/32/6046_2.png) [@sam.verity-hilton](https://forum.universal-robots.com/u/sam.verity-hilton)\
**Post date:** [January 31, 2019, 8:33am UTC](https://forum.universal-robots.com/t/save-program-greyed-out-undoredo/2911/2 "2019-01-31T08:33:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sam.verity-hilton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sam.verity-hilton/32/6046_2.png) [@sam.verity-hilton](https://forum.universal-robots.com/u/sam.verity-hilton)\
**Post date:** [January 31, 2019, 9:43am UTC](https://forum.universal-robots.com/t/save-program-greyed-out-undoredo/2911/3 "2019-01-31T09:43:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon57702353](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@anon57702353](https://forum.universal-robots.com/u/anon57702353)\
**Post date:** [January 31, 2019, 2:53pm UTC](https://forum.universal-robots.com/t/save-program-greyed-out-undoredo/2911/4 "2019-01-31T14:53:46Z")

</div>

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

Maybe someone can investigate this further.

Thanks,  
Federico

---

<div class="post-metadata">

**Author:** ![Savoia](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/savoia/32/4844_2.png) [@Savoia](https://forum.universal-robots.com/u/Savoia)\
**Post date:** [January 27, 2021, 12:47am UTC](https://forum.universal-robots.com/t/save-program-greyed-out-undoredo/2911/5 "2021-01-27T00:47:41Z")

</div>

Closed on January 27, 2021, 12:47am UTC


