File:  [Coherent Logic Development] / freem / mlib / %TUIMENU.m
Revision 1.1: download - view: text, annotated - select for diffs
Sun Jan 19 02:04:04 2025 UTC (2 months, 2 weeks ago) by snw
Branches: MAIN
CVS tags: HEAD
Initial revision

%TUIMENU ; FREEM MENU HANDLER
    Q
GO(S,I) ;
    N %,C,DS,OPT S (%,OPT)=""
    D DISP(S,I)
NXT S DS=1 W "Select ",$$G^%DB(S,I,"NAME")," Option//",$$G^%DB(S,I,"DEFAULT")," "
    R %
    I (%="q")!(%="Q") W " Quit",! Q
    I %="?" D DISP(S,I) G NXT
    S:%="" %=$$G^%DB(S,I,"DEFAULT"),DS=0
    S %=$TR(%,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    S:'$D(@S@(I,"OPTS",%)) %=""
    I %="" W !,"Invalid selection. Press ? to view all options.",! G NXT
    W:DS " " W @S@(I,"OPTS",%)
    I ('$D(@S@(I,"ACT",%)))&('$D(@S@(I,"TAG",%))) W !,"No action or tag defined for ",%,".",! G NXT
    K %TAG I $D(@S@(I,"TAG",%)) S %TAG=@S@(I,"TAG",%)
    I $D(@S@(I,"ACT",%)) S C="D "_@S@(I,"ACT",%) X C K C G NXT
    Q
DISP(S,I) ;
    N % S %=""
    W !,$$G^%DB(S,I,"DESC")," - ",$$G^%DB(S,I,"NAME"),!,!
    F  S %=$O(@S@(I,"OPTS",%)) Q:%=""  D
    . W "  ",%,") ",@S@(I,"OPTS",%),!
    W !,"  Q) Quit",!,!
    Q
    

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>