Re: Table-driven ring menus
Posted in 1997
Topics: Stored Procedures & SPL
to be more specific, try this:
#ident "@(#)menpro:Menu Processor"
define
men_array array[2,32] of record
men_mncd like mndt_tabl.mndt_mncd,
men_numb like mndt_tabl.mndt_numb,
men_type like mndt_tabl.mndt_type,
men_text char(37),
men_path like mndt_tabl.mndt_path
end record,
men_start like mndt_tabl.mndt_mncd,
dbe_xplan char(30)
main
define
f_user char(10)
defer interrupt
defer quit
let f_user = fgl_getenv("LOGNAME")
open window menwind at 2,2 with 22 rows, 78 columns attribute
(border)
let dbe_xplan=fgl_getenv("DBEXPLAIN")
if dbe_xplan = "Y" then
set explain on
else
set explain off
end if
let men_start=fgl_getenv("MENU")
call show_menu(men_start)
end main
function show_menu(wrk_mncd)
define
wrk_mncd char(6),
end_menu char(1),
men_idx1 smallint,
men_idx2 smallint,
sav_indx smallint,
f_date date,
wrk_mnnm like mnms_tabl.mnms_mnnm
let end_menu = "N"
while end_menu = "N"
clear window menwind
let f_date = today
select mnms_mnnm into wrk_mnnm from mnms_tabl
where mnms_tabl.mnms_mncd = wrk_mncd
display wrk_mnnm, " ", g_user.user_logn,
f_date using "dd/mm/yyyy", " ", wrk_mncd
at 03,01 attribute(reverse)
call fgl_drawbox(1,78,20,1)
display " " at 20,1
display " " at 20,78
menu men_array[1,1].men_mncd
before menu
declare men_curs cursor for
select * from mndt_tabl
where mndt_mncd = wrk_mncd
for men_idx1 = 1 to 32
let men_array[1,men_idx1].men_text = men_idx1 using "&&"
initialize men_array[2,men_idx1].* to null
end for
let men_idx1 = 1
let men_idx2 = 1
foreach men_curs into
men_array[2,men_idx2].men_mncd,
men_array[2,men_idx2].men_numb,
men_array[2,men_idx2].men_type,
men_array[2,men_idx2].men_text,
men_array[2,men_idx2].men_path
if men_array[2,men_idx2].men_type = "P" or
men_array[2,men_idx2].men_type = "F" or
men_array[2,men_idx2].men_type = "M" then
let men_array[2,men_idx2].men_text =
men_idx1 using "&&", "-", men_array[2,men_idx2].men_text
let men_array[1,men_idx1].* = men_array[2,men_idx2].*
let men_idx1 = men_idx1 + 1
if men_array[2,men_idx2].men_type = "M" then
let men_array[2,men_idx2].men_text =
men_array[2,men_idx2].men_text clipped, " ..."
end if
end if
let men_idx2 = men_idx2 + 1
end foreach
let sav_indx = men_idx2 -1
for men_idx1 = men_idx1 to 32
hide option men_array[1,men_idx1].men_text
end for
if sav_indx < 9 then
call scr1_loop(4,20,1,sav_indx)
else
if sav_indx > 8 and sav_indx < 16 then
call scr1_loop(4,20,1,sav_indx)
else
call scr1_loop(4,2,1,sav_indx/2)
call scr1_loop(4,41,(sav_indx/2)+1,sav_indx)
end if
end if
command men_array[1,1].men_text
if run_option (men_array[1,1].*) = "M" then
exit menu
end if
command men_array[1,2].men_text
if run_option (men_array[1,2].*) = "M" then
exit menu
end if
command men_array[1,3].men_text
if run_option (men_array[1,3].*) = "M" then
exit menu
end if
command men_array[1,4].men_text
if run_option (men_array[1,4].*) = "M" then
exit menu
end if
command men_array[1,5].men_text
if run_option (men_array[1,5].*) = "M" then
exit menu
end if
command men_array[1,6].men_text
if run_option (men_array[1,6].*) = "M" then
exit menu
end if
command men_array[1,7].men_text
if run_option (men_array[1,7].*) = "M" then
exit menu
end if
command men_array[1,8].men_text
if run_option (men_array[1,8].*) = "M" then
exit menu
end if
command men_array[1,9].men_text
if run_option (men_array[1,9].*) = "M" then
exit menu
end if
command men_array[1,10].men_text
if run_option (men_array[1,10].*) = "M" then
exit menu
end if
command men_array[1,11].men_text
if run_option (men_array[1,11].*) = "M" then
exit menu
end if
command men_array[1,12].men_text
if run_option (men_array[1,12].*) = "M" then
exit menu
end if
command men_array[1,13].men_text
if run_option (men_array[1,13].*) = "M" then
exit menu
end if
command men_array[1,14].men_text
if run_option (men_array[1,14].*) = "M" then
exit menu
end if
command men_array[1,15].men_text
if run_option (men_array[1,15].*) = "M" then
exit menu
end if
command men_array[1,16].men_text
if run_option (men_array[1,16].*) = "M" then
exit menu
end if
command men_array[1,17].men_text
if run_option (men_array[1,17].*) = "M" then
exit menu
end if
command men_array[1,18].men_text
if run_option (men_array[1,18].*) = "M" then
exit menu
end if
command men_array[1,19].men_text
if run_option (men_array[1,19].*) = "M" then
exit menu
end if
command men_array[1,20].men_text
if run_option (men_array[1,20].*) = "M" then
exit menu
end if
command men_array[1,21].men_text
if run_option (men_array[1,21].*) = "M" then
exit menu
end if
command men_array[1,22].men_text
if run_option (men_array[1,22].*) = "M" then
exit menu
end if
command men_array[1,23].men_text
if run_option (men_array[1,23].*) = "M" then
exit menu
end if
command men_array[1,24].men_text
if run_option (men_array[1,24].*) = "M" then
exit menu@