C2025-023 - Electronic Procedures - Modifications to PROMS

Simplified to textboxes as RTF was impacting possible tags / directories
This commit is contained in:
Matthew Schill 2025-05-21 09:34:07 -04:00
parent 7ade7f6e24
commit 5a7e63871d

View File

@ -20,7 +20,7 @@ namespace Volian.Controls.Library
private AnnotationConfig MyConfig; private AnnotationConfig MyConfig;
private StepTabRibbon _MyStepTabRibbon; private StepTabRibbon _MyStepTabRibbon;
private Dictionary<string, StepRTB> _DicStepRtb; private Dictionary<string, TextBox> _DicTB;
private Dictionary<string, CheckBox> _DicCheckBox; private Dictionary<string, CheckBox> _DicCheckBox;
private Dictionary<string, ComboBox> _DicComboBox; private Dictionary<string, ComboBox> _DicComboBox;
private Dictionary<string, ComboBox> _DicSingleRO; private Dictionary<string, ComboBox> _DicSingleRO;
@ -32,7 +32,7 @@ namespace Volian.Controls.Library
public frmEPAnnotationDetails(AnnotationInfo currAnn) public frmEPAnnotationDetails(AnnotationInfo currAnn)
{ {
InitializeComponent(); InitializeComponent();
_DicStepRtb = new Dictionary<string, StepRTB>(); _DicTB = new Dictionary<string, TextBox>();
_DicCheckBox = new Dictionary<string, CheckBox>(); _DicCheckBox = new Dictionary<string, CheckBox>();
_DicComboBox = new Dictionary<string, ComboBox>(); _DicComboBox = new Dictionary<string, ComboBox>();
_DicSingleRO = new Dictionary<string, ComboBox>(); _DicSingleRO = new Dictionary<string, ComboBox>();
@ -72,28 +72,20 @@ namespace Volian.Controls.Library
if (EP.type.ToLower() == "text") if (EP.type.ToLower() == "text")
{ {
StepRTB tb = new StepRTB(); TextBox tb = new TextBox();
tb.Font = tb.FormatFont = new Font("Arial", 8); tb.Font = tb.Font = new Font("Arial", 8);
tb.FieldToEdit = E_FieldToEdit.PSI; //use same right click menu as PSI
tb.BorderStyle = BorderStyle.FixedSingle; tb.BorderStyle = BorderStyle.FixedSingle;
//aligning to both left and right stretches the textbox to the width of the form //aligning to both left and right stretches the textbox to the width of the form
tb.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; tb.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
tb.Enter += new System.EventHandler(this.FieldStepRTB_Enter); string val = MyConfig.GetValue("EP", EP.name).Replace("\\u8209?", "-").Replace(@"\u9586?", @"\");
tb.Text = val;
string val = MyConfig.GetValue("EP", EP.name).Replace("\\u8209?", "-");
DisplayText dt = new DisplayText(val, new VE_Font("Arial", 10, E_Style.None, 12), false);
StringBuilder sb = new StringBuilder();
sb.Append(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset2 Arial;}");
sb.Append(@"{\f1\fnil\fcharset0 Arial;}}{\colortbl ;\red255\green0\blue0;}"); //C2017-036 changed to just Arial because Microsoft removed Arial Unicode MS with Word16
sb.Append(@"\viewkind4\uc1\pard\sl-240\slmult0\fs" + (int)(this.Font.SizeInPoints * 2) + " " + dt.StartText + @"}");
tb.Rtf = sb.ToString();
tb.Visible = true; tb.Visible = true;
tb.Height = EP.numlines * tb.Font.Height + 1 + tb.Margin.Vertical; tb.Height = EP.numlines * tb.Font.Height + 1 + tb.Margin.Vertical;
tb.MinimumSize = new Size(0, EP.numlines * tb.Font.Height + 1 + tb.Margin.Vertical); tb.MinimumSize = new Size(0, EP.numlines * tb.Font.Height + 1 + tb.Margin.Vertical);
if (EP.numlines > 1) if (EP.numlines > 1)
{ {
tb.Multiline = true; tb.Multiline = true;
tb.ScrollBars = RichTextBoxScrollBars.Both; tb.ScrollBars = ScrollBars.Both;
panelEP.RowStyles.Insert(panelEP.RowCount - 1, new RowStyle(SizeType.Absolute, 50)); panelEP.RowStyles.Insert(panelEP.RowCount - 1, new RowStyle(SizeType.Absolute, 50));
} }
else else
@ -101,7 +93,7 @@ namespace Volian.Controls.Library
panelEP.RowStyles.Insert(panelEP.RowCount - 1, new RowStyle(SizeType.AutoSize)); panelEP.RowStyles.Insert(panelEP.RowCount - 1, new RowStyle(SizeType.AutoSize));
} }
_DicStepRtb.Add(EP.name, tb); _DicTB.Add(EP.name, tb);
panelEP.Controls.Add(tb, 1, panelEP.RowCount - 1); panelEP.Controls.Add(tb, 1, panelEP.RowCount - 1);
} }
else else
@ -226,9 +218,8 @@ namespace Volian.Controls.Library
{ {
if (EP.type.ToLower() == "text") if (EP.type.ToLower() == "text")
{ {
StepRTB cur = _DicStepRtb[EP.name]; TextBox cur = _DicTB[EP.name];
string rtf = cur.Rtf; string newval = cur.Text;
string newval = DisplayText.StaticStripRtfCommands(rtf, false);
string oldval = MyConfig.GetValue("EP", EP.name); string oldval = MyConfig.GetValue("EP", EP.name);
if (oldval != newval) if (oldval != newval)
{ {
@ -318,11 +309,6 @@ namespace Volian.Controls.Library
//remove events so no memory loss //remove events so no memory loss
private void frmEPAnnotationDetails_FormClosing(object sender, FormClosingEventArgs e) private void frmEPAnnotationDetails_FormClosing(object sender, FormClosingEventArgs e)
{ {
foreach (StepRTB tb in _DicStepRtb.Values)
{
tb.Enter -= FieldStepRTB_Enter;
}
foreach (ListBoxMulti lb in _DicMultiRO.Values) foreach (ListBoxMulti lb in _DicMultiRO.Values)
{ {
lb.Dispose(); lb.Dispose();