Selection List Items

jamesmc

Member
Hi all,

I have got a selection list on screen that has a series of values in it. I used the add-last method like the following: add-last(ProgDesc1, ProgExec1) where ProgDesc1 is shown in the listbox and I was hoping that when a user double clicked on that specific line I could get hold of the ProgExec1 value and use it but all of the help that I can get hold of seems to tell me that I can add a second value, but I can't use it.

Can anyone throw any help or info my way?

TIA,

James.
 

rich_t

New Member
Hi,

From your code example I presume you are using v9 and you are using selection pairs. Testing the value of your selection list will return the second value, ie:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
ON DEFAULT-ACTION OF SL-selectionlist DO:

ASSIGN SL-selectionlist.

/* whenever you reference SL-selectionlist from now on you will get the second, non screen value */

END. /* user double clicked or hit return */
[/code]

Hope this helps.

Rich
 

jamesmc

Member
Hi there Rich,

Sorry but your solution didn't seem to work for me. I am programming in version 8.3 GUI in the UIB. Basically, the selection list is going to hold a list of program descriptions with the hidden data being the program names. When a user double-clicks on a program description, my default-action would be to run value(selection:hidden-value) or something to that effect.

TIA,

James.
 

rich_t

New Member
Ok James, I'm with you now.


Your problem here is probably with your delimiter. In v8 I do the following with selection lists (since v8 doesnt support selection list pairs):


<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
ASSIGN SL-selectionlist:delimiter="|" /* pipe character */
SL-selectionlist:list-items="".


FOR EACH whatever:


SL-selectionlist:ADD-LAST(
populate selection list with comma delimited pairs).


END. /* each whatever */


ON DEFAULT-ACTION OF SL-selectionlist
DO:


ASSIGN SL-selectionlist.


IF NUM-ENTRIES(SL-selectionlist)=2
THEN DO:


do whatever you want with TRIM(ENTRY(2,SL-selectionlist))


END. /* must be a valid entry */


END. /* user double clicked or pressed enter */
[/code]

If I want to hide the second item from the user I do this:


<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
SL-selectionlist:add-last(first item + FILL(" ",100) + "," + second item.
[/code]


Adjust the fill statement to suit the smallest possible first value which will push the comma off screen and make sure your selection list format can hold all the characters x(256) "the default" should be enough.


A bit memory hungry, but if your list isn't too big then not really a problem.


Hope this helps.


Rich


<FONT COLOR="#000000" SIZE="1" FACE="Arial, Verdana">[This message has been edited by rich_t on 16 June 2000 @ ]</font>

<FONT COLOR="#000000" SIZE="1" FACE="Arial, Verdana">[This message has been edited by rich_t on 16 June 2000 @ ]</font>

<FONT COLOR="#000000" SIZE="1" FACE="Arial, Verdana">[This message has been edited by rich_t on 17 June 2000 @ ]</font>
 
Top