Re: Getting user's choices from a menu
- Posted by Kat <gertie at PELL.NET> Aug 13, 2000
- 435 views
On 13 Aug 2000, at 3:41, Beaumont Furniss wrote: > If you could construct something like this , that's easy to setup and > use , you'd have a number of persons interested . > This is probably something that many attempt at sometime , I know I > have , with varying degrees of success. > The conceptual difficulty is in making a generally usable , easily > constructed menu. I understand the concept. > > On 2000-08-13 EUPHORIA at LISTSERV.MUOHIO.EDU said: > EU>I'd appreciate some ideas about user-friendly and fool-proof ways > EU>of doing this: > EU>1 present the user with a menu of choices (not mutually > EU>exclusive): eg MENU OF USER CHOICES > EU>A this > EU>B that > EU>C other > EU>2 get user's choice(s): > EU>eg ENTER THE LETTER (A,B,C) OF YOUR CHOICE(S): > EU>3 suppose the choices are A and C. Is it preferable to read them > EU>as a "unit", or as separate items? Should I insist on spaces > EU>between choices? If so, what happens if the user enters AC instead > EU>of A C? What if the menu choices were numerals (1,2,3) instead of > EU>letters? Would the code differ? Would there be any different issues > EU>to take into account? Easy, since you know what you are looking for, throw away everything else. Then make the remaining items into the form you'd like, regardless of what they are, then pass that to your input. user: a,B,c program: upcase alphabet, delete all non-alphanumeric(,";;'<>,./?, spaces, etc) user: 1 2 3 program: upcase alphabet, delete all non-alphanumeric(,";;'<>,./?, spaces, etc) user: a 5, X program: upcase alphabet, delete all non-alphanumeric(,";;'<>,./?, spaces, etc) UNTESTED ( translated to Eu from mirc ) for loop = 1 to length(input) do inputseg = mid(input,loop,1) intermediatetemp = findtok(" A B C 1 2 3 ", inputseg ,1,32) if ( intermediatetemp != 0 ) then -- assuming a=1 b=2 and c=3, if not, then use other id#'s or something in the following line,, i'm just parsing the possible random input from user. NeedToDo = gettok(" routineid1 routineid2 routineid3 routineid1 routineid2 routineid3 " , intermediatetemp ,32) -- here, do something with NeedToDo, save it, exec it, display it, or something. -- Robert, this would be a great place for a "gosub(sequence SomeValidRoutineName)" or an "exec(sequence SomeVariableTheProgramMade)", something that makes the routineid() setup/calls transparently to the programmer. end if end for Kat, loving those string routines in strtok.e