title: Why can I sort columns in a browser?
body: <p>Normally StackOverflow questions are of the form &quot;I don't know how to do something.&quot;, but this one is of the form &quot;I know how to do something, but I don't understand why it works.&quot;.<br />
  More exactly, I'm clicking on the title column of a browser inside a regular window, and then the <code>MOUSE-SELECT-CLICK</code> event is triggered, causing the corresponding column to be sorted, ascending or descending, as you can see in the following source code:</p>
  <pre><code>DEFINE BROWSE browser-object
    QUERY browser-object DISPLAY
      temp_table.Field1 FORMAT ... COLUMN-LABEL &quot;Label1&quot;    
      temp_table.Field2 FORMAT ... COLUMN-LABEL &quot;Label2&quot;
      ...
  
  DEFINE VARIABLE L-logical-Field1 AS LOGICAL INITIAL TRUE.
  DEFINE VARIABLE L-logical-Field2 AS LOGICAL INITIAL TRUE.
  ...
  
  ON MOUSE-SELECT-CLICK OF temp_table.Field1 IN BROWSE browser-object
  DO:
      IF L-logical-Field1
      THEN OPEN QUERY browser-object FOR EACH temp_table BY temp_table.Field1.
      ELSE OPEN QUERY browser-object FOR EACH temp_table BY temp_table.Field1 DESC.
      L-logical-Field1 = NOT L-logical-Field1.
  END.
  ON MOUSE-SELECT-CLICK OF temp_table.Field2 IN BROWSE browser-object
  DO:
      IF L-logical-Field2
      THEN OPEN QUERY browser-object FOR EACH temp_table BY temp_table.Field2.
      ELSE OPEN QUERY browser-object FOR EACH temp_table BY temp_table.Field2 DESC.
      L-logical-Field2 = NOT L-logical-Field2.
  END.
  </code></pre>
  <p>This is working:<br />
  When I click on the title of the column, the column gets sorted. When I click elsewhere in the column, nothing happens.</p>
  <p>But WHY does it work? In the source code I have written what to do when I click in the column ANYWHERE, I did not specify that the title column should be clicked, but still it's working.</p>
  <p>You can say &quot;Yes, so what? It's working, so what's the big deal?&quot;, but I fear that later the customer might ask me to program some behaviour when the column is clicked above a certain tuple and asks me to do something with that particular tuple, and I won't have the smallest idea how to start.</p>
  <p>Does anybody have an idea?</p>