C2024-023 Autocomplete on Group Definition Accessory Page Access Values.

This commit is contained in:
Matthew Schill 2024-10-08 15:02:47 -04:00
parent 1d3dac0e51
commit 1b6eeaf4ad

View File

@ -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<ROField>().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);