Slate and Transactions for Undo/Redo system


I have a custom detail panel. For now let’s just say I have a Checkbox on it that simply states whether my functionality is Enabled.

The Checkbox is made directly in slate.

Checkbox.OnCheckedStateChange has a delegate bound, as per usual.

When I create an FScopedTransaction, I have it in the delegate function. However when I undo, it completed the scoped transaction actions but not the initial press.
Obviously this is because the scope doesn’t start before the press it initiated. My problem is I cannot seem to figure out where the transaction would go to capture the initial press.

Any help here is much appreciated.

RF_Transactional flag can only be applied to UObjects (UProperty, UClass, etc).

hmm so Slate objects don’t deal with any transactional stuff at all? Would that mean they literally drop control off to the UPROPERTY (which I presume handles transactions automatically). ?

If this is the case, then do you think I would have to keep track of the associated state of the variable manually and maybe delegate from its property change? (by that I mean bind to some event like OnUndo() or something and manually update it in both my data and the detail panel?)

When building Slate stuff for the Editor you should follow engine standards and use Property Handles anywhere possible:

And yes, while in Editor, mark UObject transactional and let the built-in Undo system deal with it.

Ahh I couldn’t do that in my case. I have a seperate object that tracks states of detail panels and keeps an array which is manually serialized. I’ll figure something out I guess. thanks.

I’m having a similar query as yours. Were you able to implement the OnUndo/OnRedo callbacks?