Development #450
@@ -1542,7 +1542,7 @@ namespace ROEditor
 | 
			
		||||
		//only close if they say "Yes, they want to"
 | 
			
		||||
		protected override void OnFormClosing(FormClosingEventArgs e)
 | 
			
		||||
		{
 | 
			
		||||
			if (this.DialogResult != System.Windows.Forms.DialogResult.OK && !CloseCancel())
 | 
			
		||||
			if (this.DialogResult != System.Windows.Forms.DialogResult.OK && IsPendingChange() && !CloseCancel())
 | 
			
		||||
			{
 | 
			
		||||
				e.Cancel = true;
 | 
			
		||||
			}
 | 
			
		||||
@@ -1558,6 +1558,49 @@ namespace ROEditor
 | 
			
		||||
 | 
			
		||||
            return result == DialogResult.Yes;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		//return true if a field has been modified
 | 
			
		||||
		private bool IsPendingChange()
 | 
			
		||||
		{
 | 
			
		||||
			if (origRetVal != this.tbRetVal.Text)
 | 
			
		||||
				return true;
 | 
			
		||||
			
 | 
			
		||||
			if (origMenuItem != this.tbMenuVal.Text)
 | 
			
		||||
				return true;
 | 
			
		||||
 | 
			
		||||
			// check if in use records have changed
 | 
			
		||||
			string inuserecs = null;
 | 
			
		||||
			ROField rof;
 | 
			
		||||
			for (int i = 0; i < InUseList.Count; i++)
 | 
			
		||||
			{
 | 
			
		||||
				rof = (ROField)InUseList[i];
 | 
			
		||||
				if (rof.GetFieldname != null)   //DO YET: why null?
 | 
			
		||||
				{
 | 
			
		||||
					inuserecs = inuserecs + rof.GetRecID;
 | 
			
		||||
					if (i + 1 < InUseList.Count) inuserecs = inuserecs + " ";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (inuserecs != origFieldsInUse)
 | 
			
		||||
				return true;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			//check if applicability fields have changed
 | 
			
		||||
			string applicfieldrecs = null;
 | 
			
		||||
			for (int i = 0; i < InUseApplcList.Count; i++)
 | 
			
		||||
			{
 | 
			
		||||
				rof = (ROField)InUseApplcList[i];
 | 
			
		||||
				if (rof.GetFieldname != null)
 | 
			
		||||
				{
 | 
			
		||||
					applicfieldrecs = applicfieldrecs + rof.GetRecID;
 | 
			
		||||
					if (i + 1 < InUseApplcList.Count) applicfieldrecs = applicfieldrecs + " ";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (applicfieldrecs != origApplicFields)
 | 
			
		||||
				return true;
 | 
			
		||||
 | 
			
		||||
			//nothing has changed
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
		#endregion
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user