Selection List in progress 8.3B

JvdB

Member
Hello All,

Could anybody tell me how to make a selection list in progress 8.3B that shows for example "Tekst" as label but uses for example 1 as the actual value? (i heard of list-item-pairs, but starting to think that it is version 9 and not 8.3B where i can do that)

Thnx already,

J.
 

pejgan

New Member
ugly but working..

The way we had to do it before version 9 was to put the text visible in the list, and the corresponding code in for example pos. 80, not showing on screeen.

It's not a nice thing to do, but who does it hurt?

If you don't want to do that you probably have to store some type of strings like this:

"usa,canada,france,sweden"
"1,2,3,4"
and then use entry() to find the corresponding code.

..or you could have a separate table connecting them..


That's all I can think of at the moment!
 
A bit more elegant

I don't recall whether LIST-ITEM-PAIRS was available in V8, but assuming that it wasn't, you could do this:

1. Place your screen-values/labels in the list, as you currently do.

2. Place the corresponding 'key' values in the PRIVATE-DATA area of the selection list, as a comma-separated list. Make sure that the order matches the label order.

3. Create yourself a function to return the value. For example, if you want to associate integers with the character list item labels, then you could do this:

FUNCTION getListValue RETURNS INTEGER (pSelect AS HANDLE):

RETURN INTEGER(ENTRY(pSelect:LOOKUP(pSelect:SCREEN-VALUE),pSelect:pRIVATE-DATA)).

END.

You can then get the corresponding integer value by calling the function, passing the handle of the selection list. For example:

DEFINE VARIABLE iKey AS INTEGER NO-UNDO.

ASSIGN iKey = getListValue(SELECT-1:HANDLE).

But note:

Don't click the 'sort' attribute for the selection list. If you need to sort entries, then you'll have to sort them manually and sort the PRIVATE-DATA area too.
 
Top