Guidance
指路人
g.yi.org
software / rapidq / Examples / Database / dbase / dbform.rqb

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
     $INCLUDE "dbtools.inc"
     $INCLUDE "dbt.inc"
     $INCLUDE "dbase.inc"

'--------------------------
'View a record with a form
'"Clasic" dbase  <.fmt> file

     DECLARE SUB closeEdit(sender AS QBUTTON)    'Only for current app
     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   'Defined later

      END CREATE

      CREATE nextBttn AS QBUTTON
       top = 375
       left = 250
       CAPTION = "Go Next"
       onclick = showIt        'Idem
      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"))) 'Len(edt(i%).Text)* 8

      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
'showMessage "getData() called.. "

''Read a register
      count%  = fcount()
      current = recno()

      DIM __name AS STRING
      DIM __r AS VARIANT

      container.CAPTION = "Record #: " + STR$( current )

      FOR i% = 1 TO count%
'  edt(i%).visible = 0

  'Obtain
       __name = fieldname(i%)
       LEN??  = LengthOf(__name)

       __r    = fieldget(i%)        'It is a variant

       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"
    'edt(i%).Text = Str$(__r)
       CASE "L"
        edt(i%).Text = IIF(__r = FALSE, "F", "T")
       END SELECT

'  showMessage edt(i%).text
'  edt(i%).Visible = 1
      NEXT
     END FUNCTION


     SUB showIt
'while recno() <= lastrec()
'  if dblocate( cKey ) = FALSE  then
'  else
'    if getdata()=3  then
'      exit while
'    end if

      IF eof()  THEN
       SOUND 500,1
      ELSE
       getData(edtFrame)
       dbskip(1)
      END IF
'     exit while
'  end if

'  dbskip(1)
'wend

      IF goOutBttn.Tag = 0  THEN
       sender.CLOSE
      END IF
     END SUB


'Only for this application
     SUB closeEdit(sender AS QBUTTON)
      sender.tag = 0
  'edtframe.modalResult = 3
      edtframe.CLOSE
     END SUB
掌柜推荐
 
 
¥289.00 ·
 
 
¥1,080.00 ·
 
 
¥1,380.00 ·
 
 
¥638.00 ·
 
 
¥1,290.00 ·
 
 
¥1,420.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-10-22 11:59:20