home *** CD-ROM | disk | FTP | other *** search
File List | 1988-09-12 | 20.3 KB | 673 lines |
- '
- ' Menu builder by David Plotkin
- '
- ' Copyright 1988 Antic Publishing Inc.
- '
- Rez=Xbios(4) !check resolution
- ' Rez=1 for med res (640x200), 2 for hi res (640x400)
- If Rez=0
- A$="Menu Builder | must be | run in Med. or Hi Rez"
- Alert 1,A$,1," OK ",Dum
- Edit
- Endif
- '
- ' Menu_bar$ holds menu string
- ' Menutitle$ holds text of menu titles (max 10)
- ' Submenu$ holds text of submenu items (max 10 for each title)
- ' Dxpos is x position of dialog box, Dypos is y position
- ' Dwidth is width of dialog box, Dheight is the height
- ' Temp$ is temporary string for storing the screen
- ' Nummenus% is the number of menu titles (total)
- ' Numsubmenus% is the number of submenus under each menu title
- '
- Max_menu%=150
- Dim Menu_bar$(Max_menu%),Menutitles$(10),Submenus$(10,10)
- Dim Temp$(32000),Numsubmenus%(10)
- Gosub Initialize
- Gosub Menusetup
- Menu Menu_bar$()
- On Menu Gosub Menu_handler
- On Menu Button 1,1,1 Gosub Menubutton
- On Menu Message Gosub Respondmsg
- Titlew 1,"GFA Menu Builder"
- Openw 1
- Aftererror:
- Do
- On Menu
- Loop
- Procedure Menubutton
- ' respond to press of the mouse button
- Xmouse=Menu(10) !x coordinate of mouse
- Ymouse=Menu(11) !y coordinate of mouse
- Found%=0
- A%=1+(Rez-1)
- If Xmouse>450 And Xmouse<480 And Ymouse>8*A%+Yoff1% And Ymouse<18*A%+Yoff1%
- ' over the UP arrow in the number of menus section
- Graphmode 3 !XOR mode
- Pbox 450,8*A%,480,18*A%
- If Nummenus%<6
- Nummenus%=Nummenus%+1
- Menutitles$(Nummenus%)="Menu"+Str$(Nummenus%)
- Numsubmenus%(Nummenus%)=4
- For Lp2%=1 To 4
- Submenus$(Nummenus%,Lp2%)="Item"+Str$(Lp2%)
- Next Lp2%
- Menu Kill
- Gosub Menusetup
- Menu Menu_bar$()
- Else
- A$="Only six menus | are allowed!"
- Alert 3,A$,1,"Sorry",Dum
- Endif
- Pbox 450,8*A%,480,18*A%
- Graphmode 1 !back to REPLACE mode
- Gosub Drawnummenus
- Gosub Drawtitles
- Gosub Drawnumsubmenus
- On Menu Gosub Menu_handler
- On Menu Button 1,1,1 Gosub Menubutton
- On Menu Message Gosub Respondmsg
- Found%=1
- Endif
- If Xmouse>510 And Xmouse<540 And Ymouse>8*A%+Yoff1% And Ymouse<18*A%+Yoff1% And Found%=0
- ' over the DOWN arrow in the number of menus section
- Graphmode 3 !XOR mode
- Pbox 510,8*A%,540,18*A%
- If Nummenus%>1
- Nummenus%=Nummenus%-1
- Menu Kill
- Gosub Menusetup
- Menu Menu_bar$()
- Else
- A$="Must have at | least one menu!"
- Alert 3,A$,1,"Sorry",Dum
- Endif
- Pbox 510,8*A%,540,18*A%
- Graphmode 1
- Clearw 1
- Gosub Drwwindow1
- On Menu Gosub Menu_handler
- On Menu Button 1,1,1 Gosub Menubutton
- On Menu Message Gosub Respondmsg
- Found%=1
- Endif
- For Ln%=1 To Nummenus%
- If Found%=0 ! not found yet, so check for title box
- Upbound%=(Ln%*10)*A%+30*A%
- Lowbound%=Upbound%+10*A%
- If Xmouse>10 And Xmouse<300 And Ymouse>Upbound%+Yoff1% And Ymouse<Lowbound%+Yoff1%
- ' over a menu title box
- L%=Ln% !store found variable
- Graphmode 3
- Pbox 10,Upbound%,300,Lowbound%
- Gosub Drag_box(12,Upbound%+1+A%,300,Lowbound%-A%) !drag a box
- Ct%=0
- Fnd%=0 !found flag
- While Ct%<Nummenus% And Fnd%=0
- Ct%=Ct%+1 !increment the counter
- Up%=(Ct%*10)*A%+30*A%
- Low%=Up%+10*A%
- If Eex>=10 And Eex=<300 And Eey>=Up%+Yoff1% And Eey<=Low%+Yoff1%
- Fnd%=1
- Endif
- Wend
- If Ct%=L% !still in the same place, so change the title
- Gosub Getnewtitle
- Else !otherwise
- If Fnd%=1 ! found something
- Swap Menutitles$(Ct%),Menutitles$(L%)
- Swap Numsubmenus%(Ct%),Numsubmenus%(L%)
- Hold%=Numsubmenus%(Ct%) ! and the # of items in the destination
- If Numsubmenus%(L%)>Numsubmenus%(Ct%) !use larger value
- Hold%=Numsubmenus%(L%)
- Endif
- For Lp3%=1 To Hold% !for each submenu in the destination
- Swap Submenus$(Ct%,Lp3%),Submenus$(L%,Lp3%)
- Next Lp3%
- Endif
- Endif
- Menu Kill
- Gosub Menusetup
- Menu Menu_bar$()
- Pbox 10,Upbound%,300,Lowbound%
- Graphmode 1
- Clearw 1
- Gosub Drwwindow1
- On Menu Gosub Menu_handler
- On Menu Button 1,1,1 Gosub Menubutton
- On Menu Message Gosub Respondmsg
- Found%=1 !trigger the "found" flag
- Endif
- If Xmouse>350 And Xmouse<410 And Ymouse>Upbound%+Yoff1% And Ymouse<Lowbound%+Yoff1%
- ' Over the "DELETE" button
- Graphmode 3
- Pbox 350,Upbound%,410,Lowbound%
- If Nummenus%>1 !can't get rid of the last menu
- If Ln%<Nummenus% !don't need to manipulate menus if del. last one
- For Lq%=Ln% To Nummenus%-1
- Menutitles$(Lq%)=Menutitles$(Lq%+1)
- For Llq%=1 To Numsubmenus%(Lq%+1) !move submenu items
- Submenus$(Lq%,Llq%)=Submenus$(Lq%+1,Llq%)
- Next Llq%
- Numsubmenus%(Lq%)=Numsubmenus%(Lq%+1)
- Next Lq%
- Endif
- Nummenus%=Nummenus%-1 !reduce the number of menus
- Menu Kill
- Gosub Menusetup
- Menu Menu_bar$()
- Pbox 350,Upbound%,410,Lowbound%
- Graphmode 1
- Clearw 1
- Gosub Drwwindow1
- On Menu Gosub Menu_handler
- On Menu Button 1,1,1 Gosub Menubutton
- On Menu Message Gosub Respondmsg
- Found%=1 !trigger the "found" flag
- Else
- A$="Must have at | least one menu!"
- Alert 3,A$,1,"Sorry",Dum
- Pbox 350,Upbound%,410,Lowbound%
- Found%=1
- Endif
- Endif
- If Xmouse>450 And Xmouse<480 And Ymouse>Upbound%+Yoff1% And Ymouse<Lowbound%+Yoff1%
- ' over the up arrow for number of submenus
- Graphmode 3
- Pbox 450,Upbound%,480,Lowbound%
- If Numsubmenus%(Ln%)<10
- Numsubmenus%(Ln%)=Numsubmenus%(Ln%)+1
- Submenus$(Ln%,Numsubmenus%(Ln%))="Item"+Str$(Numsubmenus%(Ln%))
- Menu Kill
- Gosub Menusetup
- Menu Menu_bar$()
- Pbox 450,Upbound%,480,Lowbound%
- Graphmode 1
- Clearw 1
- Gosub Drwwindow1
- On Menu Gosub Menu_handler
- On Menu Button 1,1,1 Gosub Menubutton
- On Menu Message Gosub Respondmsg
- Found%=1 !trigger the "found" flag
- Else
- A$="No more than | 10 items per menu!"
- Alert 3,A$,1,"Sorry",Dum
- Pbox 450,Upbound%,480,Lowbound%
- Found%=1
- Endif
- Endif
- If Xmouse>510 And Xmouse<540 And Ymouse>Upbound%+Yoff1% And Ymouse<Lowbound%+Yoff1%
- ' over the down arrow for number of submenus
- Graphmode 3
- Pbox 510,Upbound%,540,Lowbound%
- If Numsubmenus%(Ln%)>1
- Numsubmenus%(Ln%)=Numsubmenus%(Ln%)-1
- Menu Kill
- Gosub Menusetup
- Menu Menu_bar$()
- Pbox 510,Upbound%,540,Lowbound%
- Graphmode 1
- Clearw 1
- Gosub Drwwindow1
- On Menu Gosub Menu_handler
- On Menu Button 1,1,1 Gosub Menubutton
- On Menu Message Gosub Respondmsg
- Found%=1 !trigger the "found" flag
- Else
- A$="Must have at least | 1 item per menu!"
- Alert 3,A$,1,"Sorry",Dum
- Pbox 510,Upbound%,540,Lowbound%
- Found%=1
- Endif
- Endif ! xmouse and ymouse within bounds
- Endif ! found%=0
- Next Ln%
- If Found%=0 ! still haven't found it, so try Desk menu item
- If Xmouse>10 And Xmouse<300 And Ymouse>Dupbound%+Yoff1% And Ymouse<Dlowbound%+Yoff1%
- ' over the Desk menu item
- Graphmode 3
- Pbox 10,Dupbound%,300,Dlowbound% ! fill in the box
- Gosub Getnewdeskitem
- Pbox 10,Dupbound%,300,Dlowbound%
- Graphmode 1
- Clearw 1
- Gosub Drwwindow1
- Found%=1 ! trigger the "found" flag
- Endif
- Endif
- If Found%=0 ! still haven't found it, so try the buttons at the bottom
- Upb%=A%*165
- Lowb%=Upb%+10*A%
- If Xmouse>120 And Xmouse<180 And Ymouse>Upb%+Yoff1% And Ymouse<Lowb%+Yoff1%
- ' over the QUIT button
- Graphmode 3
- Pbox 120,Upb%,180,Lowb%
- A$="Want to quit? | (Saved your work?)"
- Alert 2,A$,1," Yes | No ",Dum%
- If Dum%=1 ! all done
- End
- Endif
- Pbox 120,Upb%,180,Lowb%
- Graphmode 1
- Found%=1
- Endif ! xmouse and ymouse within bounds
- If Xmouse>200 And Xmouse<250 And Ymouse>Upb%+Yoff1% And Ymouse<Lowb%+Yoff1%
- ' over the SAVE button
- Graphmode 3
- Pbox 200,Upb%,250,Lowb%
- Graphmode 1
- On Error Gosub Errorroutine
- Nm$=""
- Fileselect Path$,Nm$,Nm2$
- If Nm2$<>"" And Right$(Nm2$,1)<>"\"
- Defmouse 2
- Open "o",#1,Nm2$
- Write #1,Desk$
- Write #1,Nummenus%
- For Llz%=1 To Nummenus%
- Write #1,Menutitles$(Llz%)
- Write #1,Numsubmenus%(Llz%)
- For Llz2%=1 To Numsubmenus%(Llz%)
- Write #1,Submenus$(Llz%,Llz2%)
- Next Llz2%
- Next Llz%
- Close #1
- Gosub Gtnewpath(Nm2$)
- Defmouse 0
- Endif
- On Error
- Endif
- If Xmouse>270 And Xmouse<320 And Ymouse>Upb%+Yoff1% And Ymouse<Lowb%+Yoff1%
- ' over the LOAD button
- Graphmode 3
- Pbox 270,Upb%,320,Lowb%
- Graphmode 1
- On Error Gosub Errorroutine
- Fileselect Path$,Nm$,Nm2$
- If Nm2$<>"" And Right$(Nm2$,1)<>"\"
- Defmouse 2
- Open "i",#1,Nm2$
- Input #1,Desk$
- Input #1,Nummenus%
- For Llz%=1 To Nummenus%
- Input #1,Menutitles$(Llz%)
- Input #1,Numsubmenus%(Llz%)
- For Llz2%=1 To Numsubmenus%(Llz%)
- Input #1,Submenus$(Llz%,Llz2%)
- Next Llz2%
- Next Llz%
- Close #1
- Gosub Gtnewpath(Nm2$)
- Defmouse 0
- Menu Kill
- Gosub Menusetup
- Menu Menu_bar$()
- On Menu Gosub Menu_handler
- On Menu Button 1,1,1 Gosub Menubutton
- On Menu Message Gosub Respondmsg
- Found%=1 !trigger the "found" flag
- Endif
- On Error
- Endif
- If Xmouse>10 And Xmouse<100 And Ymouse>Upb%+Yoff1% And Ymouse<Lowb%+Yoff1%
- ' over the WRITE CODE button
- Graphmode 3
- Pbox 10,Upb%,100,Lowb%
- Graphmode 1
- On Error Gosub Errorroutine
- Nm$=""
- Fileselect Path2$,Nm$,Nm2$
- If Nm2$<>"" And Right$(Nm2$,1)<>"\"
- Defmouse 2
- Open "o",#2,Nm2$
- Gosub Writecode
- Close #2
- Gosub Gtnewpath2(Nm2$)
- Defmouse 0
- Endif
- On Error
- Endif
- Endif ! Found%=0
- Return
- Procedure Writecode
- Print #2,"Gosub Build_menu_bar"
- Print #2,"On Menu Gosub Menu_handler"
- Print #2,"Do"
- Print #2," On Menu"
- Print #2,"Loop"
- Print #2,"Procedure Menu_handler"
- Print #2," 'Procedure to respond to menu items"
- Print #2," Menu_option$=Menu_bar$(Menu(0))"
- Print #2," If Menu_option$=";Chr$(34);Desk$;Chr$(34)
- Print #2," 'put your code to handle Desk menu item here"
- Print #2," Endif"
- For Lp%=1 To Nummenus%
- For Lp2%=1 To Numsubmenus%(Lp%)
- Print #2," If Menu_option$=";Chr$(34);Submenus$(Lp%,Lp2%);Chr$(34)
- Print #2," 'put your code for ";Submenus$(Lp%,Lp2%);" here"
- Print #2," Endif"
- Next Lp2%
- Next Lp%
- Print #2,"Menu Off"
- Print #2,"Return"
- Print #2,"Procedure Build_menu_bar"
- Print #2," ' Menu definition procedure"
- Print #2," Menu Kill"
- Print #2," Restore Main_list_menu_data"
- Print #2," Dim Menu_bar$(150)"
- Print #2," For I%=0 To 150"
- Print #2," Read Menu_bar$(I%)"
- Print #2," Exit If Menu_bar$(I%)=";Chr$(34);"***";Chr$(34)
- Print #2," Next I%"
- Print #2," Menu_bar$(I%)=";Chr$(34);Chr$(34)
- Print #2," Main_list_menu_data:"
- Print #2," Data Desk,";Chr$(34);Desk$;Chr$(34)
- Print #2," Data -------------------"
- Print #2," Data 1,2,3,4,5,6,";Chr$(34);Chr$(34)
- For Lllp%=1 To Nummenus%
- Print #2," Data ";Menutitles$(Lllp%);",";
- For Lllp2%=1 To Numsubmenus%(Lllp%)
- Print #2,Submenus$(Lllp%,Lllp2%);
- If Lllp2%<Numsubmenus%(Lllp%)
- Print #2,",";
- Endif
- Next Lllp2%
- Print #2,",";Chr$(34);Chr$(34)
- Next Lllp%
- Print #2
- Print #2," Data ***"
- Print #2," Menu Menu_bar$()"
- Print #2,"Return"
- Return
- Procedure Gtnewpath(Pt$)
- L=Len(Pt$)
- Tp$=""
- While (Tp$<>"\" And Tp$<>":" And Tp$<>"/" And L>0)
- Tp$=Mid$(Pt$,L,1)
- L=L-1
- Wend
- If L>0
- Path$=Left$(Pt$,L+1)+"*.MBX"
- Else
- Path$="*.MBX"
- Endif
- Return
- Procedure Gtnewpath2(Pt$)
- L=Len(Pt$)
- Tp$=""
- While (Tp$<>"\" And Tp$<>":" And Tp$<>"/" And L>0)
- Tp$=Mid$(Pt$,L,1)
- L=L-1
- Wend
- If L>0
- Path2$=Left$(Pt$,L+1)+"*.LST"
- Else
- Path2$="*.LST"
- Endif
- Return
- Procedure Errorroutine
- Currenterror=Err
- A$="Error accessing|the disk"
- Alert 1,A$,1," OK ",Dum
- Defmouse 0
- Resume Aftererror
- Return
- Procedure Getnewtitle
- ' get new title to replace title number Lp%
- Graphmode 1
- Sget Temp$ !store the screen
- Pbox 100,50*A%,500,100*A%
- Box 100,50*A%,500,100*A%
- Box 110,60*A%,490,95*A%
- Text 200,60*A%-2*A%,"Enter new menu title:"
- Print At(16,10);
- Input Ttle$
- If Ttle$<>""
- Menutitles$(Ln%)=Left$(Ttle$,9) !longest is 9 characters
- Endif
- Sput Temp$ ! restore the screen
- Graphmode 3
- Return
- Procedure Drag_box(Xst%,Yst%,Xend%,Yend%)
- Dpoke Gintin,Xend%-Xst% !width of the box being dragged
- Dpoke Gintin+2,Yend%-Yst% !height of the box
- Dpoke Gintin+4,Xst% !starting x coordinate
- Dpoke Gintin+6,Yst%+Yoff1% !starting y coordinate
- Dpoke Gintin+8,0 !x coordinate of the bounding rectangle
- Dpoke Gintin+10,Yoff1% !y coordinate of bounding rectangle
- Dpoke Gintin+12,639 !width of bounding rectangle
- Dpoke Gintin+14,399+200*(Rez=1)-Yoff1% !height of bounding rectangle
- Gemsys (71) !do it
- Eex=Dpeek(Gintout+2) !x coordinate when button released
- Eey=Dpeek(Gintout+4) !y coordinate when button released
- Return
- Procedure Drwwindow1
- ' draw the contents of window 1
- Gosub Drawnummenus
- Gosub Drawtitles
- Gosub Drawnumsubmenus
- Gosub Drawbuttons
- Return
- Procedure Drawbuttons
- Upbound%=165*(1+(Rez-1))
- Lowbound%=Upbound%+10*(1+(Rez-1))
- Box 10,Upbound%,100,Lowbound%
- Text 15,Lowbound%-2*(1+(Rez-1)),"Write Code"
- Box 120,Upbound%,180,Lowbound%
- Text 125,Lowbound%-2*(1+(Rez-1)),"Quit"
- Box 200,Upbound%,250,Lowbound%
- Text 205,Lowbound%-2*(1+(Rez-1)),"Save"
- Box 270,Upbound%,320,Lowbound%
- Text 275,Lowbound%-2*(1+(Rez-1)),"Load"
- Return
- Procedure Drawnummenus
- ' draw the number of menus box
- Color 1
- Print At(40,2);"Number of menus: "
- Box 450,8*(1+(Rez-1)),480,18*(1+(Rez-1))
- Box 480,8*(1+(Rez-1)),510,18*(1+(Rez-1))
- Box 510,8*(1+(Rez-1)),540,18*(1+(Rez-1))
- Text 490,15*(1+(Rez-1)),Str$(Nummenus%)
- Text 460,15*(1+(Rez-1)),Up$
- Text 520,15*(1+(Rez-1)),Down$
- Return
- Procedure Drawtitles
- ' draw the menu titles on the screen
- Print At(7,4);"Menu titles:"
- For Lp%=1 To Nummenus%
- Upbound%=(Lp%*10)*(1+(Rez-1))+30*(1+(Rez-1))
- Lowbound%=Upbound%+10*(1+(Rez-1))
- Box 10,Upbound%,300,Lowbound%
- Text 15,Lowbound%-2*(1+(Rez-1)),Menutitles$(Lp%)
- Box 350,Upbound%,410,Lowbound%
- Text 355,Lowbound%-2*(1+(Rez-1)),"Delete"
- Next Lp%
- ' now handle the desk "about" menu
- Print At(7,15);"Information under Desk menu:"
- Dupbound%=100*(1+(Rez-1))+30*(1+(Rez-1))
- Dlowbound%=Dupbound%+10*(1+(Rez-1))
- Box 10,Dupbound%,300,Dlowbound%
- Text 15,Dlowbound%-2*(1+(Rez-1)),Desk$
- Return
- Procedure Drawnumsubmenus
- ' draw the number of submenus boxes on the screen
- Print At(55,4);"Number of items:"
- For Lp%=1 To Nummenus%
- Upbound%=(Lp%*10)*(1+(Rez-1))+30*(1+(Rez-1))
- Lowbound%=Upbound%+10*(1+(Rez-1))
- Box 450,Upbound%,480,Lowbound%
- Box 480,Upbound%,510,Lowbound%
- Box 510,Upbound%,540,Lowbound%
- Text 490,Lowbound%-2*(1+(Rez-1)),Numsubmenus%(Lp%)
- Text 460,Lowbound%-2*(1+(Rez-1)),Up$
- Text 520,Lowbound%-2*(1+(Rez-1)),Down$
- Next Lp%
- Return
- Procedure Menu_handler
- ' respond to menu selection
- Menu_option$=Menu_bar$(Menu(0)) ! text of item number that was clicked on
- Hold%=Menu(0) ! item number that was clicked
- If Menu_option$=" Menu builder " ! credit for me!
- A$=" Menu builder | by David Plotkin|"+Chr$(189)+" 1988 Antic Publishing"
- Alert 1,A$,1," OK ",Dum
- Menu Off
- Else
- ' figure out what was clicked on
- Cnt%=0 ! index into submenus$()
- Cnt2%=10 ! index into menu string (Menu_bar$())
- Fnd%=0 ! found flag
- Llq%=0 ! counter for number of menu items per title
- Llp%=1 ! counter for menu title
- While Fnd%=0
- Cnt%=Cnt%+1 ! increment submenus$() index
- Llq%=Llq%+1 ! increment current title item number
- Cnt2%=Cnt2%+1 ! increment index into menu string
- If Cnt2%=Hold% ! found it!
- Fnd%=1
- Endif
- If Llq%=Numsubmenus%(Llp%) And Fnd%=0 ! reached the end of current title items
- Llp%=Llp%+1 ! increment menu title number
- Llq%=0 ! reset the counter for item number
- Cnt2%=Cnt2%+2 ! adjust menu string index
- Cnt%=0 ! reset the index into submenus$()
- Endif
- Wend
- Gosub Getnewitem
- Menu Off
- Menu Kill
- Gosub Menusetup
- Menu Menu_bar$()
- On Menu Gosub Menu_handler
- On Menu Button 1,1,1 Gosub Menubutton
- On Menu Message Gosub Respondmsg
- Endif
- Return
- Procedure Getnewitem
- ' get new item to replace item number Llp%,Cnt%
- Sget Temp$ !store the screen
- Pbox 100,50*A%,500,100*A%
- Box 100,50*A%,500,100*A%
- Box 110,60*A%,490,95*A%
- Text 200,60*A%-2*A%,"Enter new menu item:"
- Print At(22,9);"Current item is: ";Submenus$(Llp%,Cnt%)
- Print At(16,10);
- Input Ttle$
- If Ttle$<>""
- Submenus$(Llp%,Cnt%)=Left$(Ttle$,15) !longest is 15 characters
- Endif
- Sput Temp$ ! restore the screen
- Return
- Procedure Getnewdeskitem
- ' get new item to replace desk item
- Graphmode 1
- Sget Temp$ !store the screen
- Pbox 100,50*A%,500,100*A%
- Box 100,50*A%,500,100*A%
- Box 110,60*A%,490,95*A%
- Text 200,60*A%-2*A%,"Enter new Desk menu item:"
- Print At(22,9);"Current item is: ";Desk$
- Print At(16,10);
- Input Ttle$
- If Ttle$<>""
- Desk$=Left$(Ttle$,15) !longest is 15 characters
- Endif
- Sput Temp$ ! restore the screen
- Graphmode 3
- Return
- Procedure Menusetup
- ' set up initial menu string
- Restore Strt
- For I%=0 To 9
- Read Menu_bar$(I%)
- Next I%
- Strt:
- Data Desk," Menu builder "
- Data -------------------
- Data 1,2,3,4,5,6,""
- Cnt%=0
- For Lp%=1 To Nummenus%
- Cnt%=Cnt%+1
- Menu_bar$(Cnt%+9)=Menutitles$(Lp%)
- For Lp2%=1 To Numsubmenus%(Lp%)
- Cnt%=Cnt%+1
- Menu_bar$(Cnt%+9)=Submenus$(Lp%,Lp2%)
- Next Lp2%
- Cnt%=Cnt%+1
- Menu_bar$(Cnt%+9)=""
- Next Lp%
- Menu_bar$(Cnt%+10)=""
- Menu_bar$(Cnt%+11)=""
- Return
- Procedure Initialize
- ' set up file name and pathname
- Desk$="My Program"
- Path$="\*.MBX"
- Path2$="\*.LST"
- Nm$=""
- ' set up size of dialog box (window 4)
- Dxpos=160
- Dwidth=340
- If Rez=1
- Dypos=100
- Dheight=75
- Else
- Dypos=100
- Dheight=150
- Endif
- Hndl1=Windtab
- Attr=Windtab+2
- Xpos=Windtab+4
- Ypos=Windtab+6
- Width=Windtab+8
- Height=Windtab+10
- ' use window 4 for dialog box
- Hndl4=Windtab+36
- Attr4=Windtab+38
- Xpos4=Windtab+40
- Ypos4=Windtab+42
- Width4=Windtab+44
- Height4=Windtab+46
- ' use full screen titled window for work space
- Dpoke Attr,&H1
- Dpoke Xpos,0
- ' Ypos offset from menu bar
- Dpoke Ypos,19+10*(Rez=1)
- Dpoke Width,639
- Dpoke Height,399+19*(Rez=2)+200*(Rez=1)+10*(Rez=1)
- ' Initialize window 4 with title bar only
- Dpoke Attr4,&H1
- Dpoke Xpos4,Dxpos
- Dpoke Ypos4,Dypos
- Dpoke Width4,Dwidth
- Dpoke Height4,Dheight
- Deffill 0,1,0
- If Rez=1
- Yoff1%=19 !offset for mouse corrd to top of window 1
- Yoff4%=10 !offset for window 4 title bar (0,0 is top left corner of title bar)
- Else
- Yoff1%=38
- Yoff4%=19
- Endif
- ' set up initial menu string in Menutitle$ and Submenus$
- Nummenus%=4
- For Lp%=1 To 4
- Menutitles$(Lp%)="Menu"+Str$(Lp%)
- For Lp2%=1 To 4
- Submenus$(Lp%,Lp2%)="Item"+Str$(Lp2%)
- Next Lp2%
- Next Lp%
- For Lp%=1 To 10
- Numsubmenus%(Lp%)=4
- Next Lp%
- Up$=Chr$(1)
- Down$=Chr$(2)
- A%=1+(Rez-1)
- Return
- Procedure Respondmsg
- ' respond to GEM messages
- If Menu(1)=20 !redraw of window 1 (only one used)
- Clearw 1
- Gosub Drwwindow1
- Endif
- Return
-