Call method with digital Input

Hi there,

I get the DI value with the port 30003, i use a interface with an overide function to get the value of a DI, and call a method as below.

@Overide
public void StateDI5(boolean StateDI) {
if (StateDI && (TempStateDI != StateDI)) {
method();
}
TempStateDI = StateDI;
}

My problem is : the method call a set in the DataModel, and the UR error “UndoableChanges” comes. I don’t know how call this method to avoid the error. A test in Update UI create an error too.

If anyone have an idea,
Thanks,

Hi,
I solve my problem. To avoid the UR error “UndoableChanges”, i found a sample which say how to do :
sample

whenever using a setter on the Datamodel you need to wrap your call on the setter with the UndoRedoManager, like so:

public void toggleWeaving(final boolean weaving) {
    undoRedoManager.recordChanges(new UndoableChanges() {
        @Override
        public void executeChanges() {
            model.set("weaving", weaving);
        }
    });
}