$INCLUDE "dbtools.inc"
$INCLUDE "dbt.inc"
$INCLUDE "dbase.inc"
DECLARE SUB closeEdit(sender AS QBUTTON)
DECLARE SUB showIt(sender AS QFORM)
IF COMMANDCOUNT = 1 THEN
dbOpen(COMMAND$(1), fmOpenRead)
ELSE
PRINT "Syntax: dbForm tablename"
END
END IF
CREATE edtframe AS QFORM
Height = 500
Width = 350
center
BorderStyle = 3
CREATE goOutBttn AS QBUTTON
top = 400
left = 250
CAPTION = "Go Out"
onclick = closeEdit
END CREATE
CREATE nextBttn AS QBUTTON
top = 375
left = 250
CAPTION = "Go Next"
onclick = showIt
END CREATE
END CREATE
Count% = FCount()
DIM lbl(1 TO Count%) AS QLABEL
DIM edt(1 TO Count%) AS QEDIT
FOR l% = 1 TO Count%
lbl(l%).PARENT = edtFrame
lbl(l%).transparent = 1
lbl(l%).Left = 10
lbl(l%).Top = 22 + (l%-1)* 20
lbl(l%).CAPTION = fieldname(l%) & ":"
NEXT
FOR j% = 1 TO Count%
LEN?? = LengthOf(fieldname(j%))
owntype$ = TypeOf(fieldname(j%))
edt(j%).PARENT = edtFrame
edt(j%).Width = IIF(owntype$ = "M", _
edtFrame.textWidth("Memo"), _
edtFrame.textWidth(STRING$(LEN??,"D")))
edt(j%).Top = 20 + (j%-1)* 20
edt(j%).Left = 90
edt(j%).TabOrder = j%
edt(j%).BorderStyle = bsNone
edt(j%).Enabled = 0
NEXT
edtFrame.SHOWMODAL
dbclose
FUNCTION getData(container AS QFORM) AS INTEGER
count% = fcount()
current = recno()
DIM __name AS STRING
DIM __r AS VARIANT
container.CAPTION = "Record #: " + STR$( current )
FOR i% = 1 TO count%
__name = fieldname(i%)
LEN?? = LengthOf(__name)
__r = fieldget(i%)
SELECT CASE TypeOf(__name)
CASE "C"
edt(i%).Text = __r
CASE "D"
edt(i%).Text = __r
CASE "N"
DEC? = decimalsOf(__name)
edt(i%).Text = Format$("%"+STR$(LEN??)+"."+STR$(DEC?)+"f", value)
CASE "M"
edt(i%).Text = "Memo"
CASE "L"
edt(i%).Text = IIF(__r = FALSE, "F", "T")
END SELECT
NEXT
END FUNCTION
SUB showIt
IF eof() THEN
SOUND 500,1
ELSE
getData(edtFrame)
dbskip(1)
END IF
IF goOutBttn.Tag = 0 THEN
sender.CLOSE
END IF
END SUB
SUB closeEdit(sender AS QBUTTON)
sender.tag = 0
edtframe.CLOSE
END SUB
|