From 14f069597a61bda5eed068b2dad814e921ed019c Mon Sep 17 00:00:00 2001 From: Robin Cornelius Date: Mon, 19 Dec 2016 15:53:36 +0000 Subject: [PATCH] Fixes #43 When adding new subindex for arrays/recs might as well inherit the parents properties as a sensible default. In some cases this does nothing, in others it can be overridden, but having it set is the start of a plan to eliminate the UNKNOWN and other missing child properties, these should always be present. --- EDSTest/DeviceODView.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/EDSTest/DeviceODView.cs b/EDSTest/DeviceODView.cs index 6dd44f61..ecaeecd2 100644 --- a/EDSTest/DeviceODView.cs +++ b/EDSTest/DeviceODView.cs @@ -819,13 +819,13 @@ private void addSubItemToolStripMenuItem_Click(object sender, EventArgs e) { ODentry od = (ODentry)selecteditemsub.Tag; - DataType dt = DataType.UNKNOWN; - if (od.parent.objecttype == ObjectType.ARRAY) { ODentry newsub = new ODentry(); newsub.parent = od.parent; - newsub.datatype = DataType.UNKNOWN; + newsub.datatype = od.parent.datatype; + newsub.accesstype = od.parent.accesstype; + newsub.PDOtype = od.parent.PDOtype; newsub.index = od.index; newsub.objecttype = ObjectType.VAR; newsub.subindex = (UInt16)od.parent.subobjects.Count; @@ -841,7 +841,7 @@ private void addSubItemToolStripMenuItem_Click(object sender, EventArgs e) if (od.parent.objecttype == ObjectType.REC) { - dt = od.datatype; + DataType dt = od.datatype; NewIndex ni = new NewIndex(eds, dt, od.parent.objecttype, od.parent); @@ -850,6 +850,8 @@ private void addSubItemToolStripMenuItem_Click(object sender, EventArgs e) ODentry newsub = new ODentry(); newsub.parent = od.parent; newsub.datatype = ni.dt; + newsub.accesstype = od.parent.accesstype; + newsub.PDOtype = od.parent.PDOtype; newsub.index = od.index; newsub.objecttype = ObjectType.VAR; newsub.subindex = (UInt16)od.parent.subobjects.Count;