CREATE CURSOR ac_grid (col1 N(1), col2 N(1), col3 N(1), col4 N(1), ; col5 N(1), col6 N(1), col7 N(1), col8 N(1), col9 N(1)) FOR ln_cntr = 1 TO 9 APPEND BLANK ENDFOR LOCATE RELEASE lo_form PUBLIC lo_form lo_form = NEWOBJECT('MyForm') WITH lo_form .AddObject('grd_cells','grid') WITH .grd_cells .ScrollBars = 0 .RecordMark = .f. .PanelLink = .f. .DeleteMark = .F. .AllowRowSizing = .f. .AllowHeaderSizing = .f. .RecordSourceType = 1 .RecordSource = "ac_grid" .HeaderHeight = 0 .RowHeight = .RowHeight * 2 .SetAll('Width', .RowHeight , 'Column') .SetAll('Alignment', 2, 'TextBox') .SetAll('Alignment', 2, 'Column') .Top = 0 .Left = 0 .Width = (.RowHeight + .GridLineWidth) * 9 .Height = .Width .ColumnCount = 9 .LockColumns = 9 FOR ln_cntr = 1 TO 9 WITH .Columns(ln_cntr) .ControlSource = "col" + PADL(ln_cntr, 1) DO CASE CASE ln_cntr < 4 .DynamicBackColor = "IIF(RECNO() < 4, RGB(255, 128, 128), " + ; "IIF(RECNO() < 7, RGB(255, 255, 128), " + ; "RGB(128, 128, 255)))" CASE ln_cntr < 7 .DynamicBackColor = "IIF(RECNO() < 4, RGB(255, 128, 0), " + ; "IIF(RECNO() < 7, RGB(255, 0, 128), " + ; "RGB(255, 255, 0)))" OTHERWISE .DynamicBackColor = "IIF(RECNO() < 4, RGB(255, 128, 255), " + ; "IIF(RECNO() < 7, RGB(128, 0, 255), " + ; "RGB(0, 255, 0)))" ENDCASE ENDWITH ENDFOR .Visible = .t. ENDWITH .Width = .grd_cells.Width .Height = .grd_cells.Height .Show() ENDWITH DEFINE CLASS MyForm AS Form KeyPreview = .t. PROCEDURE KeyPress(nKeyCode, nShift) IF recNo([ac_grid]) == RecCount([ac_grid]) AND nKeyCode == 24 NODEFAULT RETURN ENDIF ENDDEFINE>>>I know this has been asked but can't find the answer. If I have a grid that fits the records perfectly when I get to the bottom of the grid I don't want it to move up the records and show an empty one at the bottom. Is there a way to change that?
>CREATE CURSOR ac_grid (col1 N(1), col2 N(1), col3 N(1), col4 N(1), ; > col5 N(1), col6 N(1), col7 N(1), col8 N(1), col9 N(1)) >FOR ln_cntr = 1 TO 9 > APPEND BLANK >ENDFOR >LOCATE > >RELEASE lo_form >PUBLIC lo_form >lo_form = NEWOBJECT('Form') >WITH lo_form > .AddObject('grd_cells','grid') > WITH .grd_cells > .ScrollBars = 0 > .RecordMark = .f. > .PanelLink = .f. > .DeleteMark = .F. > .AllowRowSizing = .f. > .AllowHeaderSizing = .f. > .RecordSourceType = 1 > .RecordSource = "ac_grid" > .HeaderHeight = 0 > .RowHeight = .RowHeight * 2 > .SetAll('Width', .RowHeight , 'Column') > .SetAll('Alignment', 2, 'TextBox') > .SetAll('Alignment', 2, 'Column') > .Top = 0 > .Left = 0 > .Width = (.RowHeight + .GridLineWidth) * 9 > .Height = .Width > .ColumnCount = 9 > .LockColumns = 9 > FOR ln_cntr = 1 TO 9 > WITH .Columns(ln_cntr) > .ControlSource = "col" + PADL(ln_cntr, 1) > DO CASE > CASE ln_cntr < 4 > .DynamicBackColor = "IIF(RECNO() < 4, RGB(255, 128, 128), " + ; > "IIF(RECNO() < 7, RGB(255, 255, 128), " + ; > "RGB(128, 128, 255)))" > CASE ln_cntr < 7 > .DynamicBackColor = "IIF(RECNO() < 4, RGB(255, 128, 0), " + ; > "IIF(RECNO() < 7, RGB(255, 0, 128), " + ; > "RGB(255, 255, 0)))" > OTHERWISE > .DynamicBackColor = "IIF(RECNO() < 4, RGB(255, 128, 255), " + ; > "IIF(RECNO() < 7, RGB(128, 0, 255), " + ; > "RGB(0, 255, 0)))" > ENDCASE > ENDWITH > ENDFOR > .Visible = .t. > ENDWITH > .Width = .grd_cells.Width > .Height = .grd_cells.Height > .Show() >ENDWITH > >