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

@@ -668,18 +668,21 @@ namespace VEPROMS
private void btnFormatSettings_Click(object sender, EventArgs e)
{
ProcessButtonClick(tiFmtSettings, btnFormatSettings);
// 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)
}
/// <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)
{
if (!_Initializing)
ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault);
}
// 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)
//{
// if (!_Initializing)
// ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault);
//}
private void ppBtnDefaultFmt_Click(object sender, EventArgs e)
{
@@ -1690,7 +1693,46 @@ namespace VEPROMS
RefreshAnnotationTypeList();
}
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();
btnFormatSettings.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;
}
}
public partial class LocalStageInfo
{