Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid moving up at end
Message
 
To
15/03/2006 15:58:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01104678
Message ID:
01104696
Views:
16
This message has been marked as the solution to the initial question of the thread.
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?
>>
>>May be you should not use scroll bars then?
>
>If you would like to see what I'm talking about here's the code. Just arrow down to the last row and hit the down arrow.
>
>
>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
>
>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform