Skip to content

Commit 34afb52

Browse files
authored
Add confirmation dialog
1 parent ac099a2 commit 34afb52

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

EDSEditorGUI/DeviceODView.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,30 @@ private void ObjectSave()
532532
od.prop.CO_accessSRDO = AccessSRDO.no;
533533
}
534534

535-
for (ushort i = 1; i < od.parent.Nosubindexes; i++)
535+
// Default value
536+
bool setDefaultValueToAll = false;
537+
if (od.parent != null && od.Subindex > 0 && od.defaultvalue == "" && textBox_defaultValue.Text != "")
536538
{
537-
if (od.parent.subobjects[i].defaultvalue == "")
539+
DialogResult confirm = MessageBox.Show("Do you want to apply Default value to all unset subobjects?", MessageBoxButtons.YesNo);
540+
if (confirm == DialogResult.Yes)
538541
{
539-
od.parent.subobjects[i].defaultvalue = textBox_defaultValue.Text;
542+
setDefaultValueToAll = true;
540543
}
541544
}
545+
if (setDefaultValueToAll)
546+
{
547+
for (ushort i = 1; i < od.parent.Nosubindexes; i++)
548+
{
549+
if (od.parent.subobjects[i].defaultvalue == "")
550+
{
551+
od.parent.subobjects[i].defaultvalue = textBox_defaultValue.Text;
552+
}
553+
}
554+
}
555+
else
556+
{
557+
od.defaultvalue = textBox_defaultValue.Text;
558+
}
542559

543560
od.actualvalue = textBox_actualValue.Text;
544561
od.HighLimit = textBox_highLimit.Text;

0 commit comments

Comments
 (0)