C2025-023 - Electronic Procedures - Modifications to PROMS
1. undo changes to store checkbox/textbox in cell grid 2. change to use roid as key for RO listbox items
This commit is contained in:
parent
9fdbdb05f4
commit
8ef08c53b3
@ -329,9 +329,9 @@ namespace VEPROMS.CSLA.Library
|
||||
string roid = FormatRoidKey(rosource, false);
|
||||
rochild[] children = lookup.GetRoChildrenByRoid(roid);
|
||||
|
||||
List<ROListItem> mylist = children.Select(x => new ROListItem(x.title, x.ID)).ToList();
|
||||
List<ROListItem> mylist = children.Select(x => new ROListItem(x.title, x.roid)).ToList();
|
||||
if (includeblank)
|
||||
mylist.Insert(0, new ROListItem("", -1));
|
||||
mylist.Insert(0, new ROListItem("", ""));
|
||||
|
||||
return mylist;
|
||||
}
|
||||
@ -348,8 +348,8 @@ namespace VEPROMS.CSLA.Library
|
||||
public class ROListItem
|
||||
{
|
||||
public string Text { get; private set; }
|
||||
public int Value { get; private set; }
|
||||
public ROListItem(string _text, int _value)
|
||||
public string Value { get; private set; }
|
||||
public ROListItem(string _text, string _value)
|
||||
{
|
||||
Text = _text; Value = _value;
|
||||
}
|
||||
|
@ -603,10 +603,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
public void SetGridContextMenu()
|
||||
{
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Only show EP menu if an EP Annotation Type Exists
|
||||
btnEPDesignation.Visible = EPFormatFile.IsEPAnnotationType();
|
||||
|
||||
if (rtabTableGridTools.Visible)
|
||||
_ContextMenuBar.SetContextMenuEx(MyFlexGrid, btnCMGrid);
|
||||
}
|
||||
@ -774,43 +770,6 @@ namespace Volian.Controls.Library
|
||||
//C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.GetEvenSelection();
|
||||
//rbnBorderSelectionPanel.InitializeBorder(MyFlexGrid.MyBorders, cr.r1, cr.c1, cr.r2, cr.c2);
|
||||
rbnBorderSelectionPanel.InitializeBorder(MyFlexGrid, MyFlexGrid.Selection);
|
||||
|
||||
SetEPbuttonImages();
|
||||
|
||||
}
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Set which EP items are selected to show in the UI
|
||||
void SetEPbuttonImages()
|
||||
{
|
||||
if (EPFormatFile.IsEPAnnotationType())
|
||||
{
|
||||
VlnFlexGrid.EPinputtype myEPInput = MyFlexGrid.GetEPinputtype();
|
||||
Bitmap cb_Btmp = createTextBitmap('\u2713');
|
||||
switch (myEPInput)
|
||||
{
|
||||
case VlnFlexGrid.EPinputtype.none:
|
||||
btnEP_None.Image = cb_Btmp;
|
||||
btnEP_Text.Image = null;
|
||||
btnEP_Check.Image = null;
|
||||
break;
|
||||
case VlnFlexGrid.EPinputtype.textbox:
|
||||
btnEP_None.Image = null;
|
||||
btnEP_Text.Image = cb_Btmp;
|
||||
btnEP_Check.Image = null;
|
||||
break;
|
||||
case VlnFlexGrid.EPinputtype.checkbox:
|
||||
btnEP_None.Image = null;
|
||||
btnEP_Text.Image = null;
|
||||
btnEP_Check.Image = cb_Btmp;
|
||||
break;
|
||||
case VlnFlexGrid.EPinputtype.multi:
|
||||
btnEP_None.Image = null;
|
||||
btnEP_Text.Image = null;
|
||||
btnEP_Check.Image = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void _MyEditItem_Leave(object sender, EventArgs e)
|
||||
{
|
||||
@ -4589,35 +4548,6 @@ namespace Volian.Controls.Library
|
||||
//MyFlexGrid.ListStyles();
|
||||
}
|
||||
}
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//if button selected, set the Cell's UserData
|
||||
//then save the Grid
|
||||
|
||||
private void btnEP_None_Click(object sender, EventArgs e)
|
||||
{
|
||||
MyFlexGrid.SetEPinputtype(VlnFlexGrid.EPinputtype.none);
|
||||
SetEPbuttonImages();
|
||||
GridItem tmp = MyEditItem as GridItem;
|
||||
tmp.SaveContents();
|
||||
}
|
||||
|
||||
private void btnEP_Text_Click(object sender, EventArgs e)
|
||||
{
|
||||
MyFlexGrid.SetEPinputtype(VlnFlexGrid.EPinputtype.textbox);
|
||||
SetEPbuttonImages();
|
||||
GridItem tmp = MyEditItem as GridItem;
|
||||
tmp.SaveContents();
|
||||
}
|
||||
|
||||
private void btnEP_check_Click(object sender, EventArgs e)
|
||||
{
|
||||
MyFlexGrid.SetEPinputtype(VlnFlexGrid.EPinputtype.checkbox);
|
||||
SetEPbuttonImages();
|
||||
GridItem tmp = MyEditItem as GridItem;
|
||||
tmp.SaveContents();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Table Grid Border
|
||||
private void btnTblDgnTableBorderNone_Click(object sender, EventArgs e)
|
||||
@ -4878,8 +4808,8 @@ namespace Volian.Controls.Library
|
||||
if (MyEditItem != null) MyEditItem.SaveCurrentAndContents();
|
||||
OnTimeCriticalActionSummaryRequest(new StepTabRibbonEventArgs(MyItemInfo.MyProcedure));
|
||||
}
|
||||
}
|
||||
public class StepTabRibbonEventArgs : EventArgs
|
||||
}
|
||||
public class StepTabRibbonEventArgs : EventArgs
|
||||
{
|
||||
public StepTabRibbonEventArgs() { ; }
|
||||
public StepTabRibbonEventArgs(ItemInfo proc)
|
||||
|
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -166,13 +166,6 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (this.TableCellEditor.Text.Contains("<NewID>"))
|
||||
return false;
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//To handle if EP designation changed so will save in the DB
|
||||
if (IsUserDataDirty)
|
||||
{
|
||||
IsUserDataDirty = false;
|
||||
return true;
|
||||
}
|
||||
XmlDocument XdOld = new XmlDocument();
|
||||
oldXml = _ReplaceTextFont.Replace(oldXml, "$1" + FontChangeFmt + "$4"); // B2021-032: use original font
|
||||
XdOld.LoadXml(AdjustHeightAndWidthForDPI(oldXml));
|
||||
@ -859,10 +852,7 @@ namespace Volian.Controls.Library
|
||||
if (Row >= cr.r1 && Row <= cr.r2)
|
||||
{
|
||||
int cellHeight = GetCellHeight(Row, c);
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmpUD = $"{cr.UserData}";
|
||||
int dataHeight = (cr.UserData == null) ? cellHeight : int.Parse(tmpUD.Split(',')[0]);
|
||||
int dataHeight = (cr.UserData == null) ? cellHeight : (int)cr.UserData;
|
||||
int ud = dataHeight / (Rows.DefaultSize - 3);
|
||||
//if (cellHeight < dataHeight)
|
||||
// Console.WriteLine("r {0}, c {1}, cell{2}, data{3}", Row, c, cellHeight, dataHeight);
|
||||
@ -1253,24 +1243,11 @@ namespace Volian.Controls.Library
|
||||
if (_tableCellEditor._initializingEdit || !_tableCellEditor.Visible) return;
|
||||
int curHeight = GetCellHeight(Row, Col);//(Rows[Row].Height == -1) ? Rows.DefaultSize : Rows[Row].Height;
|
||||
CellRange cr = GetMergedRange(Row, Col);
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmpUD = $"{cr.UserData}";
|
||||
int oH = cr.UserData == null ? curHeight : int.Parse(tmpUD.Split(',')[0]);
|
||||
int oH = cr.UserData == null ? curHeight : (int)cr.UserData;
|
||||
int nH = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||
int nW = _tableCellEditor.Width; // Width
|
||||
int Hadj = (nH - curHeight);//oH);
|
||||
string tmp = $"{cr.UserData}";
|
||||
int comma = tmp.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
cr.UserData = $"{_tableCellEditor.Height},{tmp.Substring(comma + 1)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
cr.UserData = _tableCellEditor.Height;
|
||||
}
|
||||
|
||||
cr.UserData = _tableCellEditor.Height; //.ContentsRectangle.Height;
|
||||
//int cellHeight = GetCellHeight(Row, Col);
|
||||
//int cellheightNLines = cellHeight / (Rows.DefaultSize - 3);
|
||||
//int nHNLines = nH / (Rows.DefaultSize - 3);
|
||||
@ -1394,18 +1371,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_rtf.Width = e.Bounds.Width - 1; // This has also been -3 which matchs the rener command
|
||||
CellRange cr = GetMergedRange(e.Row, e.Col);
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmp = $"{cr.UserData}";
|
||||
int comma = tmp.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
cr.UserData = $"{_rtf.Height},{tmp.Substring(comma + 1)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
cr.UserData = _rtf.Height;
|
||||
}
|
||||
cr.UserData = _rtf.Height;
|
||||
int hAdjust = 0;
|
||||
int hDiff = e.Bounds.Height - _rtf.Height;
|
||||
if (hDiff < 0)
|
||||
@ -2646,84 +2612,6 @@ namespace Volian.Controls.Library
|
||||
CellRange cr = this.Selection;
|
||||
cr.Clear(ClearFlags.Content);
|
||||
}
|
||||
|
||||
public enum EPinputtype
|
||||
{
|
||||
none,
|
||||
textbox,
|
||||
checkbox,
|
||||
multi
|
||||
};
|
||||
private bool IsUserDataDirty = false;
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
//For Electronic Procedures to set the Electronic Procedure input type
|
||||
//for when cells in a table will need a textbox or checkbox in the EP viewer
|
||||
public void SetEPinputtype(EPinputtype EPtype)
|
||||
{
|
||||
CellRange cr = this.Selection;
|
||||
|
||||
for (int r = cr.r1; r <= cr.r2; r++)
|
||||
for (int c = cr.c1; c <= cr.c2; c++)
|
||||
{
|
||||
CellRange cr_single = GetCellRange(r, c);
|
||||
string tmpUD = $"{cr_single.UserData}";
|
||||
string height = cr_single.UserData == null ? $"{GetCellHeight(r, c)}" : tmpUD.Split(',')[0];
|
||||
|
||||
if (EPtype == EPinputtype.none)
|
||||
cr_single.UserData = int.Parse(height);
|
||||
else
|
||||
cr_single.UserData = $"{height},{EPtype}";
|
||||
}
|
||||
|
||||
//save the changes
|
||||
Select(cr);
|
||||
IsUserDataDirty = true;
|
||||
}
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
//For Electronic Procedures get the Electronic Procedure input type
|
||||
//for when cells in a table will need a textbox or checkbox in the EP viewer
|
||||
public EPinputtype GetEPinputtype()
|
||||
{
|
||||
EPinputtype result = EPinputtype.none;
|
||||
|
||||
CellRange cr = this.Selection;
|
||||
|
||||
for (int r = cr.r1; r <= cr.r2; r++)
|
||||
for (int c = cr.c1; c <= cr.c2; c++)
|
||||
{
|
||||
CellRange cr_single = GetCellRange(r, c);
|
||||
string tmpUD = $"{cr_single.UserData}";
|
||||
int comma = tmpUD.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
EPinputtype newresult = (EPinputtype) Enum.Parse(typeof(EPinputtype), tmpUD.Substring(comma + 1));
|
||||
//if first cell, overwrite none
|
||||
if (result == EPinputtype.none && r == cr.r1 && c == cr.c1)
|
||||
{
|
||||
result = newresult;
|
||||
}
|
||||
else if (result != newresult)
|
||||
{
|
||||
result = EPinputtype.multi;
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
else if (result != EPinputtype.none)
|
||||
{
|
||||
result = EPinputtype.multi;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public void SetupCellUserData()
|
||||
{
|
||||
for (int r = 0; r < Rows.Count; r++)
|
||||
@ -2737,19 +2625,7 @@ namespace Volian.Controls.Library
|
||||
_rtf.Width = Cols[c].Width;
|
||||
_rtf.Rtf = rtfText;
|
||||
CellRange cr = GetCellRange(r, c);
|
||||
|
||||
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||
//Userdata will now contain: height, EP Designation
|
||||
string tmp = $"{cr.UserData}";
|
||||
int comma = tmp.IndexOf(',');
|
||||
if (comma != -1)
|
||||
{
|
||||
cr.UserData = $"{_rtf.ContentsRectangle.Height},{tmp.Substring(comma + 1)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
cr.UserData = _rtf.ContentsRectangle.Height;
|
||||
}
|
||||
cr.UserData = _rtf.ContentsRectangle.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,10 +160,10 @@ namespace Volian.Controls.Library
|
||||
foreach (KeyValuePair<string, ComboBox> pair in _DicSingleRO)
|
||||
{
|
||||
string val = MyConfig.GetValue("EP", pair.Key);
|
||||
if (val != null && val != "" && int.TryParse(val, out int n))
|
||||
pair.Value.SelectedValue = n;
|
||||
if (val != null && val != "")
|
||||
pair.Value.SelectedValue = val;
|
||||
else
|
||||
pair.Value.SelectedValue = -1;
|
||||
pair.Value.SelectedValue = "";
|
||||
}
|
||||
|
||||
foreach (KeyValuePair<string, ListBoxMulti> pair in _DicMultiRO)
|
||||
@ -175,9 +175,8 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
var selectedvalues = val.Split(multiseparator.ToCharArray());
|
||||
foreach (string item in selectedvalues)
|
||||
if (int.TryParse(item, out int n))
|
||||
{
|
||||
string text = ((List<ROListItem>)pair.Value.DataSource).First(x => x.Value == n).Text;
|
||||
string text = ((List<ROListItem>)pair.Value.DataSource).First(x => x.Value == item).Text;
|
||||
pair.Value.SetSelected(pair.Value.FindString(text), true);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user