************************************************** *-- Class Library: d:\publicdomain\mhgridspreadsheet\mhgridspreadsheet.vcx ************************************************** ************************************************** *-- Class: mhgridspreadsheet (d:\publicdomain\mhgridspreadsheet\mhgridspreadsheet.vcx) *-- ParentClass: grid *-- BaseClass: grid * DEFINE CLASS mhgridspreadsheet AS grid Height = 200 Width = 320 nstartrow = 0 nstartcol = 0 nstoprow = 0 nstopcol = 0 Name = "mhgridspreadsheet" lhl = .F. PROCEDURE Init local loColumn for each loColumn in This.Columns loColumn.RemoveObject('Text1') loColumn.NewObject('Text1', ; 'mhGridSSTextBox', 'mhGridSpreadSheet.vcx') loColumn.Text1.Visible = .t. loColumn.DynamicBackColor = "iif(This.lHL and " ; + "Between(This.RelativeRow, This.nStartRow, This.nStopRow) and " ; + "Between(" + alltrim(str(loColumn.ColumnOrder)) ; + ", This.nStartCol, This.nStopCol), rgb(0,0,255), rgb(255,255,255))" endfor This.Refresh() ENDPROC PROCEDURE AfterRowColChange LPARAMETERS nColIndex This.lHL = .F. This.Refresh() ENDPROC ENDDEFINE * *-- EndDefine: mhgridspreadsheet ************************************************** ************************************************** *-- Class: mhgridsstextbox (d:\publicdomain\mhgridspreadsheet\mhgridspreadsheet.vcx) *-- ParentClass: textbox *-- BaseClass: textbox * DEFINE CLASS mhgridsstextbox AS textbox BorderStyle = 0 Height = 23 Margin = 0 Width = 100 Name = "mhgridsstextbox" PROCEDURE MouseUp LPARAMETERS nButton, nShift, nXCoord, nYCoord local nWhere, nRelRow, nRelCol, nView, lnFirstRow, lnFirstCol with This.Parent.Parent store 0 to nWhere, nRelRow, nRelCol, nView if .GridHitTest(nXCoord, nYCoord, @nWhere, @nRelRow, @nRelCol, @nView); and nWhere = 3 lnFirstCol = .nStartCol lnFirstRow = .nStartRow .nStartRow = min(lnFirstRow, nRelRow) .nStartCol = min(lnFirstCol, nRelCol) .nStopRow = max(lnFirstRow, nRelRow) .nStopCol = max(lnFirstCol, nRelCol) .lHL = .T. else store 0 to .nStartRow, .nStartCol, ; .nStopRow, .nStopCol .lHL = .F. endif .Refresh() endwith ENDPROC PROCEDURE MouseDown LPARAMETERS nButton, nShift, nXCoord, nYCoord debugout 'MouseDown' This.Parent.Parent.nStartRow = This.Parent.Parent.RelativeRow This.Parent.Parent.nStartCol = This.Parent.Parent.RelativeColumn ENDPROC ENDDEFINE * *-- EndDefine: mhgridsstextbox **************************************************