assigning selection-list screen-value???

Fugey00

New Member
Hi!

I have a selection-list with the default value "ALL" selected by default. Multiple selection can be made in the list.

What i'm trying to do is if another selection is made, i want to automaticly unselect the "ALL" one.

I'm trying to do this in the value-changed like this ????
Trying to remove the "ALL" entry from the screen-value, but when i assign the NewValue# to screen-value.... it doesn't changed anything ???? why ????

ON VALUE-CHANGED of lst# DO:
run CheckChoiceALL(Self:handle).
END.

here's the procedure :
Procedure CheckChoiceALL.
def input parameter hSelect as widget-handle.

def var PosDep# as int.
def var NewValue# as char.

/* Verify if ALL is selected */
if hSelect:Is-Selected("0") then do:
PosDep# = index(hSelect:screen-value, ",0").
if PosDep# <> 0 then do:
message ",0" posdep# substring(hSelect:screen-value, 1, PosDep# - 1). pause.
NewValue# = substring(hSelect:screen-value, 1, PosDep# - 1).
message "apres" NewValue#. pause.
hSelect:screen-value = NewValue#.
message "apres-2" hSelect:screen-value. pause.
end.
else do:
PosDep# = index(hSelect:screen-value, "0,").
if PosDep# <> 0 then do:
hSelect:screen-value = substring(hSelect:screen-value, PosDep#, 2).
end.
end.
end.
end.
 

Fugey00

New Member
Solution found !!!

It seems that you can assign or work directly on the screen-value.... found an exemple that work with a tmp variable an then assign "" to screen-value befor assigning the tmp variable to screen-value.

done it this way !!!

/*********************************************/
Procedure CheckChoixTous.
def input parameter hSelect as widget-handle.
def var TmpList# as char.
def var NewSelect# as char.
def var x as int.

/* si plus d'un choix et que "TOUS" n'etais pas selectionnner, mais vient d'etre
choisi, on conserve seulement le choix "TOUS" */
if num-entries(hSelect:Screen-value) > 1 and
Lookup("0", hSelect:private-data) = 0 and hSelect:Is-selected("0") then do:
hSelect:Screen-value = "".
hSelect:Screen-value = "0".
/* Positionne sur le choix "TOUS" */
hSelect:Scroll-to-item("0").
end.
/* si une autre choix est selectionner et que "TOUS" etais deja selectionner */
else if num-entries(hSelect:screen-value) > 1 and hSelect:Is-Selected("0") then do:
TmpList# = hSelect:SCREEN-VALUE.
/* Recherche le nouveau choix */
do x = 1 to num-entries(TmpList#):
if lookup(entry(x, TmpList#), hSelect:private-data) = 0 then
NewSelect# = entry(x, TmpList#).
end.
/* Enleve "TOUS" de la selection */
ENTRY(Lookup("0", TmpList#), TmpList#) = "".
/* enlever la virgule de trop */
X = Length(TmpList#).
/* si , a la fin */
if substring(TmpList#, x, 1) = "," then
TmpList# = SUBSTRING(TmpList#, 1, (x - 1)).
/* si virgule au debut */
else if substring(TmpList#, 1, 1) = "," then
TmpList# = SUBSTRING(TmpList#, 2, (x - 1)).

/* si virgule au milieu */
else
TmpList# = replace(TmpList#, ",,", ",").
/* Important de vide screen-value avant de le reassigner */
hSelect:SCREEN-VALUE = "".
hSelect:SCREEN-VALUE = TmpList#.
/* Position sur le dernier choix faite */
hSelect:Scroll-to-item(NewSelect#).
end.
/* keeps old value in there */
hSelect:private-data = hSelect:Screen-value.
end.
 
Top