title: Delphi: Canceling a TDataSet.Post in an OnBeforePost Event
body: <p>On our main data entry screen, we have an OK/Cancel dialog in the OnBeforePost event.</p>
  
  <ul>
  <li><em>OK</em> lets things take their course</li>
  <li><em>Cancel</em> right now does a <code>Dataset.Cancel;</code></li>
  </ul>
  
  <p>Which does what it's meant to, roll back any changes and puts the dataset into browse mode.</p>
  
  <p>This is fine for most of the clients, but we have been asked if it can be changed to </p>
  
  <ul>
  <li><em>Cancel</em>, Abort the Post and stay in edit mode with the current changes kept.</li>
  </ul>
  
  <p>If they want to cancel, they can use the cancel button.</p>
  
  <p>Looking at the source for <code>procedure TDataSet.Post;</code> it does not look possible to use the event this way.</p>
  
  <p>Dose anyone have any thoughts on a way this could be done?</p>
  
  <p>Follow Up: this is how I have chosen to handle it now</p>
  
  <pre><code>case MessageDlg('Save Changes?', mtWarning, [mbYes, mbNo, mbAbort], 0) of
    mrYes: ;
    mrNo: Dataset.Cancel;
    mrAbort: Abort;
    mrNone: Abort;
  end;
  </code></pre>