Re: how do i exit pop up window without escaping
Posted in 1997
Stafford, I have a routine that I use that I think will provide you with what your looking for. If not it may be close enough for you to paly with and make it fit your needs. It is written in 4GL and my variable naming standards probably won't make much since to what they are being used for but you should be able to figure it out. {############################################################################## # Function : vert_menu # Date : 09/12/96 # Description : This function performs the display and selection of a # : vertical menu # # Received Parameters: Mtotal (Total number of array elements to display) # : Mstart (The starting position of the menu) # # Returned Parameters: Mln (The option number of the selection) # ###############################################################################} function vert_menu(Mtotal,Mstart) define Mtotal,Mi,Mx,Mj,Mstart smallint, Ml,Mln char(2), Mvalid char(25), A_options array[25] of char(33) let Mln=Mstart let Ml=Mstart let Mvalid="123456789~10~11~12~13~14" let A_options[1]=" 1. Report 1 " let A_options[2]=" 2. Report 2 " let A_options[3]=" 3. Report 3 " let A_options[4]=" 4. Report 4 " let A_options[5]=" 5. Report 5 " let A_options[6]=" 6. Report 6 " let A_options[7]=" 7. Report 7 " let A_options[8]=" 8. Report 8 " let A_options[9]=" 9. Report 9 " let A_options[10]=" A. Report 10 " let A_options[11]=" B. Report 11 " let A_options[12]=" C. Report 12 " let A_options[13]=" D. Report 13 " let A_options[Mtotal]=" Q. Quit the Reports Menu " let Mx=2 for Mi=1 to Mtotal display A_options[Mi] at Mx,2 let Mx=Mx+1 end for let Mx=Mstart+1 display A_options[Mstart] at Mx,2 attribute(reverse) while Ml<>Mtotal prompt " " for char Ml on key(escape) let Ml=Mtotal on key(up,left) let Mj=Mln display A_options[Mj] at Mx,2 if Mln="1" then let Mx=Mtotal+1 let Mln=Mtotal else let Mx=Mx-1 let Mln=Mln-1 end if let Mj=Mln display A_options[Mj] at Mx,2 attribute(reverse) let Ml=" " continue while on key(down,right) let Mj=Mln display A_options[Mj] at Mx,2 if Mln=Mtotal then let Mx=2 let Mln="1" else let Mx=Mx+1 let Mln=Mln+1 end if let Mj=Mln display A_options[Mj] at Mx,2 attribute(reverse) let Ml=" " continue while end prompt if Ml="0" then let Ml=" " let Mln=Mx-1 call ring_bell() continue while end if if Ml="q" or Ml="Q" then let Ml=Mtotal let Mln=Ml exit while end if if is_in(Ml,"AaBbCcDd") then let Ml=ord(upshift(Ml))-55 end if if fgl_lastkey()<>fgl_keyval("return") then let Mln=Ml else let Ml=Mln end if if not is_in(Mln,Mvalid clipped) then let Ml=" " let Mln=Mx-1 call ring_bell() continue while end if for Mi=1 to Mtotal let Mx=Mi+1 if Mln=A_options[Mi][2,2] then display A_options[Mi] at Mx,2 attribute(reverse) else display A_options[Mi] at Mx,2 end if end for exit while end while return Mln end function {############################################################################## # Function : is_in # Date : 08/24/95 # Description : This function evaluates string1 in string2 # # Received Parameters: Mstring1 (what you are searching for) # : Mstring2 (what you are searching in) # # Returned Parameters: true or false # ###############################################################################} function is_in(Mstring1,Mstring2) define Mstring1,Mstring2 varchar(255), Mi,Mk,Mlen_find,Mlen_str smallint let int_flag=false whenever any error call oh_no let Mlen_find=length(Mstring1) let Mlen_str=length(Mstring2) for Mi=1 to Mlen_str-Mlen_find+1 let Mk=Mi+Mlen_find-1 if Mk<Mi then let Mk=Mi end if if Mstring1=Mstring2[Mi,Mk] and Mi<=Mlen_str then return true end if end for return false end function -- Joseph Cullipher |E-mail: joseph@cannonexpress.com PO Box 364 |opinions express are those of my own and Springdale, AR 72764 USA |don't necessarily reflect those of my company On Mon, 17 Feb 1997, Stafford Wright wrote: > I would be delirious if anyone could help me with the following: > > I am writing a menu system and am trying to use a display array > statement to write to a window using data from a menu table. The > problem is if the array is large then one would have use ones arrow > keys too extensively to get to the right option before being able to > hit escape. > > What I would like is some way that the display array could just > display the menu options and then exit out of the display without one > having to hit escape and the user could then enter a number option > manually outside the display.. > > Thanks > > Stafford Wright >