title: How to Exit() early if TSpeedButton is already Down?
body: <p>I have two <code>TSpeedButton</code>: <code>btn1</code> and <code>btn2</code>. Their properties are set so they act together in a group and are mutually exclusive, which means that when one button is pressed the other button is automatically unpressed:</p>
  
  <pre><code>AllowAllUp = False
  GroupIndex = 1
  OnClick = onSpeedButtonsClick
  </code></pre>
  
  <p>I have some code in <code>onSpeedButtonsClick()</code> that runs some code depending on which of the two buttons was clicked.</p>
  
  <p>What I'm trying to do is to make it so that if <code>btn1</code> is currently <code>Down</code>, and the user presses this button, nothing should happen:</p>
  
  <pre><code>procedure frmMyForm.onSpeedButtonsClick(Sender: TObject);
  begin
    { Don't do anything if the clicked button is already currently pressed down. }
    if ((Sender = btn1) and btn1.Down) or
         ((Sender = btn2) and btn2.Down) then
      Exit();
  
    { ... some other code here that should only run when
      the `Down` state of the buttons changes }
  end;
  </code></pre>
  
  <p>The problem is that when <code>btn1</code> is currently down and the user presses <code>btn2</code>, the <code>Down</code> property of <code>btn2</code> is set to <code>True</code> <strong>before</strong> <code>onSpeedButtonsClick()</code> executes, so it <code>Exit()</code>s early no matter what.</p>