Merge pull request 'C2024-024 Simple Selection of Fields to add to Return Values and Menu Values' (#423) from C2024-024 into Development

file changes look good - ready for testing phase.
This commit is contained in:
John Jenko 2024-10-09 14:02:53 -04:00
commit 0a52aa5c53
2 changed files with 130 additions and 28 deletions

View File

@ -23,8 +23,8 @@ using System.Runtime.CompilerServices;
// Build YYMM (two digit year, two digit month) // Build YYMM (two digit year, two digit month)
// Revision DHH (day - no leading zero, two digit hour - military time // Revision DHH (day - no leading zero, two digit hour - military time
// //
[assembly: AssemblyVersion("2.3.2404.1611")] [assembly: AssemblyVersion("2.3.2410.907")]
[assembly: AssemblyFileVersion("2.3.2404.1611")] [assembly: AssemblyFileVersion("2.3.2410.907")]
// //
// In order to sign your assembly you must specify a key to use. Refer to the // In order to sign your assembly you must specify a key to use. Refer to the
@ -91,6 +91,8 @@ using System.Runtime.CompilerServices;

View File

@ -151,7 +151,7 @@ namespace ROEditor
private string origMenuItem; private string origMenuItem;
StringBuilder parseerror; StringBuilder parseerror;
private int hi, lo; private int hi, lo;
private Label lb_chkApplc; private Label lb_chkApplc;
private int dbtype; private int dbtype;
// C2021-026 returns true is Parent/Child info was passed into the RO Editor // C2021-026 returns true is Parent/Child info was passed into the RO Editor
public bool PCApplicabilityEnabled public bool PCApplicabilityEnabled
@ -188,33 +188,33 @@ namespace ROEditor
lboxInUse.Visible = true; lboxInUse.Visible = true;
lb_chkApplc.Visible = false; lb_chkApplc.Visible = false;
} }
if (editlevel==(uint)RecordType.GroupSchema)this.Text = "Subgroup Definition"; if (editlevel == (uint)RecordType.GroupSchema) this.Text = "Subgroup Definition";
FillInData(grptxt); FillInData(grptxt);
} }
/// <summary> /// <summary>
/// Clean up any resources being used. /// Clean up any resources being used.
/// </summary> /// </summary>
protected override void Dispose( bool disposing ) protected override void Dispose(bool disposing)
{ {
if( disposing ) if (disposing)
{ {
if(components != null) if (components != null)
{ {
components.Dispose(); components.Dispose();
} }
} }
base.Dispose( disposing ); base.Dispose(disposing);
} }
private void FillInAvailable() private void FillInAvailable()
{ {
ROField rof; ROField rof;
// put the items in the AvailList box. // put the items in the AvailList box.
for (int i=0; i< AvailList.Count; i++) for (int i = 0; i < AvailList.Count; i++)
{ {
rof = (ROField) AvailList[i]; rof = (ROField)AvailList[i];
if (rof.GetFieldname != null) // DO YET: Why null? if (rof.GetFieldname != null) // DO YET: Why null?
this.lboxAvail.Items.Add(rof.GetFieldname); this.lboxAvail.Items.Add(rof.GetFieldname);
} }
@ -277,7 +277,7 @@ namespace ROEditor
_initializing = false; _initializing = false;
} }
private void DoValueTextBoxes() private void DoValueTextBoxes()
{ {
string menuitm, retval; string menuitm, retval;
@ -297,7 +297,7 @@ namespace ROEditor
else else
parent = null; parent = null;
} }
if (menuitm !="") if (menuitm != "")
this.tbMenuVal.Text = CvtFldToUserFld(menuitm); this.tbMenuVal.Text = CvtFldToUserFld(menuitm);
else else
this.tbMenuVal.Text = ""; this.tbMenuVal.Text = "";
@ -310,21 +310,21 @@ namespace ROEditor
this.lblRetVal.Visible = true; this.lblRetVal.Visible = true;
VlnXmlElement parent; VlnXmlElement parent;
parent = (VlnXmlElement) elem.ParentNode; parent = (VlnXmlElement) elem.ParentNode;
while (parent != null && (menuitm == "" || retval=="")) while (parent != null && (menuitm == "" || retval == ""))
{ {
// walk up tree to get parent and check for data there // walk up tree to get parent and check for data there
if (menuitm == "") menuitm = parent.GetAttribute("MenuItem"); if (menuitm == "") menuitm = parent.GetAttribute("MenuItem");
if (retval == "") retval = parent.GetAttribute("RetVal"); if (retval == "") retval = parent.GetAttribute("RetVal");
if (parent.Name != "RO_Root") if (parent.Name != "RO_Root")
parent = (VlnXmlElement) parent.ParentNode; parent = (VlnXmlElement)parent.ParentNode;
else else
parent = null; parent = null;
} }
if (menuitm!="") if (menuitm != "")
this.tbMenuVal.Text = CvtFldToUserFld(menuitm); this.tbMenuVal.Text = CvtFldToUserFld(menuitm);
else else
this.tbMenuVal.Text = ""; this.tbMenuVal.Text = "";
if (retval!="") if (retval != "")
this.tbRetVal.Text = CvtFldToUserFld(retval); this.tbRetVal.Text = CvtFldToUserFld(retval);
else else
this.tbRetVal.Text = ""; this.tbRetVal.Text = "";
@ -332,7 +332,7 @@ namespace ROEditor
} }
private void FillInData(string grptxt) private void FillInData(string grptxt)
{ {
this.lblGroupText.Text = grptxt; this.lblGroupText.Text = grptxt;
DoValueTextBoxes(); DoValueTextBoxes();
SetUpListBoxes(); SetUpListBoxes();
@ -344,24 +344,27 @@ namespace ROEditor
lboxAvail.GotFocus += new EventHandler(this.lboxAvail_GotFocus); lboxAvail.GotFocus += new EventHandler(this.lboxAvail_GotFocus);
lboxInUse.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lboxInUse_MouseUp);
lboxInUseCB.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lboxInUseCB_MouseUp);
// save copies of local data, so if there is a change, we know we must save them. // save copies of local data, so if there is a change, we know we must save them.
origRetVal=this.tbRetVal.Text; origRetVal = this.tbRetVal.Text;
origMenuItem=this.tbMenuVal.Text; origMenuItem = this.tbMenuVal.Text;
// if this is a database level definition & it's a user defined database, // if this is a database level definition & it's a user defined database,
// the okay button is disabled until a field is used. // the okay button is disabled until a field is used.
if (elem.ParentNode.Name == "RO_Root" && dbtype==3) if (elem.ParentNode.Name == "RO_Root" && dbtype == 3)
{ {
string attr; string attr;
if (editlevel==(uint)RecordType.Schema) if (editlevel == (uint)RecordType.Schema)
attr = elem.GetAttribute("FieldsInUse"); attr = elem.GetAttribute("FieldsInUse");
else else
attr = elem.GetAttribute("GroupFieldsInUse"); attr = elem.GetAttribute("GroupFieldsInUse");
if (attr==null || attr=="") btnOK.Enabled=false; if (attr == null || attr == "") btnOK.Enabled = false;
} }
} }
protected void lboxInUse_GotFocus (object sender, EventArgs e) protected void lboxInUse_GotFocus(object sender, EventArgs e)
{ {
lboxAvail.ClearSelected(); lboxAvail.ClearSelected();
this.btnRemove.Enabled = true; this.btnRemove.Enabled = true;
@ -375,7 +378,7 @@ namespace ROEditor
this.btnAdd.Enabled = false; this.btnAdd.Enabled = false;
this.btnEdit.Enabled = true; this.btnEdit.Enabled = true;
} }
protected void lboxAvail_GotFocus (object sender, EventArgs e) protected void lboxAvail_GotFocus(object sender, EventArgs e)
{ {
if (PCApplicabilityEnabled) if (PCApplicabilityEnabled)
lboxInUseCB.ClearSelected(); lboxInUseCB.ClearSelected();
@ -385,6 +388,103 @@ namespace ROEditor
this.btnRemove.Enabled = false; this.btnRemove.Enabled = false;
this.btnEdit.Enabled = true; this.btnEdit.Enabled = true;
} }
//CSM C2024-024
//Simple Selection of Fields to add to Return Values and Menu Values.
//Part of 2024 PROMS Upgrades
//Add Context Menu for In Use Listbox
//Will allow user to right click Selected Items
//and add then to the Return Value / Menu Value Text Boxes
//without re-typing them
protected void lboxInUse_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right && lboxInUse.SelectedItems.Count > 0)
{
ContextMenuStrip cn = new ContextMenuStrip();
if (tbRetVal.Visible)
{
var AddToReturnItem = new ToolStripMenuItem("Add to Return Value");
AddToReturnItem.Click += new EventHandler(lboxInUse_Click);
AddToReturnItem.Name = "Add to Return Value";
cn.Items.Add(AddToReturnItem);
}
var AddToMenuItem = new ToolStripMenuItem("Add to Menu Value");
AddToMenuItem.Click += new EventHandler(lboxInUse_Click);
AddToMenuItem.Name = "Add to Menu Value";
cn.Items.Add(AddToMenuItem);
this.lboxInUse.ContextMenuStrip = cn;
cn.Show(Control.MousePosition.X, Control.MousePosition.Y);
}
}
private void lboxInUse_Click(object sender, EventArgs e)
{
switch (((ToolStripMenuItem)sender).Name)
{
case "Add to Return Value":
if (tbRetVal.Text == "")
tbRetVal.Text += $"<{lboxInUse.SelectedItem}>";
else
tbRetVal.Text += $" - <{lboxInUse.SelectedItem}>";
break;
case "Add to Menu Value":
if (tbMenuVal.Text == "")
tbMenuVal.Text += $"<{lboxInUse.SelectedItem}>";
else
tbMenuVal.Text += $" - <{lboxInUse.SelectedItem}>";
break;
}
}
//CSM C2024-024
//Simple Selection of Fields to add to Return Values and Menu Values.
//Part of 2024 PROMS Upgrades
//Add Context Menu for In Use ComboBox
//(Replaces In Use Listbox when Applicability
//to allow for selection of items per Unit)
//Will allow user to right click Selected Items
//and add then to the Return Value / Menu Value Text Boxes
//without re-typing them
protected void lboxInUseCB_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right && lboxInUseCB.SelectedItems.Count > 0)
{
ContextMenuStrip cn = new ContextMenuStrip();
if (tbRetVal.Visible)
{
var AddToReturnItem = new ToolStripMenuItem("Add to Return Value");
AddToReturnItem.Click += new EventHandler(lboxInUseCB_Click);
AddToReturnItem.Name = "Add to Return Value";
cn.Items.Add(AddToReturnItem);
}
var AddToMenuItem = new ToolStripMenuItem("Add to Menu Value");
AddToMenuItem.Click += new EventHandler(lboxInUseCB_Click);
AddToMenuItem.Name = "Add to Menu Value";
cn.Items.Add(AddToMenuItem);
this.lboxInUseCB.ContextMenuStrip = cn;
cn.Show(Control.MousePosition.X, Control.MousePosition.Y);
}
}
private void lboxInUseCB_Click(object sender, EventArgs e)
{
switch (((ToolStripMenuItem)sender).Name)
{
case "Add to Return Value":
if (tbRetVal.Text == "")
tbRetVal.Text += $"<{lboxInUseCB.SelectedItem}>";
else
tbRetVal.Text += $" - <{lboxInUseCB.SelectedItem}>";
break;
case "Add to Menu Value":
if (tbMenuVal.Text == "")
tbMenuVal.Text += $"<{lboxInUseCB.SelectedItem}>";
else
tbMenuVal.Text += $" - <{lboxInUseCB.SelectedItem}>";
break;
}
}
private void btnRemove_Click(object sender, System.EventArgs e) private void btnRemove_Click(object sender, System.EventArgs e)
{ {
//get item in lboxInUse (in use list) and remove it from there //get item in lboxInUse (in use list) and remove it from there