Re: Menu Program

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

On 1/27/07, Rich Klender <guest at rapideuphoria.com> wrote:
>
> Does anyone know if there is a program in the archive that displays a
> simple text menu?  i.e.

Here's a good example:

include get.e

function do_menu( sequence title, sequence options, sequence prompt )

    integer min, max, sel

    min = 1
    max = length( options )

    printf( 1, "%s\n\n", {title} )
    for i = min to max do
        printf( 1, "    %d) %s\n", {i, options[i]} )
    end for

    prompt = "\n    " & prompt
    sel = prompt_number( prompt, {min, max} )

    return sel
end function

sequence options
integer sel

    options = {"Chevy", "Ford", "Dodge"}

    sel = do_menu( "Car Menu", options, "Please select a car:" )

    printf( 1, "\nYou selected %s!\n", {options[sel]} )


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

Search



Quick Links

User menu

Not signed in.

Misc Menu