Help using Base SAS procedures

SAS/AF How to determine which selection is chosen in a listbox

Reply
New Contributor EdD
New Contributor
Posts: 4

SAS/AF How to determine which selection is chosen in a listbox

Hi everyone. I am a beginning AF programmer although I do have a few years in base SAS. I am trying to use a LISTBOX to present choices for a user to select one by tabbing, clicking, or scrolling to. Since I am porting this to a mainframe, I must be able to capture the enter key being used to know when a selection is made. I have been playing with the EVENT() capture and can't seem to get that to work right. Does anyone have any suggestions?

Thanks, Ed
Respected Advisor
Posts: 2,993

Re: SAS/AF How to determine which selection is chosen in a listbox

It would be helpful if you could provide your SCL code so we can see what you are trying to do.
New Contributor EdD
New Contributor
Posts: 4

Re: SAS/AF How to determine which selection is chosen in a listbox

The SCL code is what I am trying to create. I have a listbox on a frame. I populated the listbox and can see movement when I use the mouse or cursor. I want to execute a specific group of SAS code based on the selection from the listbox. How can I know the user 'selected' one of the entries rather than scrolled down using the cursor control?
Grand Advisor
Posts: 10,029

Re: SAS/AF How to determine which selection is chosen in a listbox

I don't have references for AF currently but I would look at the methods associated with listboxes. I vaguely remember being able to do something like:

rc =get_selected(listboxidentifier);

But I think the RC was the list item identfier not the actual value displayed in the box.

It didn't matter if you used a mouse or key strokes to navigate the list.
Occasional Contributor
Posts: 9

Re: SAS/AF How to determine which selection is chosen in a listbox

If your listbox is named lstbox then use this code in a labeled section:

lstbox:
value = lstbox.selecteditem ;
put value = ;
return ;
New Contributor EdD
New Contributor
Posts: 4

Re: SAS/AF How to determine which selection is chosen in a listbox

I have tried both methods and I can get the return code along with the value, however it does not matter if I use the tab or down arrow on the keyboard it appears as if the item was selected when in reality it was just scrolled past. I have tried to capture the enter key being pressed as an EVENT(), but that does not seem to work either.
Occasional Contributor
Posts: 9

Re: SAS/AF How to determine which selection is chosen in a listbox

Try http://support.sas.com - then click on submit a problem. The SAS/AF tech support group is exceptionally good.
Grand Advisor
Posts: 10,029

Re: SAS/AF How to determine which selection is chosen in a listbox

Again, I haven't worked in a multiple OS environment such as you currently have for a long time, but some of the mainframes differentiate between HIGHLIGHTING, moving through a list with keys, and then SELECTING the highlighted one. I vaguely remember tabing through lists and then using a + key to select in CMS for example. It may be that the selection hasn't happened.
Ask a Question
Discussion stats
  • 7 replies
  • 89 views
  • 0 likes
  • 4 in conversation