$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"
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(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
DEFINT M, N
M = 0
FOR N = 0 TO gridInput.ColCount - 1
M = M + gridInput.ColWidths(N)
NEXT N
gridInput.Width = M + 130
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
FixedRows = 0
FixedCols = 1
ColCount = 2
RowCount = 15
DefaultRowHeight = 25
DefaultColWidth = 100
ColWidths(0) = 150
ColWidths(1) = 130
cell(0, 0) = "goFixedVertLine"
cell(0, 1) = "goFixedHorzLine"
cell(0, 2) = "goVertLine"
cell(0, 3) = "goHorzLine"
cell(0, 4) = "goRangeSelect"
cell(0, 5) = "goDrawFocusSelected"
cell(0, 6) = "goRowSizing"
cell(0, 7) = "goColSizing"
cell(0, 8) = "goRowMoving"
cell(0, 9) = "goColMoving"
cell(0, 10) = "goEditing"
cell(0, 11) = "goTabs"
cell(0, 12) = "goRowSelect"
cell(0, 13) = "goAlwaysShowEditor"
cell(0, 14) = "goThumbTracking"
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
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
CAPTION = "Test"
END CREATE
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
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
|
|