Kbase P16432: How to move items in a Selection-List (Up or Down) (Like the
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  25/11/2003 |
|
Status: Unverified
GOAL:
How to move items in a Selection-List (Up or Down) (Like the query builder)
SYMPTOM(s):
windows
FIX:
This sample code also enables and disables the up & down buttons depending on the selected item in the selection-list;
/*Define these Variables*/
DEF VAR X AS INTEGER.
DEF VAR Y AS CHAR.
/*On Value change trigger of the select*/
ON VALUE-CHANGED OF SELECT-1 IN FRAME fMain
DO:
ASSIGN select-1 = select-1:SCREEN-VALUE
Y = Select-1:SCREEN-VALUE
X = select-1:LOOKUP(Y).
CASE X:
WHEN 1 THEN
BUTTON-UP:SENSITIVE = FALSE.
OTHERWISE
BUTTON-UP:SENSITIVE = TRUE.
END CASE.
CASE X:
WHEN SELECT-1:NUM-ITEMS THEN
BUTTON-Down:SENSITIVE = FALSE.
OTHERWISE
BUTTON-Down:SENSITIVE = TRUE.
END CASE.
/*Code for the Down Button*/
ON CHOOSE OF BUTTON-Down IN FRAME fMain /* Down */
DO:
Select-1:DELETE(Y).
Select-1:INSERT( Y , X + 1).
Select-1:screen-value = Y.
Apply 'VALUE-CHANGED' to select-1.
END.
/*Code for the Up Button*/
ON CHOOSE OF BUTTON-UP IN FRAME fMain /* Up */
DO:
Select-1:DELETE(Y).
Select-1:INSERT( Y , X - 1).
Select-1:screen-value = Y.
Apply 'VALUE-CHANGED' to select-1.
END.