Re: Strange Undo/Redo behaviour
Posted: Fri Aug 07, 2020 7:49 am
Hi
I have the same problem and have posted about it in the forum:
viewtopic.php?f=9&t=1066
Some workarounds:
I don't use toggle buttons anymore, I use normal buttons and manage my own state.
In case I have tabs (for two oscillators in the same UI) I make sure I have trigger undo / redo actions when changing tabs.
In some instances I use UserProperties to suppress notifications (example below for a text label).
To apply a programmatic change and allow me to suppress a notification I use this function:
void SetSuppressNotification(VoltageLabel label, String updatedValue) {
if (!label.GetText().equals(updatedValue)) {
label.SetUserProperty("SuppressNotification", 1);
label.SetText(updatedValue);
}
}
In notify I check if the notification is suppressed:
case Label_Changed: // The text of an editable text control has changed
{
if (component == delayTimeInput) {
if (!CheckSuppressNotification((VoltageLabel)component)) {
String tempString = (String)object;
int tempInt = Integer.parseInt(tempString);
SetDelayTime(tempInt, false, false);
}
}
}
The helper function here:
boolean CheckSuppressNotification(VoltageLabel label) {
boolean returnValue = false;
Object updateUIPropertyValue = label.GetUserProperty("SuppressNotification");
if (updateUIPropertyValue != null && (int)updateUIPropertyValue == 1) {
label.SetUserProperty("SuppressNotification", 0);
returnValue = true;
}
return returnValue;
}
Maybe not an answer to your question but might give you some ideas.
Would be great to get some feedback from Cherry Audio on this but they are not very active on this forum.
Regards
Tobias
I have the same problem and have posted about it in the forum:
viewtopic.php?f=9&t=1066
Some workarounds:
I don't use toggle buttons anymore, I use normal buttons and manage my own state.
In case I have tabs (for two oscillators in the same UI) I make sure I have trigger undo / redo actions when changing tabs.
In some instances I use UserProperties to suppress notifications (example below for a text label).
To apply a programmatic change and allow me to suppress a notification I use this function:
void SetSuppressNotification(VoltageLabel label, String updatedValue) {
if (!label.GetText().equals(updatedValue)) {
label.SetUserProperty("SuppressNotification", 1);
label.SetText(updatedValue);
}
}
In notify I check if the notification is suppressed:
case Label_Changed: // The text of an editable text control has changed
{
if (component == delayTimeInput) {
if (!CheckSuppressNotification((VoltageLabel)component)) {
String tempString = (String)object;
int tempInt = Integer.parseInt(tempString);
SetDelayTime(tempInt, false, false);
}
}
}
The helper function here:
boolean CheckSuppressNotification(VoltageLabel label) {
boolean returnValue = false;
Object updateUIPropertyValue = label.GetUserProperty("SuppressNotification");
if (updateUIPropertyValue != null && (int)updateUIPropertyValue == 1) {
label.SetUserProperty("SuppressNotification", 0);
returnValue = true;
}
return returnValue;
}
Maybe not an answer to your question but might give you some ideas.
Would be great to get some feedback from Cherry Audio on this but they are not very active on this forum.
Regards
Tobias