title: How to detect a User action compared to a Simulated action for a checkbox in a treeview?
body: <p>I have a treeview with a list of items that are expandable. When the user checks the checkbox for a parent node, I simulate checking the children nodes. However, the user can check any node (not just parent nodes). I want to distinguish the user's first click, which triggers the node's checkbox event, from the simulated checking of the children node's checkboxes.</p>
  <p>I want to distinguish the User's click so I can save the state of the treeview before it changes.</p>
  <p>I thought of using a mousedown event, but this doesn't work since the user might click to expand something and I do not want to save the state of the treeview since nothing changed. One way to make this work would be to calculate the dimensions of each checkbox location and then check the mousedown's click coordinates, but I would like to avoid doing this as it would not be easy since I have nested nodes so the check boxes have a few different columns they could be.</p>
  <p>Another way to think of this is I want to turn groups of events into actions. So one action would represent the User's first action, and all the simulated actions that followed until control is returned to the user.</p>
  <p>Another thought, maybe I could do something with window focusing or control. For instance if the window is not focused while simulating, I could just save on the focus change if it would occur during a User's action of checking a tree node's checkbox.</p>
  <h3>Additional info</h3>
  <p>The simulated checkbox clicks are invoked by code such as:</p>
  <p>e.Node.Checked = false;</p>
  <p>This triggers the event:
  private void tree_AfterCheck(object sender, System.Windows.Forms.TreeViewEventArgs e)</p>
  <p>When a user clicks a node, this AfterCheck event triggers. I want to save the state of the tree here. But inside the AfterCheck event, there are cases that check other nodes causing the AfterCheck event to trigger again n times, but this time the check for the checkbox was simulated.</p>
  <p>Systems.Windows.Forms.TreeView is the sender object in all cases.</p>