C2024-024 Simple Selection of Fields to add to Return Values and Menu Values

This commit is contained in:
Matthew Schill 2024-10-09 13:12:29 -04:00
parent ebd7b1249f
commit 591fc03ca2
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)
// Revision DHH (day - no leading zero, two digit hour - military time
//
[assembly: AssemblyVersion("2.3.2404.1611")]
[assembly: AssemblyFileVersion("2.3.2404.1611")]
[assembly: AssemblyVersion("2.3.2410.907")]
[assembly: AssemblyFileVersion("2.3.2410.907")]
//
// 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

@ -188,23 +188,23 @@ namespace ROEditor
lboxInUse.Visible = true;
lb_chkApplc.Visible = false;
}
if (editlevel==(uint)RecordType.GroupSchema)this.Text = "Subgroup Definition";
if (editlevel == (uint)RecordType.GroupSchema) this.Text = "Subgroup Definition";
FillInData(grptxt);
}
/// <summary>
/// Clean up any resources being used.
/// </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();
}
}
base.Dispose( disposing );
base.Dispose(disposing);
}
private void FillInAvailable()
@ -212,9 +212,9 @@ namespace ROEditor
ROField rof;
// 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?
this.lboxAvail.Items.Add(rof.GetFieldname);
}
@ -297,7 +297,7 @@ namespace ROEditor
else
parent = null;
}
if (menuitm !="")
if (menuitm != "")
this.tbMenuVal.Text = CvtFldToUserFld(menuitm);
else
this.tbMenuVal.Text = "";
@ -310,21 +310,21 @@ namespace ROEditor
this.lblRetVal.Visible = true;
VlnXmlElement parent;
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
if (menuitm == "") menuitm = parent.GetAttribute("MenuItem");
if (retval == "") retval = parent.GetAttribute("RetVal");
if (parent.Name != "RO_Root")
parent = (VlnXmlElement) parent.ParentNode;
parent = (VlnXmlElement)parent.ParentNode;
else
parent = null;
}
if (menuitm!="")
if (menuitm != "")
this.tbMenuVal.Text = CvtFldToUserFld(menuitm);
else
this.tbMenuVal.Text = "";
if (retval!="")
if (retval != "")
this.tbRetVal.Text = CvtFldToUserFld(retval);
else
this.tbRetVal.Text = "";
@ -344,24 +344,27 @@ namespace ROEditor
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.
origRetVal=this.tbRetVal.Text;
origMenuItem=this.tbMenuVal.Text;
origRetVal = this.tbRetVal.Text;
origMenuItem = this.tbMenuVal.Text;
// if this is a database level definition & it's a user defined database,
// 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;
if (editlevel==(uint)RecordType.Schema)
if (editlevel == (uint)RecordType.Schema)
attr = elem.GetAttribute("FieldsInUse");
else
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();
this.btnRemove.Enabled = true;
@ -375,7 +378,7 @@ namespace ROEditor
this.btnAdd.Enabled = false;
this.btnEdit.Enabled = true;
}
protected void lboxAvail_GotFocus (object sender, EventArgs e)
protected void lboxAvail_GotFocus(object sender, EventArgs e)
{
if (PCApplicabilityEnabled)
lboxInUseCB.ClearSelected();
@ -385,6 +388,103 @@ namespace ROEditor
this.btnRemove.Enabled = false;
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)
{
//get item in lboxInUse (in use list) and remove it from there