From 1b6eeaf4ad44441cf1dadcc934d2e95febc539be Mon Sep 17 00:00:00 2001 From: mschill Date: Tue, 8 Oct 2024 15:02:47 -0400 Subject: [PATCH] C2024-023 Autocomplete on Group Definition Accessory Page Access Values. --- .../Exe/RefObj/ROEditor/GroupDefFrm.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/GroupDefFrm.cs b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/GroupDefFrm.cs index 4dea6f10..ff0828fb 100644 --- a/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/GroupDefFrm.cs +++ b/PROMS/ReferencedObjects/Exe/RefObj/ROEditor/GroupDefFrm.cs @@ -100,6 +100,7 @@ using System.Text; using RODBInterface; using ROFields; using VlnStatus; +using System.Linq; namespace ROEditor { @@ -245,6 +246,37 @@ namespace ROEditor return CvtFldToUserFld(origGroup); } } + + //CSM C2024-023 + //Part of 2024 PROMS Upgrades + //When the Overall Form is activated + //if there are any items that are Fields that are in use + //add them as auto-complete options to the + //Accessory Page Access - Value Textbox + //Typing < will bring up the auto-complete options + protected void tbValue_AddAutoComplete(object sender, EventArgs e) + { + string dummy = ""; // need for RODB_GetFIeldsInUse call, won't be used. + ArrayList AvailList, InUseList; + //first see if it is a valid 'InUse' Field. + AvailList = myrodb.RODB_GetFields(elem, (uint)RecordType.Schema); + InUseList = myrodb.RODB_GetFieldsInUse(elem, AvailList, "FieldsInUse", ref dummy, false); + + //if any ROField items are in use, + //use LINQ to get a string array of the FieldNames + if (InUseList.Count > 0) + { + string[] InUseListFieldNames = InUseList.OfType().Select(x => $"<{x.GetFieldname}>").ToArray(); + AutoCompleteStringCollection allowedTypes = new AutoCompleteStringCollection(); + allowedTypes.AddRange(InUseListFieldNames); + tbValue.AutoCompleteCustomSource = allowedTypes; + tbValue.AutoCompleteMode = AutoCompleteMode.Suggest; + tbValue.AutoCompleteSource = AutoCompleteSource.CustomSource; + + } + + } + private void FillInData() { this.tbGroup.Text = DetermineGroupName(); @@ -432,6 +464,7 @@ namespace ROEditor this.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Name = "GroupDefFrm"; this.Text = "Group Definition"; + this.Activated += new EventHandler(tbValue_AddAutoComplete); this.groupBox1.ResumeLayout(false); this.ResumeLayout(false);