C2017-004 when defaulting to the default format, position format dropdown to the default format

This commit is contained in:
2017-01-23 20:27:34 +00:00
parent 75b71ce40e
commit 41a135864f
9 changed files with 1547 additions and 1285 deletions

View File

@@ -273,6 +273,8 @@ namespace VEPROMS
private void btnFmtStngs_Click(object sender, EventArgs e)
{
ProcessButtonClick(tiFmtStngs, btnFmtStngs);
// added for code change C2017-004 - select default format in dropdown list
if (_InitialIndex < -1) _InitialIndex = ppCmbxFormat.SelectedIndex; // save the current format selection (happens here when current section is set to the default format)
}
private void ppBtnDefaultFmt_Click(object sender, EventArgs e)
@@ -281,15 +283,16 @@ namespace VEPROMS
//tcpFormatSettings.Focus();
}
// Commented out as part of code change C2017-004. this also makes it consistent with section properties
/// <summary>
/// Selection in Format combo box changed.
/// </summary>
/// <param name="sender">object</param>
/// <param name="e">EventArgs</param>
private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
{
ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault);
}
//private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
//{
// ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault);
//}
/// <summary>
/// Enable or disable the user specified change bar options base on the type
@@ -629,24 +632,25 @@ namespace VEPROMS
button.Visible = (cmbx.SelectedValue != null);
deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
}
/// <summary>
/// Process a change in the combo box selection
/// </summary>
/// <param name="cmbx">Combo Box Name</param>
/// <param name="defstr">string containing default text</param>
/// <param name="button">button to reset to default value</param>
/// <param name="deflabel">label containing the default</param>
private void ProcessCmbxSelectedValueChange(ComboBoxEx cmbx, string defstr, ButtonX button, Label deflabel)
{
if ((cmbx.SelectedIndex != -1) && defstr != null && defstr.Equals(cmbx.SelectedValue))
{
button.Visible = true;
button.Focus();
button.PerformClick();
}
button.Visible = cmbx.SelectedValue != null;
deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
}
// Commented out as part of code change C2017-004 - select default format on dropdown
///// <summary>
///// Process a change in the combo box selection
///// </summary>
///// <param name="cmbx">Combo Box Name</param>
///// <param name="defstr">string containing default text</param>
///// <param name="button">button to reset to default value</param>
///// <param name="deflabel">label containing the default</param>
//private void ProcessCmbxSelectedValueChange(ComboBoxEx cmbx, string defstr, ButtonX button, Label deflabel)
//{
// if ((cmbx.SelectedIndex != -1) && defstr != null && defstr.Equals(cmbx.SelectedValue))
// {
// button.Visible = true;
// button.Focus();
// button.PerformClick();
// }
// button.Visible = cmbx.SelectedValue != null;
// deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
//}
#endregion
private void ppProcTitleStpRTB_Enter(object sender, EventArgs e)
@@ -747,5 +751,47 @@ namespace VEPROMS
ppProcNumStpRTB.Focus();
}
private void ppCmbxFormat_DropDown(object sender, EventArgs e)
{
_Initializing = true;
// C2017-004 - if using the default format, position the dropdown to the default format
if (ppCmbxFormat.SelectedIndex == -1)
ppCmbxFormat.SelectedValue = _DefaultFormatName;
_Initializing = false;
}
private void ppCmbxFormat_DropDownClosed(object sender, EventArgs e)
{
// upon exit of the dropdown if the default format is selected - click the Default button
if ((string)(ppCmbxFormat.SelectedValue) == _DefaultFormatName)
{
ppBtnDefaultFmt.PerformClick();
btnFmtStngs.Focus();
}
}
// added as part of code change C2017-004. this also makes it consistent with section properties
int _InitialIndex = -2;
private void ppCmbxFormat_SelectedIndexChanged(object sender, EventArgs e)
{
if (_Initializing)
{
// determine if the default button and the default description text should visable
ppBtnDefaultFmt.Visible = !(ppCmbxFormat.SelectedValue == null || ppCmbxFormat.SelectedIndex == -1);
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
return;
}
if (_InitialIndex < -1) _InitialIndex = ppCmbxFormat.SelectedIndex; // save the current format selection (happens here when current section format is not the default section)
if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName != null && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue))
{
ppBtnDefaultFmt.Focus();
ppBtnDefaultFmt.PerformClick();
}
// determine if the default button and the default description text should visable
ppBtnDefaultFmt.Visible = !(ppCmbxFormat.SelectedValue == null || ppCmbxFormat.SelectedIndex == -1);
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
}
}
}