B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function #765
Reference in New Issue
Block a user
Delete Branch "B2026-043-Fix-Error-for-Set_At_All_Level-in-the-Applicability-tab-evaluate-having-the-button-grayed-out-for-the-RNO-column-when-clicked-executes-function"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
B2026-043 Fix Error for Set_At_All_Level button in the Applicability tab evaluates having the button grayed out for the RNO column when-clicked executes function. In the fix I had to move the Set_At_All_Level button above the set of check boxes.
Let me know if any questions.
Mostly just some commented out code that should be cleaned up ---- but could be a small issue with the gpSubItem being dynamically added to gpItem when both are static that could arise if garbage collection happens to occur while running.
@@ -1,3 +1,4 @@using System.Drawing;Is this using necessary to be added?
if commenting out , should remove
@@ -36,2 +37,3 @@this.gpItem = new DevComponents.DotNetBar.Controls.GroupPanel();this.btnApplicabilitychg2 = new DevComponents.DotNetBar.ButtonItem();this.gpSubItem = new DevComponents.DotNetBar.Controls.GroupPanel();//this.btnApplicabilitychg2 = new DevComponents.DotNetBar.ButtonItem();Should not keep commented out code.
@@ -113,3 +115,3 @@this.gpItem.Margin = new System.Windows.Forms.Padding(4);this.gpItem.Name = "gpItem";this.gpItem.Padding = new System.Windows.Forms.Padding(13, 12, 13, 37);//this.gpItem.Padding = new System.Windows.Forms.Padding(13, 20, 13, 37);Should not keep commented out code.
@@ -171,2 +199,3 @@private DevComponents.DotNetBar.Controls.GroupPanel gpItem;private DevComponents.DotNetBar.ButtonItem btnApplicabilitychg2;private DevComponents.DotNetBar.Controls.GroupPanel gpSubItem;//private DevComponents.DotNetBar.ButtonItem btnApplicabilitychg2;Should not keep commented out code.
@@ -59,6 +60,8 @@ namespace Volian.Controls.Libraryforeach (string name in names)AddItemMode(name.Trim(), (++i).ToString());AddItemMode("None", "0");gpItem.Controls.Add(gpSubItem);gpSubItem is a pre-existing control - i.e. it is created in the Designer.
gpItem is also a pre-existing control.
Not sure that these should Adding one to another one like this (like it was a dynamic / built on the fly control) here.
Would be difficult to test for --- but
What happens if gpSubItem gets destroyed / garbage collected and you try to add it to gpItem
unlike dynamic controls (like the checkboxes / buttons created here in the code behind, this is not being dynamically created each time the code behind executes.)?
Thinking it (gpSubItem) should either entirely be created dynamically in the code behind or never removed/re-added from the parent control (gpItem) to avoid any issues with garbage collection....
Also, another possibility ---- instead of adding / removing, is it possible to use properties on gpSubItem like Visible and Enabled?
@@ -131,11 +134,17 @@ namespace Volian.Controls.Libraryprivate void AddItemMode(string name, string value){CheckBox cb = new CheckBox();//cb.BackColor = Color.Beige;Should not keep commented out code.
@@ -136,3 +143,3 @@cb.Tag = value;cb.Dock = DockStyle.Top;gpItem.Controls.Add(cb);//cb.Dock = DockStyle.Left;Should not keep commented out code.
@@ -137,2 +144,3 @@cb.Dock = DockStyle.Top;gpItem.Controls.Add(cb);//cb.Dock = DockStyle.Left;//gpItem.Controls.Add(cb);Should not keep commented out code.
I believe this still has the same issue as before with the gpsubItem being created in the constructor --- i.e. it is statically part of the class and will be created in the constructor and could potentially be garbage collected as it is removed from the control.
Look at
private void AddItemMode(string name, string value)
as an example - how a new Checkbox cb is created and added to the control on the fly.
I would suggest creating and adding the button in a sub procedure that is called right before the line:
AddItemMode("All", "-1");
@@ -113,3 +110,3 @@this.gpItem.Margin = new System.Windows.Forms.Padding(4);this.gpItem.Name = "gpItem";this.gpItem.Padding = new System.Windows.Forms.Padding(13, 12, 13, 37);//this.gpItem.Padding = new System.Windows.Forms.Padding(13, 20, 13, 37);Should not keep commented out code
removed
@@ -170,3 +168,3 @@private DevComponents.DotNetBar.Controls.GroupPanel gpMode;private DevComponents.DotNetBar.Controls.GroupPanel gpItem;private DevComponents.DotNetBar.ButtonItem btnApplicabilitychg2;//private DevComponents.DotNetBar.ButtonItem btnApplicabilitychg2;should not keep commented out code
Removed
overall looks good - just 1 or 2 unused lines to remove.
@@ -37,1 +38,3 @@DocVersionConfig dcfg = _MyDisplayTabItem.MyItemInfo.MyDocVersion.MyConfig as DocVersionConfig;//B2026-043 Fix "Set All At Level" button.DevComponents.DotNetBar.Controls.GroupPanel gpSubItem = InitializegpSubItem();gpSubItem.Controls.Clear();just a minor thing - but shouldn't need to clear it since it was just created.
@@ -498,6 +545,7 @@ namespace Volian.Controls.Librarypublic DisplayApplicability(){InitializeComponent();//InitializegpSubItem(); //B2026-043 Fix "Set All At Level" button.should remove commented out code
Looks good to me. Ready for QA.
changes look good
2.3.2605.715 tested and works as expected.