home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
PROGRAMM
/
BUILDER.ZIP
/
DOBOX.BLD
< prev
next >
Wrap
Text File
|
1992-12-02
|
6KB
|
226 lines
'==================================================================
' DOBOX.BLD
'
' What it does:
' DOBOX lets you draw and resize a box onscreen. When you're
' satisfied with the box, press {F} and a file is created
' consisting of the BOX statement you need to display the box
' you've just created.
'
' To get help, press: {F1}
' -------------------------
'
' To move box, press:
' -------------------------
' Up {PgUp}
' Down {PgDn}
' Right {Ctrl-Right}
' Left {Ctrl-Left}
'
' To stretch it, press:
' --------------------------
' Horizontally {Right}
' Vertically {Down}
'
' To shrink it, press:
' --------------------------
' Horizontally {Left}
' Vertically {Up}
'
' And...
' --------------------------
' To get help {F1}
' To save as a file {F}
' To switch box type {B}
'
' Tested using:
' Builder 1.21
'
' By:
' Tom Campbell
'
'==================================================================
' Reserve space for a file descriptor.
File OutFile
' BoxType is either 1 or 2, for single or double box.
' Row, Col, Height, and Width are the box's coordinates.
Integer BoxType, Row, Col, Height, Width
' Filename is the actual name of the file, such as BOX.BLD.
' You can't write integer variables to a file; they must first
' be converted to strings. These are the string names that
' correspond with those variables.
String Filename, SRow, SCol, SHeight, SWidth
' Start the box out in the middle of the screen.
Row := 8
Col := 35
' It's a fairly small box to start with.
Height := 8
Width := 10
' Use single-width box as default
BoxType := 1
' Disable the hardware cursor.
Don't use the cursor
' Clear the screen.
cls
' Draw the box for the first time.
Redraw
' Draw the help line, with box coordinates, help msg, etc.
DrawBottomLine
While Not Canceled
GetKey
Select LastKey From
Case {Left} : ' Shrink the box horizontally.
If Width > 3
Undraw
Put Width - 1 into Width
Redraw
End ' If Width > 3
Case {Right} : ' Stretch the box horizontally.
Undraw
Put Width + 1 into Width
Redraw
Case {Up} : ' Shrink the box vertically.
Undraw
If Height > 3 Put Height - 1 into Height
Redraw
Case {Down} : ' Stretch the box vertically.
Undraw
Put Height + 1 into Height
Redraw
Case {Ctrl-Right} :' Move the box to the right.
Undraw
Put Col + 1 into Col
Redraw
Case {Ctrl-Left} : ' Move the box to the left.
Undraw
If Col > 0 Put Col - 1 into Col
Redraw
Case {PgUp} : ' Move the box up.
Undraw
If Row > 1 Put Row - 1 into Row
Redraw
Case {PgDn} : ' Move the box down.
Undraw
Put Row + 1 into Row
Redraw
Case {b} :
If BoxType is 1
BoxType := 2
Redraw
end else
BoxType := 1
Redraw
End
Case {B} :
If BoxType is 1
BoxType := 2
Redraw
end else
BoxType := 1
Redraw
End
Case {F} : ' Create a file.
CreateFile
RedrawWholeScreen
Case {f} : ' Create a file.
CreateFile
RedrawWholeScreen
case {F1} :
DoHelp
GetKey
RedrawWholeScreen
End ' Select
End ' While Not Canceled
Use the cursor
Sub Undraw
If BoxType is 1
Single Box Row, Col, Width, Height Black On Black
end else
Double Box Row, Col, Width, Height Black On Black
End
End ' Sub Undraw
Sub Redraw
If BoxType is 1
Single Box Row, Col, Width, Height White On Black
end else
Double Box Row, Col, Width, Height White On Black
End
RowCol 23, 1
Repeat 60
Say " ";
End ' Repeat
say @ 23, 1 "Row="; Row; " Col="; Col; " Width="; Width; " Height="; Height
End ' Sub Redraw
Sub CreateFile
say @ 3, 1 "File to create? ";
Repeat 64
Say "▓";
End ' Repeat
RowCol 3, 17
Input Filename
If Not Canceled
Open Filename for Writing as OutFile
SRow := IntToStr Row
SCol := IntToStr Col
SHeight := IntToStr Height
SWidth := IntToStr Width
WriteLine "Single box "+SRow+","+SCol+","+SWidth+","+SHeight+" White on Black" to OutFile
Close OutFile
End ' If Not Canceled
End
Sub DoHelp
Double box 2, 23,36,23 White on Black
Say @ 5, 28 "<reverse> To move box, press:"
Say @ 6, 28 "Up {PgUp}"
Say @ 7, 28 "Down {PgDn}"
Say @ 8, 28 "Right {Ctrl-Right}"
Say @ 9, 28 "Left {Ctrl-Left}"
Say @ 11, 28 "<reverse> To stretch it, press:"
Say @ 12, 28 "Horizontally {Right}"
Say @ 13, 28 "Vertically {Down}"
Say @ 15, 28 "<reverse> To shrink it, press:"
Say @ 16, 28 "Horizontally {Left}"
Say @ 17, 28 "Vertically {Up}"
Say @ 19, 28 "<reverse> And..."
Say @ 20, 28 "To save as a file {F}"
Say @ 21, 28 "To switch box type {B}"
GetKey
End ' SubDoHelp
Sub DrawBottomLine
RowCol 24, 1
Repeat 79
Say "░";
End ' Repeat
Say @ 24, 9 "{F1}=Help {F}=Create file {Esc}=Quit {B}=Box type"
End ' Sub DrawBottomLine
Sub RedrawWholeScreen
Cls
DrawBottomLine
Redraw
End ' Sub RedrawWholeScreen