home *** CD-ROM | disk | FTP | other *** search
Wrap
AMOS Source Code | 1993-07-05 | 20.6 KB | 683 lines
Rem A library for WB2 style window and requesters Rem Rem with a bit of imagination, you can do anything! Rem Rem And all with humble AMOS. Rem Rem Before, you could tell a serious AMOS program a mile away Rem because of the disgusting interface AMOS provided. Rem Now you can even conform to Commodore's interface guidelines! Rem And best off all, no one can tell your program is written in AMOS! Proc INITIALISE : Rem ** Opens a screen and defines colours etc. Rem ** This line draws a demo requester message Proc REAL3DMESSAGE[170,71,305,80,True,20,25,"An example message","You can create all sorts of ","messages and requesters that ","look just like the real ","thing, and no nasty DOS calls!","","","","Ok",""] Rem --- Main Loop, controls button checking and stuff --- Repeat If Mouse Key=1 and Mouse Zone=1 : Rem ** Wait for the OK box to be clicked on Proc CLICKBOX[(305-40)/2+170,80+71-17,40,13,True,"Ok",0,False] : Rem ** Draw it embossed Repeat : Until Mouse Key=0 : Rem ** Wait for the user to release the mouse button Rem ** Draw over the window in grey so it goes away Ink 2 Bar 170,71 To 170+305,71+80 Proc EXAMPLEWINDOW : Rem ** Draw the screenmode requester Repeat : Until Mouse Key=1 : Rem ** Wait for user to click mouse button End : Rem ** Then, end. End If Until False Rem --- This is an example of the kind of thing you can produce Procedure EXAMPLEWINDOW VISIBLE$="320 x 256" MYNIMUM$="320 x 256" MEXIMUM$="16368 x 16384" MEXCOLS$="4096 " X=19 Y=34 Proc REAL3DWINDOW[X,Y,603,194,False,"Look familiar?","Save","Cancel",80,10] Proc HEAVYICON[X+12,Y+29,276,75,False,0,False] Proc HEAVYICON[X+14+276,Y+29,15,75,False,0,False] Ink 0 Bar X+16+278,Y+31 To X+24+278,Y+31+71 Ink 0 Text 125,Y+22,"Display Mode" Text 410,Y+22,"Mode properties" Text X+329,Y+40,"Visible Size : "+VISIBLE$ Text X+329,Y+49,"Minimum Size : "+MYNIMUM$ Text X+329,Y+58,"Maximum Size : "+MEXIMUM$ Text X+329,Y+67,"Maximum Colors: "+MEXCOLS$ Text X+329,Y+85,"50Hz, 15.60kHz" Text X+16,Y+37,"PAL:High Res" Text X+16,Y+46,"PAL:High Res Laced" Text X+16,Y+55,"PAL:Low Res" Text X+16,Y+64,"PAL:Low Res Laced" Text X+16,Y+73,"PAL:Super-High Res" Text X+16,Y+82,"PAL:Super-High Res Laced" Text X+56,Y+118,"Width:" Text X+56-8,Y+133,"Height:" Text X+56-8,Y+152,"Colors:" Text X+16,Y+168,"AutoScroll:" Proc ENTERBOX[X+110,Y+108,65,13,0,False] Proc ENTERBOX[X+110,Y+124,65,13,0,False] Proc TICKBOX[X+182,Y+110,True,0,False] Proc TICKBOX[X+182,Y+126,True,0,False] Proc TICKBOX[X+110,Y+160,True,0,False] Text X+212,Y+118,"Default" Text X+212,Y+134,"Default" Proc SLIDER[X+130,Y+144,170,0,0,False] Proc HEAVYICON[X+318,Y+29,273,141,True,0,False] Proc HEAVYCLICKBOX[(603-80)/2+19,194+34-19,80,13,False,"Use",0,False] End Proc Rem --- The library definitions start from here --------------- Procedure REAL3DMESSAGE[X,Y,WIDTH,HIGHT,INSIDEPATTERN,XPOS,YPOS,TITLE$,LINE1$,LINE2$,LINE3$,LINE4$,LINE5$,LINE6$,LINE7$,BUTTON1$,BUTTON2$] Rem ** X = The x possition of the window Rem ** Y = The y possition of the window Rem ** WIDTH = The width of the window Rem ** HIGHT = The height of the window Rem ** INSIDEPATTERN = Whether there is a dithered pattern inside the window Rem It requires you to specify True, or False Rem ** XPOS = The x possition of the text (if any) inside the window Rem ** YPOS = The y possition of the text (if any) inside the window Rem ** TITLE$ = The title of the window Rem ** LINE1$ = Line 1 of the message (can just be "" for no message) Rem ** LINE2$ = Line 2 of the message (can just be "" for no message) Rem ** LINE3$ = Line 3 of the message (can just be "" for no message) Rem ** LINE4$ = Line 4 of the message (can just be "" for no message) Rem ** LINE5$ = Line 5 of the message (can just be "" for no message) Rem ** LINE6$ = Line 6 of the message (can just be "" for no message) Rem ** LINE7$ = Line 7 of the message (can just be "" for no message) Rem ** BUTTON1$ = The first of the buttons (can just be "" for no button) Rem ** BUTTON2$ = The last of the buttons (if this is just "" then the first button will be centered) Reserve Zone 3 Gr Writing 0 TXTYPOS=Y+YPOS Get Block 1,X,Y,WIDTH+1,HIGHT+1 Ink 2 : Bar X,Y To X+WIDTH,Y+HIGHT Ink 1 Draw X,Y+HIGHT To X,Y Draw X,Y To X+WIDTH,Y Ink 0 Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT Draw X+WIDTH,Y+HIGHT To X+1,Y+HIGHT Ink 0 Draw X+3,Y+HIGHT-1 To X+3,Y+10 Draw X+3,Y+10 To X+WIDTH-4,Y+10 Ink 1 Draw X+WIDTH-3,Y+10 To X+WIDTH-3,HIGHT+Y-1 Draw X+WIDTH-3,HIGHT+Y-1 To X+4,Y+HIGHT-1 Ink 3 Bar X+1,Y+1 To X+WIDTH-1,Y+9 Bar X+1,Y+1 To X+2,Y+HIGHT-1 Bar X+WIDTH-2,Y+1 To X+WIDTH-1,Y+HIGHT-1 If INSIDEPATTERN=True Ink 2 Set Pattern 2 Paint X+5,Y+15 Ink 0 Draw X+8,Y+HIGHT-19 To X+8,Y+13 Draw X+8,Y+13 To X+WIDTH-8,Y+13 Ink 1 Draw X+WIDTH-8,Y+13 To X+WIDTH-8,Y+HIGHT-19 Draw X+WIDTH-8,Y+HIGHT-19 To X+8,Y+HIGHT-19 Set Pattern 0 Ink 2 Bar X+9,Y+14 To X+WIDTH-9,Y+HIGHT-20 End If If LINE1$<>"" Ink 0 Text(WIDTH-Len(LINE1$)*8)/2+X,TXTYPOS,LINE1$ TXTYPOS=TXTYPOS+9 Text(WIDTH-Len(LINE2$)*8)/2+X,TXTYPOS,LINE2$ TXTYPOS=TXTYPOS+9 Text(WIDTH-Len(LINE3$)*8)/2+X,TXTYPOS,LINE3$ TXTYPOS=TXTYPOS+9 Text(WIDTH-Len(LINE4$)*8)/2+X,TXTYPOS,LINE4$ TXTYPOS=TXTYPOS+9 Text(WIDTH-Len(LINE5$)*8)/2+X,TXTYPOS,LINE5$ TXTYPOS=TXTYPOS+9 Text(WIDTH-Len(LINE6$)*8)/2+X,TXTYPOS,LINE6$ TXTYPOS=TXTYPOS+9 Text(WIDTH-Len(LINE7$)*8)/2+X,TXTYPOS,LINE7$ End If If BUTTON2$="" Proc CLICKBOX[(WIDTH-40)/2+X,HIGHT+Y-17,40,13,False,BUTTON1$,1,True] End If If BUTTON2$<>"" Proc CLICKBOX[X+8,Y+HIGHT-17,40,13,False,BUTTON1$,1,True] Proc CLICKBOX[WIDTH+X-78,Y+HIGHT-17,70,13,False,BUTTON2$,2,True] End If Ink 0 Text X+4,Y+7,TITLE$ End Proc Procedure SLIDER[X,Y,WIDTH,XBAR,ZHONENUMBER,SETUPZONE] Rem ** X = x possition of the slider box Rem ** Y = y possition of the slider box Rem ** WIDTH = width of the slider box Rem ** XBAR = the x possition of the bar inside the slider border Rem ** ZHONENUMBER = the number of the zone to be defined (if a zone is going to be set up) Rem ** SETUPZONE = if a zone is going to be set up the this should be True, if not False Proc HEAVYICON[X,Y,WIDTH,10,False,ZHONENUMBER,SETUPZONE] Ink 0 Bar X+4+XBAR,Y+2 To X+3+XBAR+30,Y+8 End Proc Procedure ENTERBOX[X,Y,WIDTH,HIGHT,ZHONENUMBER,SETUPZONE] Rem ** X = x possition of the box Rem ** Y = y possition of the box Rem ** WIDTH = width of the box Rem ** HIGHT = height of the box Rem ** ZHONENUMBER = the number of the zone to be defined (if any) Rem ** SETUPZONE = whether a zone is set up (True, or False) Ink 1 Draw X,Y To X,Y+HIGHT Draw X+1,Y To X+1,Y+HIGHT-1 Draw X+2,Y To X+WIDTH-1,Y Draw X+WIDTH-2,Y To X+WIDTH-2,Y+HIGHT-1 Draw X+WIDTH-3,Y+2 To X+WIDTH-3,Y+HIGHT-1 Draw X+WIDTH-3,Y+HIGHT-1 To X+3,Y+HIGHT-1 Ink 0 Draw X+2,Y+1 To X+WIDTH-3,Y+1 Draw X+2,Y+1 To X+2,Y+HIGHT-1 Draw X+3,Y+1 To X+3,Y+HIGHT-2 Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT Draw X+1,Y+HIGHT To X+WIDTH-2,Y+HIGHT If SETUPZONE=True Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT End If End Proc Procedure CYCLEBOX[X,Y,WIDTH,HIGHT,POSSITION,EMBOSSED,SETUPZONE,ZHONENUMBER,CYCLE1$,CYCLE2$,CYCLE3$,CYCLE4$] Rem ** X = x possition of the box Rem ** Y = y possition of the box Rem ** WIDTH = width of the box Rem ** HIGHT = height of the box Rem ** POSSITION = What stage the cyclebox is at 1,2,3 or 4 (what text is being displayed) Rem ** EMBOSSED = Wheter the cyclebox is embossed or not (True, or False) Rem ** SETUPZONE = whether a zone is set up (True, or False) Rem ** ZHONENUMBER = the number of the zone to be defined (if any) Rem ** CYCLE1$ = the text that is first displayed Rem ** CYCLE2$ = the text that is displayed after 2 clicks Rem ** CYCLE3$ = the text that is displayed after 3 clicks Rem ** CYCLE4$ = the text that is displayed after 4 clicks If EMBOSSED=False Ink 2 Bar X+3,Y+1 To X+WIDTH-3,Y+HIGHT-1 Ink 1 Draw X,Y To X,Y+HIGHT Draw X+1,Y+1 To X+1,Y+HIGHT-1 Draw X,Y To X+WIDTH-1,Y Ink 0 Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT Box X+6,Y+2 To X+15,Y+11 Draw X+7,Y+2 To X+7,Y+10 Draw X+14,Y+2 To X+14,Y+10 Ink 0 Plot X+13,Y+7 Plot X+16,Y+7 Plot X+13,Y+6 Plot X+16,Y+6 Plot X+12,Y+6 Plot X+17,Y+6 Else Ink 2 Bar X+3,Y+1 To X+WIDTH-3,Y+HIGHT-1 Ink 0 Draw X,Y To X,Y+HIGHT Draw X+1,Y+1 To X+1,Y+HIGHT-1 Draw X,Y To X+WIDTH-1,Y Ink 1 Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT Box X+6,Y+2 To X+15,Y+11 Draw X+7,Y+2 To X+7,Y+10 Draw X+14,Y+2 To X+14,Y+10 Ink 1 Plot X+13,Y+7 Plot X+16,Y+7 Plot X+13,Y+6 Plot X+16,Y+6 Plot X+12,Y+6 Plot X+17,Y+6 End If If SETUPZONE=True Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT End If Ink 2 Plot X+6,Y+2 Plot X+15,Y+2 Plot X+15,Y+11 Plot X+6,Y+11 Plot X+14,Y+9 Plot X+15,Y+9 Ink 0 Draw X+20,Y+2 To X+20,Y+12 Ink 1 Draw X+21,Y+2 To X+21,Y+12 Ink 0 If POSSITION=1 Then Text(WIDTH-Len(CYCLE1$)*8)/2+X,Y+9,CYCLE1$ If POSSITION=2 Then Text(WIDTH-Len(CYCLE2$)*8)/2+X,Y+9,CYCLE2$ If POSSITION=3 Then Text(WIDTH-Len(CYCLE3$)*8)/2+X,Y+9,CYCLE3$ If POSSITION=4 Then Text(WIDTH-Len(CYCLE4$)*8)/2+X,Y+9,CYCLE4$ End Proc Procedure TICKBOX[X,Y,TICK,ZHONENUMBER,SETUPZONE] Rem ** X = x possition of the box Rem ** Y = y possition of the box Rem ** TICK = whether the box displays a tick or not (True, or False) Rem ** ZHONENUMBER = the number of the zone to be defined (if any) Rem ** SETUPZONE = whether a zone is set up (True, or False) Ink 1 Draw X,Y To X+23,Y Draw X,Y To X,Y+10 Draw X+1,Y To X+1,Y+9 Ink 0 Draw X+24,Y To X+24,Y+10 Draw X+23,Y+1 To X+23,Y+10 Draw X+1,Y+10 To X+22,Y+10 If TICK=True Ink 0 Plot X+6,Y+5 Plot X+7,Y+5 Plot X+8,Y+5 Plot X+7,Y+6 Plot X+8,Y+6 Plot X+9,Y+6 Plot X+8,Y+7 Plot X+9,Y+7 Plot X+10,Y+7 Plot X+11,Y+7 Plot X+12,Y+7 Plot X+9,Y+8 Plot X+10,Y+8 Plot X+11,Y+8 Plot X+12,Y+6 Plot X+13,Y+6 Plot X+13,Y+5 Plot X+14,Y+5 Plot X+14,Y+4 Plot X+15,Y+4 Plot X+15,Y+3 Plot X+16,Y+3 Plot X+16,Y+2 Plot X+17,Y+2 Plot X+18,Y+2 Else Ink 2 Bar X+2,Y+1 To X+21,Y+8 End If If SETUPZONE=True Set Zone ZHONENUMBER,X,Y To X+24,Y+10 End If End Proc Procedure HEAVYICON[X,Y,WIDTH,HIGHT,EMBOSSED,ZHONENUMBER,SETUPZONE] Rem ** X = x possition of the box Rem ** Y = y possition of the box Rem ** WIDTH = width of the box Rem ** HIGHT = height of the box Rem ** EMBOSSED = whether the box is embossed or not (True, or False) Rem ** ZHONENUMBER = the number of the zone to be defined (if any) Rem ** SETUPZONE = whether a zone is set up (True, or False) If EMBOSSED=False Ink 1 Draw X,Y To X+WIDTH,Y Draw X,Y To X,Y+HIGHT Draw X+1,Y To X+1,Y+HIGHT-1 Ink 0 Draw X+WIDTH+1,Y To X+WIDTH+1,Y+HIGHT Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT Else Ink 0 Draw X,Y To X+WIDTH,Y Draw X,Y To X,Y+HIGHT Draw X+1,Y To X+1,Y+HIGHT-1 Ink 1 Draw X+WIDTH+1,Y To X+WIDTH+1,Y+HIGHT Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT Draw X+1,Y+HIGHT To X+WIDTH-1,Y+HIGHT End If If SETUPZONE=True Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT End If End Proc Procedure REAL3DWINDOW[X,Y,WIDTH,HIGHT,GADGET,TITLE$,BUTTON1$,BUTTON2$,WIDTHOFBUTTONS,BUTDISTEDGE] Rem ** X = x possition of the window Rem ** Y = y possition of the window Rem ** WIDTH = width of the window Rem ** HIGHT = height of the window Rem ** GADGET = whether the window has a close gadget or not (True, or False) Rem ** TITLE$ = the title of the window Rem ** BUTTON1$ = the first of the buttons (can just be "" for no button) Rem ** BUTTON2$ = the last of the buttons (if this is just "" then the first button will be centered) Rem ** WIDTHOFBUTTONS = the width of the Ok and Cancel buttons Rem ** BUTDISTEDGE = the distance from the edge of the window that the buttons are drawn Ink 2 Bar X+3,Y+11 To X+WIDTH-3,Y+HIGHT-2 Ink 1 Draw X,Y+HIGHT To X,Y Draw X,Y To X+WIDTH,Y Ink 0 Draw X+WIDTH,Y+1 To X+WIDTH,Y+HIGHT Draw X+WIDTH,Y+HIGHT To X+1,Y+HIGHT Ink 0 Draw X+3,Y+HIGHT-1 To X+3,Y+10 Draw X+3,Y+10 To X+WIDTH-4,Y+10 Ink 1 Draw X+WIDTH-3,Y+10 To X+WIDTH-3,HIGHT+Y-1 Draw X+WIDTH-3,HIGHT+Y-1 To X+4,Y+HIGHT-1 Ink 3 Bar X+1,Y+1 To X+WIDTH-1,Y+9 Bar X+1,Y+1 To X+2,Y+HIGHT-1 Bar X+WIDTH-2,Y+1 To X+WIDTH-1,Y+HIGHT-1 If BUTTON1$<>"" If BUTTON2$="" Proc HEAVYCLICKBOX[(WIDTH-WIDTHOFBUTTONS)/2+X,HIGHT+Y-17,WIDTHOFBUTTONS,13,False,BUTTON1$,0,False] End If End If If BUTTON2$<>"" Proc HEAVYCLICKBOX[X+BUTDISTEDGE,Y+HIGHT-19,WIDTHOFBUTTONS,13,False,BUTTON1$,0,False] Proc HEAVYCLICKBOX[X+WIDTH-WIDTHOFBUTTONS-BUTDISTEDGE,Y+HIGHT-19,WIDTHOFBUTTONS,13,False,BUTTON2$,0,False] End If If GADGET=True Paper 3 Ink 0 Text X+28,Y+7,TITLE$ Else Paper 3 Ink 0 Text X+4,Y+7,TITLE$ End If If GADGET=True Proc GADGET[X,Y,False] End If End Proc Procedure GADGET[X,Y,EMBOSSED] Rem ** X = x possition of the gadget Rem ** Y = y possition of the gadget Rem ** EMBOSSED = whether the gadget is embossed or not (True, or False) If EMBOSSED=False Proc BEVEL[X,Y,18,10,1,False,3] Ink 1 Draw X+19,Y+1 To X+19,Y+9 Ink 0 Box X+7,Y+3 To X+11,Y+7 Ink 1 Paint X+8,Y+4 End If If EMBOSSED=True Proc BEVEL[X,Y,18,10,1,True,2] Ink 0 Box X+7,Y+3 To X+11,Y+7 Ink 2 Paint X+8,Y+4 End If End Proc Procedure HEAVYCLICKBOX[X,Y,WIDTH,HIGHT,EMBOSSED,MESSAGE$,ZHONENUMBER,SETUPZONE] Rem ** X = x possition of the box Rem ** Y = y possition of the box Rem ** WIDTH = width of the box Rem ** HIGHT = height of the box Rem ** EMBOSSED = whether the box is embossed or not (True, or False) Rem ** MESSAGE$ = what text is centered inside the box (if any) Rem ** ZHONENUMBER = the number of the zone to be defined (if any) Rem ** SETUPZONE = whether a zone is set up (True, or False) Set Pattern 0 If EMBOSSED=False Ink 1 Draw X,Y To X,Y+HIGHT Draw X,Y To X+WIDTH-1,Y Draw X+1,Y To X+1,Y+HIGHT-1 Ink 0 Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT Draw X+WIDTH-1,Y+HIGHT To X+1,Y+HIGHT Else Ink 0 Draw X,Y To X,Y+HIGHT Draw X,Y To X+WIDTH-1,Y Draw X+1,Y To X+1,Y+HIGHT-1 Ink 1 Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT Draw X+WIDTH-1,Y+1 To X+WIDTH-1,Y+HIGHT Draw X+WIDTH-1,Y+HIGHT To X+1,Y+HIGHT End If If SETUPZONE=True Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT End If Ink 0 Text(WIDTH-Len(MESSAGE$)*8)/2+X,(Y+HIGHT/2)+3,MESSAGE$ End Proc Procedure BEVEL[X,Y,WIDTH,HIGHT,ISITFILLED,EMBOSSED,_FILLCOLOUR] Rem ** X = x possition of the box Rem ** Y = y possition of the box Rem ** WIDTH = width of the box Rem ** HIGHT = height of the box Rem ** ISITFILLED = whether the box is filled or not (True, or False) Rem ** EMBOSSED = whether the box is embossed or not (True, or False) Rem ** _FILLCOLOUR = the colour the box is filled with If EMBOSSED=False Ink 1 Draw X,Y+HIGHT To X,Y Draw X,Y To X+WIDTH,Y Ink 0 Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT Draw X+WIDTH,Y+HIGHT To X,Y+HIGHT Else Ink 0 Draw X,Y+HIGHT To X,Y Draw X,Y To X+WIDTH,Y Ink 1 Draw X+WIDTH,Y To X+WIDTH,Y+HIGHT Draw X+WIDTH,Y+HIGHT To X,Y+HIGHT End If If ISITFILLED=1 Ink _FILLCOLOUR Bar X+1,Y+1 To X+WIDTH-1,Y+HIGHT-1 Else End If End Proc Procedure CLICKBOX[X,Y,WIDTH,HIGHT,EMBOSSED,MESSAGE$,ZHONENUMBER,SETUPZONE] Rem ** X = x possition of the box Rem ** Y = y possition of the box Rem ** WIDTH = width of the box Rem ** HIGHT = height of the box Rem ** EMBOSSED = whether the box is embossed or not (True, or False) Rem ** MESSAGE$ = what text is centered inside the box (if any) Rem ** ZHONENUMBER = the number of the zone to be defined (if any) Rem ** SETUPZONE = whether a zone is set up (True, or False) Set Pattern 0 Proc BEVEL[X,Y,WIDTH,HIGHT,1,EMBOSSED,2] If SETUPZONE=True Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+HIGHT End If Ink 0 Text(WIDTH-Len(MESSAGE$)*8)/2+X,(Y+HIGHT/2)+3,MESSAGE$ End Proc Procedure INITIALISE Default Palette $0,$FFF,$AAA,$68B Screen Open 1,640,256,4,Hires Curs Off : Flash Off : Gr Writing 0 Limit Mouse 128,42 To 447,297 Cls 2 Proc SCREANTITLE["An example screen"] End Proc Procedure SCREANTITLE[SCREANTITLE$] Rem ** SCREANTITLE$ = title of the scren Gr Writing 0 Proc BEVEL[0,0,639,10,1,False,1] Ink 0 Text 4,7,SCREANTITLE$ End Proc Procedure FINDMOUSELIMIT[X_WINDOW,Y_WINDOW,WIDTH,HIGHT,X_MOUSE,Y_MOUSE] Rem ** X_WINDOW = x possition of the window Rem ** Y_WINDOW = y possition of the window Rem ** WIDTH = width of the window Rem ** HIGHT = height of the window Rem ** X_MOUSE = x possition of the mouse Rem ** Y_MOUSE = y possition of the mouse Limit Mouse X Hard(0+X_MOUSE-X_WINDOW),Y Hard(0+Y_MOUSE-Y_WINDOW) To X Hard(639-WIDTH-X_WINDOW+X_MOUSE+1),Y Hard(255-HIGHT-Y_WINDOW+Y_MOUSE+1) End Proc Procedure DRAGTHEWINDOW[X,Y,WIDTH,HIGHT,ZHONENUMBER] Rem ** X = x possition of the box Rem ** Y = y possition of the box Rem ** WIDTH = width of the box Rem ** HIGHT = height of the box Rem ** ZHONENUMBER = the number of the zone that is on the title bar Get Block 2,X,Y,WIDTH-1,HIGHT : Rem Grabs the window _ORIGINALX=X Screen(X Mouse) : Rem This is where the mouse first was when clicked (x coord) _ORIGINALY=Y Screen(Y Mouse) : Rem This is where the mouse first was when clicked (y coord) Gr Writing 2 : Rem This line means all drawn objects will be in the opposite colour to whats under them (for the drag box) Proc FINDMOUSELIMIT[X,Y,WIDTH,HIGHT,_ORIGINALX,_ORIGINALY] : Rem Finds the mouse limit of the box (so it can go off screen) Repeat DRAGX=X+X Screen(X Mouse)-_ORIGINALX : Rem DRAGX is the new x coord for the drag box DRAGY=Y+Y Screen(Y Mouse)-_ORIGINALY : Rem DRAGY is the new y coord for the drag box Wait Vbl : Rem Wait for monitor sync (stops flicker, almost!) Box DRAGX,DRAGY To DRAGX+WIDTH-1,DRAGY+HIGHT-1 : Rem Draw the drag box Wait Vbl Box DRAGX,DRAGY To DRAGX+WIDTH-1,DRAGY+HIGHT-1 : Rem Undraw the drag box Until Mouse Key=0 : Rem Repeat until the user releases the mousebutton Gr Writing 0 : Rem Turn inverse colour off Put Block 1,X,Y : Rem put back what was under the window Get Block 1,DRAGX,DRAGY,WIDTH,HIGHT Put Block 2,DRAGX,DRAGY : Rem Put the window back after drag X=DRAGX : Rem Make X the same as DRAGX Y=DRAGY : Rem Make y the same as DRAGY Limit Mouse 128,42 To 447,297 : Rem turn off the mouse limiting Set Zone ZHONENUMBER,X,Y To X+WIDTH,Y+11 : Rem This sets up the zone at its new possition End Proc Rem --- End of library Rem Not all the functions have been used in this example, Rem I have left them for you to discover for yourself...