Hello, I'm creating a new script but I have a problem with app.beginUndoGroup.
So in this script I've a button, after pressing it, the script creates some layers and the button turn from enabled to disabled.
The script is something like this:
........... var res = "Group {\ orientation: 'column' ,\ alignment: ['fill','top'],\ buttonsGrp: Group {\ createLayersBtn: Button{text:'Create layers'},\ }\ }\ ............ main.grp.buttonsGrp.createLayersBtn.enabled = true; main.grp.buttonsGrp.createLayersBtn.onClick = function() { app.beginUndoGroup("Add layers") //CREATE SOME LAYERS// ...... main.grp.buttonsGrp.createLayersBtn.enabled = false; app.endUndoGroup(); }
It works fine: after creating some layers the button is disabled, but if I make an undo, all layers are deleted but the button doesn't turn to enabled.
How can I fix it? thank you in advance!