B2017-016 – Handle when format selected from the dropdown happens to be the default format

This commit is contained in:
John Jenko 2017-01-26 15:09:35 +00:00
parent 9d6bfa6bf9
commit 728889a637

View File

@ -721,16 +721,19 @@ namespace VEPROMS
return; return;
} }
if (_InitialIndex < -1) _InitialIndex = ppCmbxFormat.SelectedIndex; // save the current format selection (happens here when current section format is not the default section) if (_InitialIndex < -1) _InitialIndex = ppCmbxFormat.SelectedIndex; // save the current format selection (happens here when current section format is not the default section)
PlantFormat pf = FormatInfoList.SortedFormatInfoList[ppCmbxFormat.SelectedIndex].PlantFormat; if (ppCmbxFormat.SelectedIndex > -1) // B2017-016 selectedindex of -1 means the default format was selected
// If the selected format does not have a docstyle compatable with the section
// then reset the format selection back to what it was
if (!ValidPlantFormat(pf))
{ {
_Initializing = true; PlantFormat pf = FormatInfoList.SortedFormatInfoList[ppCmbxFormat.SelectedIndex].PlantFormat;
ppCmbxFormat.SelectedIndex = _InitialIndex; // reset the format selection to what it was // If the selected format does not have a docstyle compatable with the section
ppBtnCancel.Focus(); // this will force the property page to refresh // then reset the format selection back to what it was
_Initializing = false; if (!ValidPlantFormat(pf))
return; {
_Initializing = true;
ppCmbxFormat.SelectedIndex = _InitialIndex; // reset the format selection to what it was
ppBtnCancel.Focus(); // this will force the property page to refresh
_Initializing = false;
return;
}
} }
if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName != null && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue)) if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName != null && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue))
{ {