Announcement

Collapse
No announcement yet.

EGrid32 virtual mode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • EGrid32 virtual mode

    I am using Elias' EGrid32 and I need to know how to set the number of rows when the grid is in virtual mode. I know I can set it when the grid is created but my data changes as the application executes so I need to be able to tell the grid that the number of rows is increased/decreased.
    Paul Squires
    FireFly Visual Designer (for PowerBASIC Windows 10+)
    Version 3 now available.
    http://www.planetsquires.com

  • #2
    You can use this function paul, it works in any running mode:

    Code:
    '-------------------------------------------------------------------------------------------
    '  Sets the size for the Grid.
    '-------------------------------------------------------------------------------------------
    FUNCTION EZ_SetEgridSize(BYVAL Hgrid AS DWORD, BYVAL X AS LONG, BYVAL Y AS LONG) AS LONG
      LOCAL Xsize AS LONG
      LOCAL Ysize AS LONG
      LOCAL Result AS LONG
       Xsize = SendMessage(Hgrid, %EG_GETMAXCOLUMNS, 0, 0)
       Ysize = SendMessage(Hgrid, %EG_GETMAXROWS, 0, 0)
       IF X > Xsize THEN
        Result = Result + IIF(SendMessage(Hgrid, %EG_APPENDCOLUMN, (X-Xsize), 0), 1,0)
       ELSEIF X < Xsize THEN
        Result = Result + IIF(SendMessage(Hgrid, %EG_KILLCOLUMN, (Xsize-X), 0), 1, 0)
       ELSE
        INCR Result
       END IF
       IF Y > Ysize THEN
        Result = Result + IIF(SendMessage(Hgrid, %EG_APPENDROW, (Y-Ysize), 0),1, 0)
       ELSEIF Y < Ysize THEN
        Result = Result + IIF(SendMessage(Hgrid, %EG_KILLROW, (Ysize-Y), 0), 1, 0)
       ELSE
        INCR Result
       END IF
      FUNCTION = (Result = 2)
    END FUNCTION
    '--------------------------------------------------------------------------

    Comment


    • #3
      This should work for Rows only:

      Code:
      '-------------------------------------------------------------------------------------------
      '  Sets the number of rows for the grid.
      '-------------------------------------------------------------------------------------------
      FUNCTION EZ_SetEgridRows(BYVAL Hgrid AS DWORD, BYVAL Y AS LONG) AS LONG
        LOCAL Ysize AS LONG
        LOCAL Result AS LONG
         Ysize = SendMessage(Hgrid, %EG_GETMAXROWS, 0, 0)
         IF Y > Ysize THEN
          FUNCTION = SendMessage(Hgrid, %EG_APPENDROW, (Y-Ysize), 0)
         ELSEIF Y < Ysize THEN
          FUNCTION = SendMessage(Hgrid, %EG_KILLROW, (Ysize-Y), 0)
         ELSE
          FUNCTION = %TRUE
         END IF
      END FUNCTION
      '--------------------------------------------------------------------------

      Comment


      • #4
        Thanks Elias, worked perfectly!
        Paul Squires
        FireFly Visual Designer (for PowerBASIC Windows 10+)
        Version 3 now available.
        http://www.planetsquires.com

        Comment

        Working...
        X