Guidance
指路人
g.yi.org
software / rapidq / examples / GUI / Grid / QStringGridGoDemo.bas

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

  
' QSTRINGGRID goOptions Demo

     $APPTYPE GUI
     $ESCAPECHARS ON
     $TYPECHECK ON
     $INCLUDE "RAPIDQ.INC"

     DECLARE SUB OnKeyDown_gridGo (Key AS LONG)
     DECLARE SUB SetOptions

     CONST jpKEYLEFT = 37
     CONST  jpKEYUP = 38
     CONST jpKEYRIGHT = 39
     CONST  jpKEYDOWN = 40

     DIM sTmp AS STRING

     SUB frmWindProc
     END SUB

     CREATE frmB&S AS QFORM
      Width = Screen.Width - 50
      Height = Screen.Height - 50
      Font.COLOR = STR$(&HFF0000)
      AutoScroll = False
      CREATE gridInput AS QSTRINGGRID
       font.COLOR = &HFF0000
       font.name = "Arial"  ' play to comment and uncomment this line :)
       font.Size = 8
       Left = 5
       Top = 6
       AddOptions (goEditing)
       FixedRows = 2
       FixedCols = 1
       ColCount = 10
       RowCount = 5
       DefaultRowHeight =  20
       DefaultColWidth = 100
       ColWidths(0) = 75
       ColWidths(1) = 72
       ColWidths(2) = 45
       ColWidths(3) = 88
       ColWidths(4) = 55
       ColWidths(5) = 70
       ColWidths(6) = 58
       ColWidths(7) = 60
     ' ColWidths(8) = 65  '
       ColWidths(9) = 58
       RowHeights(1) = 40
       RowHeights(0) = 30
       Cell(0,0) = "Aaaaaaa"
       Cell(1,0) = "Bbbbbbbb"
       Cell(2,0) = "Ccccc"
       Cell(3,0) = "Ddddddddd"
       Cell(4,0) = "Eeeeeeee"
       Cell(5,0) = "Fffffffff"
       Cell(6,0) = "Gggggg"
       Cell(7,0) = "Hhhhhh"
       Cell(8,0) = "Iiiiiiii"
       Cell(9,0) = "Jjjjj"
       Cell(0,1) = MID$(DATE$,4,2) & "-" & LEFT$(DATE$,2) & "-" & RIGHT$(DATE$,4)
       Cell(1,1) = "31-07-2001"
       Cell(2,1) = "0"
       Cell(3,1) = "0.045"
       Cell(4,1) = "0.023"
       Cell(5,1) = "5000"
       Cell(6,1) = "4800"
       Cell(7,1) = "5200"
       Cell(8,1) = "50"
       Cell(9,1) = "1"
       Cell(0,2) = "1" '
       Cell(1,2) = "1" '
       Cell(2,2) = "0.1"
       Cell(3,2) = "0.001" '
       Cell(4,2) = "0.002"
       Cell(5,2) = "50"
       Cell(6,2) = "5"
       Cell(7,2) = "5"
       Cell(8,2) = "5"
       Cell(9,2) = "0.1"
       FixedColor = &HFFD5C0
       COLOR = &HC0FFFF
       ScrollBars = ssNone
       Separator = ","
      END CREATE
      COLOR = &HB3D2FF
      CAPTION = "QstringGrid goOptions Demo "
      wndproc = frmWindProc
     END CREATE

' calculate grid and Form width and height cannot be donne in a create
'  Width
     DEFINT M, N
     M = 0
     FOR N = 0 TO gridInput.ColCount - 1
      M = M + gridInput.ColWidths(N)
     NEXT N
     gridInput.Width = M + 130
'  Height
     M = 0
     FOR N = 0 TO gridInput.RowCount - 1
      M = M + gridInput.RowHeights(N)
     NEXT N
     gridInput.Height = M + 100

     frmB&S.Width = gridInput.Width + 20
     frmB&S.Height = gridInput.Height + 43

     CREATE gridGo AS QSTRINGGRID
      PARENT = frmB&S
      Left = 5
      Top = frmB&S.Height - 30
      Font.Size = 8
'     AddOptions (goEditing)
      FixedRows = 0
      FixedCols = 1
      ColCount = 2
      RowCount = 15
      DefaultRowHeight =  25
      DefaultColWidth = 100
      ColWidths(0) = 150
      ColWidths(1) = 130
      cell(0, 0) = "goFixedVertLine"       ' = 0
      cell(0, 1) = "goFixedHorzLine"       ' = 1
      cell(0, 2) = "goVertLine"            ' = 2
      cell(0, 3) =  "goHorzLine"           ' = 3
      cell(0, 4) =  "goRangeSelect"        ' = 4
      cell(0, 5) =  "goDrawFocusSelected"  ' = 5
      cell(0, 6) =  "goRowSizing"          ' = 6
      cell(0, 7) =  "goColSizing"          ' = 7
      cell(0, 8) =  "goRowMoving"          ' = 8
      cell(0, 9) =  "goColMoving"          ' = 9
      cell(0, 10) =  "goEditing"           ' = 10
      cell(0, 11) =  "goTabs"              ' = 11
      cell(0, 12) =  "goRowSelect"         ' = 12
      cell(0, 13) =  "goAlwaysShowEditor"  ' = 13
      cell(0, 14) =  "goThumbTracking"     ' = 14
      FixedColor = &HFFD5BF
      COLOR = &HC0FFFF
      ScrollBars = ssNone
      OnKeyDown = OnKeyDown_gridGo
     END CREATE
     gridGo.Width = 8 + gridGo.ColWidths(0) + gridGo.ColWidths(1)
     gridGo.Height = gridGo.DefaultRowHeight * (gridGo.RowCount -1) + 45
     frmB&S.Height = gridInput.Height + 43 + gridGo.Height + 5

     CREATE lblHelp AS QLABEL
      PARENT = frmB&S
      Top = GridGo.Top
      Left = gridGo.Left + gridGo.Width + 5
    'AutoSize = True
      Width = frmB&S.Width - gridGo.Left - gridGo.Width - 5
      Height = gridGo.Height
      COLOR = &H000000
      Font.Name = "Courier"
      Font.Size = 8
      Font.Bold = True
      Font.COLOR = &HFFFFFF
    'WordWrap = True
      CAPTION = "Test"
     END CREATE

' Set All goOptions of QSringGrid OFF
     FOR N = 0 TO gridGo.RowCount - 1
      gridGo.Cell (1, N) = "Option DELETED"
      gridInput.DelOptions N
     NEXT N

     sTmp = "\n - ALL THE goOPTIONS OF THE UPPER QSTRINGGRID  \n" & _
      "   ARE 'DELETED' AT START.                     \n\n" & _
      " - TO CHANGE AN OPTION OF THE UPPER            \n" & _
      "   QSTRINGGRID, SELECT THE CORREPONDING GRID   \n" & _
      "   IN THE LEFT QSTRINGGRID, AND USE THE LEFT   \n" & _
      "   AND RIGHT KEY, TO SWITCH ADD/DELETE THE     \n" & _
      "   goOPTION.                                   \n\n" & _
      " - goAlwaysShowEditor REQUIRES goEditor OPTION \n" & _
      "  'ADDED' TO WORK.                             \n\n" & _
      " ----------------------------------------------\n"


     lblHelp.CAPTION = sTmp
     gridInput.Repaint
' *****************************************
     frmB&S.SHOWMODAL
' *****************************************

' If KEY_UP or KEY_DOWN
     SUB OnKeyDown_gridGo (Key AS LONG)
      DEFINT R
      IF (Key = jpKEYLEFT OR Key = jpKEYRIGHT) THEN
       R = gridGo.Row
       IF gridGo.Cell (1, R) = "Option ADDED" THEN
        gridGo.Cell (1, R) = "Option DELETED"
        gridInput.DelOptions R
       ELSE
        gridGo.Cell (1, R) = "Option ADDED"
        gridInput.AddOptions R
       END IF
      END IF
     END SUB
掌柜推荐
 
 
¥264.00 ·
 
 
¥810.00 ·
 
 
¥1,480.00 ·
 
 
¥1,370.00 ·
 
 
¥1,290.00 ·
 
 
¥397.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2009-07-25 17:30:04