Disabling an item in a selection-list

Posted by ankitshukla on 09-Apr-2020 15:47

Is there any way to disable an item in a selection list?

For example: I have three items A,B,C. I want to disable 'B' so that except 'B' all other item will be shown as selectable entries.

If it is not possible then will it be possible through handles. I mean if I somehow get the handle of item B and then apply sensitive = false. Will it work?

Posted by Matt Gilarde on 09-Apr-2020 16:00

There's no way to disable individual items in a normal ABL selection list. There may be .NET list controls which support this behavior but unless you're already using .NET in the application that's probably not a reasonable workaround.

All Replies

Posted by Matt Gilarde on 09-Apr-2020 16:00

There's no way to disable individual items in a normal ABL selection list. There may be .NET list controls which support this behavior but unless you're already using .NET in the application that's probably not a reasonable workaround.

Posted by mio on 09-Apr-2020 16:19

That's easy; Our preferred way as follow:

1. When loading your selection list (ADD-LAST method), for the entry item you want to protect, but still show to the user, place a character, an "X" at column 100.

 To position an "X" at column 100, simply do something like this:

  ASSIGN wp-method-return = wp-combo-actif:ADD-LAST({"PROTECTED ITEM" + FILL(" ", 100 - LENGTH ("PROTECTED ITEM")) + "X") IN FRAME main-fr.

2. Make sure you selection list does not show this special character by setting the size of the selection list less than 100 char wide, may be 50 or so.

3. Then when the user select that special protected entry, you validate position 100 ; if it contains an "X", then you do something, else you do something else.

   Example:

    IF SUBSTRING(wp-combo-actif:SCREEN-VALUE IN FRAME main-fr, 101) = "1" THEN DO:

Posted by Brian K. Maher on 09-Apr-2020 16:26

Or you can simply rebuild the list-items so only valid choices appear.
 

Posted by ankitshukla on 10-Apr-2020 11:14

Thanks Mio,

But I just wanted to show that protect-item in the list as disable entry. So, it will be shown to user but non-selectable. Or may be any way out where I can change the color for that item only

Posted by ankitshukla on 10-Apr-2020 11:19

Thanks Brian.

How rebuilding the list-items helps?

Posted by Brian K. Maher on 10-Apr-2020 12:10

It removes the unwanted items.  If your user can accept that, it would be the simplest answer.  For me, seeing things I can’t select is bad UI.
 

Posted by ankitshukla on 14-Apr-2020 08:38

It seems that there is no such option available to disable an item in a normal ABL selection list

This thread is closed