Virtual EGrid Question

Started by Marco Ruiz, December 27, 2013, 01:43:45 PM

Previous topic - Next topic

Marco Ruiz

I'm trying to implement a virtual grid , following the demo program, but can not get it to work. The code in % EGN_GETTEXTDISPLAYINFO is not executed. The code I use for this is :

' ------------------------------------------------- -------------------------------
Function FORM1_CUSTOM ( _
                      hWndForm As Dword , _ ' handle of Form
                      wMsg As Long , _ 'type of message
                      wParam As Dword , _ 'first message parameter
                      lParam As Long _ 'second message parameter
                      ) As Long
    MyString As String Static
    Local EGN EgridNotify As Ptr

    If wMsg =% WM_USER + 1001 Then
        Call Cargar_ListaArticulos ( HWND_FORM1_EGRID321 )
    ElseIf wMsg =% WM_NOTIFY Then
       If wParam < > IDC_FORM1_EGRID321 Then Exit Function
       EGN = LParam
       Select Case@EGN.HDR.Code
        Case % EGN_GETTEXTDISPLAYINFO
         MyString = sInfo$(@ EGN.CELL.Y , @ EGN.CELL.X ) '< --------- This is the string to be retrieved
         ZTrace "Info :" & MyString
         @ EGN.Strings.Sptr = StrPtr ( MyString )
         @ EGN.Strings.Length = Len ( MyString )
       End Select
       Exit Function
    End If
    
End Function



If I use the following function, not get the expected result.

'--------------------------------------------------------------------------------
Function FORM1_EGRID321_EGN_GETTEXTDISPLAYINFO (ControlIndex As Dword, HwndForm As Dword, hEGrid As Long, wParam As Dword, lParam As Long) As Long
    Local EGN As EgridNotify Ptr
    Static MyString As String

    EGN = Lparam
    zTrace "si viene"
    If @EGN.CELL.X > 0 And  @EGN.CELL.Y > 0 Then
        zTrace "Info " & sInfo(@EGN.CELL.X, @EGN.CELL.Y) 
        MyString = sInfo$(@EGN.CELL.Y,@EGN.CELL.X)
        @EGN.Strings.Sptr   = StrPtr(MyString)
        @EGN.Strings.Length = Len(MyString)
        Exit Function
    End If
   
End Function

Elias Montoya

Two things... first, in virtual mode the grid cannod be loaded. Thats the beauty of it, the items are displayed dynamically without ever be stored inside the grid. Second, i think im a bit rusty on it (besides i dont know of the new changes on the grid), but i *believe* (not sure) EGN_GETTEXTDISPLAYINFO is only to get the text to display on the grid, not to retrieve it from the grid.

Also, can you show the code in sInfo$()?

I will take a closer look at all the code in a couple hours.
Win7, iMac x64 Retina display 5K, i7-5820K 4.4 ghz, 32GB RAM, All updates applied. - Firefly 3.70.

Marco Ruiz

Thanks Elias for the reply.
I do not load anything to the grid, which makes the cargar_listaArticulos procedure is to run a sql query to get the information from the database and store it in a global array of strings sInfo $ (). Then in% EGN_GETTEXTDISPLAYINFO, the idea is to retrieve the value of sInfo $ () to display in the grid, as I have seen the demo program VirtualGrid.bas.
What I notice is that I can not work EGN_GETTEXTDISPLAYINFO%, or WM_NOTIFY the form or the FORM1_EGRID321_EGN_GETTEXTDISPLAYINFO () function that generates the firefly.
However when I run the demo program if virtualGrid.bas runs normally (in DDT works).
I'm using FireFly 3.70 and pbwin 10 y Egrid 3.34.7.0 .

Spanish:
Gracias Elías por la respuesta.
Yo no cargo nada a la cuadrícula, lo que hace el procedimiento cargar_listaArticulos, es ejecutar una consulta sql para obtener la información de la base de datos y guardarla en un arreglo global de strings sInfo$(). Luego en %EGN_GETTEXTDISPLAYINFO, la idea es recuperar el valor de sInfo$() para mostrar en la cuadrícula, como he podido ver del programa demo VirtualGrid.bas.
Lo que yo puedo notar es que no funciona %EGN_GETTEXTDISPLAYINFO, ni en wm_notify del form ni en la función FORM1_EGRID321_EGN_GETTEXTDISPLAYINFO() que genera el firefly.
Sin embargo cuando ejecuto el programa demo virtualGrid.bas si corre normalmente (en DDT funciona). Estoy usando Firefly 3.70 y pbwin 10.


Global sInfo() as string

Sub Cargar_ListaArticulos(byval hList as long)
    Local cmd As String, l As Long
   
    cmd = "SELECT codigo,descripcion FROM articulo ORDER BY codigo"
    l =  SQL_ResSetArray(cmd, sInfo$())
    EGrid_SetCantidadFilas(hList,UBound(sInfo(1)))    '---> este es un procedimiento que establece la cantidad de filas en el grid, usando comandos del Egrid.
     
End Sub


Brian Chirgwin

Marko,

I'll send you a link to download the latest version of the Egrid Control privately.  3.34 is old.

I'll also send a FF example of using the grid virtual grid. This will take me a little bit of time. I'll post here.

Also you can create an account at http://egridpro.com/forums/. Not much going on there but that might change.

Brian Chirgwin

Brian Chirgwin


Attached is a quick example of EGrid virtual mode in Firefly.

I prefer not to take over the firefly forum with Egrid support, but the question was asked here.


Brian Chirgwin
egridpro.com/forums
support@egridpro.com

Marco Ruiz

Thanks Brian for the reply.
Apparently the problem is not the version of eGRID, but rather a declaration of virtual eGRID in firefly designer (Grid Mode : 2 - Virtual Mode). If I use the following code portion in the create section of the form, everything runs correctly:

SendMessage HWND_FORMMANTEARTIC2_EGRID321, %EG_SetGridMode, %EG_VIRTUALMODE, 0


Spanish:
Gracias Brian por la respuesta.
Al parecer el problema no es la versión del Egrid, sino más bien la declaración de Egrid virtual en el diseñador de firefly (Grid Mode : 2 - Virtual Mode). Si yo uso la porción de código siguiente en la seccion create del form, todo corre correctamente:

SendMessage HWND_FORMMANTEARTIC2_EGRID321, %EG_SetGridMode, %EG_VIRTUALMODE, 0


Brian Chirgwin

The other the grid can be set to virtual mode is in the Firefly properties window. I did it in code to make it easier.


Quote from: Marco Ruiz on December 28, 2013, 02:53:38 PM
Thanks Brian for the reply.
Apparently the problem is not the version of eGRID, but rather a declaration of virtual eGRID in firefly designer (Grid Mode : 2 - Virtual Mode). If I use the following code portion in the create section of the form, everything runs correctly:

SendMessage HWND_FORMMANTEARTIC2_EGRID321, %EG_SetGridMode, %EG_VIRTUALMODE, 0


Spanish:
Gracias Brian por la respuesta.
Al parecer el problema no es la versión del Egrid, sino más bien la declaración de Egrid virtual en el diseñador de firefly (Grid Mode : 2 - Virtual Mode). Si yo uso la porción de código siguiente en la seccion create del form, todo corre correctamente:

SendMessage HWND_FORMMANTEARTIC2_EGRID321, %EG_SetGridMode, %EG_VIRTUALMODE, 0


Elias Montoya

#7
I just noticed that there are 2 mode configurations in the property dialog, one is called VirtualMode, which can be set as true or false, and the other one is Gridmode, which can be ser as either virtualMode, DesignMode or FullLineMode.

if you set VirtualMode as True, and GridMode as VirtualMode, then you dont need this line:

SendMessage HWND_FRMMAIN_EGRID321, %EG_SetGridMode, %EG_VIRTUALMODE, 0 ' Set Grid to virtual mode

Digging deeper, i believe the image setting for firefly changed at some point and now the Background image setting is broken.

The grid has so many features that could be fitted in firefly's property dialog... yet only a few are there.

I will see if i can find some time to write new Egrid headers for everyone to use this powerful grid. I would also like to write examples, if Brian doesn't mind. I have some ideas to make text setting and even the print engine to work even in Virtual Mode.

Since the INC headers for Egrid are already on the control's folder, this line is unnecessary and can be commented out:

'#INCLUDE Once "c:\egrid32\EGRID32PRO.INC" '*** Change path to location of include file

Unless of course you have an external installation of the grid, but the INC and DLL files can be placed in Firefly's control folder to avoid the need to hard code the path for the INC file.

BTW, the nag messagebox is still displaying my email, No wonder why i still get some inquiries from time to time.
Win7, iMac x64 Retina display 5K, i7-5820K 4.4 ghz, 32GB RAM, All updates applied. - Firefly 3.70.