Re: Getting user's input from a menu of choices

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Sun, 13 Aug 2000, Alex wrote:
<snip>
> I'm particularly interested in ending up with a sequence of numbers,
> because I want to use them as indices for elements of other sequences Eg:
> sequence all_choices, choice
>
>     all_choices = { "up", "down", "right", "left", "stop" }
>
>     for i = 1 to length(choice) do -- where choice = {1,3,2}
>         index = choice[1]
>         puts(1, all_choices[index])
>     end for
>
> Thanks in advance for any newbie-level solutions.
>
> Alex Caracatsanis

Hi Alex:
This will do what you want:

include graphics.e -- for color names
include dialogs.e -- dialogs

constant choices = {"This","That","TheOther"}
object result

position(10,20) -- position the box
SetSize(10,50) -- size of box
result = CheckBox("Please select one or more",choices)

for i = 1 to length(result) do
 result[i]= find(result[i],choices)
end for
? result

-- result returns a sequence, {} = no choices,
-- {1,3} if  choices were"This" and "TheOther", etc.

Regards,
Irv

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu