[Stackoverflow] [Progress OpenEdge ABL] Why can I sort columns in a browser?

Status
Not open for further replies.
D

Dominique

Guest
Normally StackOverflow questions are of the form "I don't know how to do something.", but this one is of the form "I know how to do something, but I don't understand why it works.".
More exactly, I'm clicking on the title column of a browser inside a regular window, and then the MOUSE-SELECT-CLICK event is triggered, causing the corresponding column to be sorted, ascending or descending, as you can see in the following source code:

Code:
DEFINE BROWSE browser-object
  QUERY browser-object DISPLAY
    temp_table.Field1 FORMAT ... COLUMN-LABEL "Label1"    
    temp_table.Field2 FORMAT ... COLUMN-LABEL "Label2"
    ...

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.

This is working:
When I click on the title of the column, the column gets sorted. When I click elsewhere in the column, nothing happens.

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.

You can say "Yes, so what? It's working, so what's the big deal?", 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.

Does anybody have an idea?
Thanks in advance

Continue reading...
 
Status
Not open for further replies.
Top