Page 1 of 2

grid performance

Posted: Mon Nov 08, 2021 10:42 pm
by carlazza
hi all,

this is my first post, so i apologize in advance if i write something wrong.

I detect a strong slowdown when loading a grid.

Is there any way to understand where and why the executable is slowing down in performance?

Thanks Carlo

Re: grid performance

Posted: Tue Nov 09, 2021 6:13 am
by AUGE_OHR
hi,

are you using DBF or Array ?
Network or LOCAL ?

i guess DBF so next Question : do you use "FILTER" ?

---

in Network, working on same DBF, will slow down

---

when using Image in Grid it will slow down

so please more Information

Re: grid performance

Posted: Tue Nov 09, 2021 7:23 am
by carlazza
Hi,

I'm using array in local. no images.

I've included the grid loading in a function. At the first access, the grid works fine.
In following ones, the grid loads very slowly

In the load function, firstly I check if grid exists, delete and define, else only define

Please see the attachment.

Re: grid performance

Posted: Tue Nov 09, 2021 12:35 pm
by mol
When you want to browse arrays, use VIRTUAL GRID, it's really speedy.

Re: grid performance

Posted: Tue Nov 09, 2021 2:48 pm
by carlazza
can you explain it better please?

Re: grid performance

Posted: Tue Nov 09, 2021 5:04 pm
by mol
when you're defining GRID control, you can use VIRTUAL as .T.
You must define OnQueryData procedure which distributes data to GRID control to display it.
See examples in hmg344\samples\controls\grid

Re: grid performance

Posted: Tue Nov 09, 2021 10:25 pm
by carlazza
I thank you but it is too difficult for my knowledge

Re: grid performance

Posted: Tue Nov 09, 2021 11:16 pm
by AUGE_OHR
hi

it is realy easy to use VIRTUAL with GRID

lets talk about Sample \SAMPLES\Controls\Grid\GRID_02\demo.prg

Code: Select all

		VIRTUAL ;
		ITEMCOUNT 100000000 ;
		ON QUERYDATA QueryTest() 
VIRTUAL -> enable Virtual ( LVN_GETDISPINFO )
ITEMCOUNT -> max. Lenght -> LEN(Array)
ON QUERYDATA -> Procedure to "show" Data

Code: Select all

Procedure QueryTest()
	This.QueryData := Str ( This.QueryRowIndex ) + ',' + Str ( This.QueryColIndex )
have a look in Help File for GRID and look for "This"
Properties Available For OnQueryData Procedure:

- This.QueryData
- This.QueryRowIndex
- This.QueryColIndex
This.QueryData -> "Result" Data of Cell in a GRID

come from right side

This.QueryRowIndex -> ROW of Data
This.QueryColIndex -> COL of Data

so Procedure QueryTest() use "Information" of "This" to display Data of GRID

! Note :
while that Part of Code are need for every Cell do not put too much Code into QueryTest() if you want to "manipulate" Data

have fun

Re: grid performance

Posted: Wed Nov 10, 2021 8:56 am
by carlazza
Thanks

I will try asap

Re: grid performance

Posted: Fri Nov 12, 2021 9:58 pm
by carlazza
done. now it's faster than before

but, if I use the Virtual command, the checkbox disappears. Why?

Code: Select all

  	DEFINE GRID GRD1
	        PARENT CDL1
			ROW 145
			COL  20
			WIDTH 830
			HEIGHT 800
			HEADERS { 'MATRICOLA', 'COGNOME', 'NOME', 'DATA NASCITA', 'CATEGORIA', 'NREC'} 
			FONTSIZE 11 
			FONTBOLD .t.
			WIDTHS { 120, 200, 200,135,153,0}
			ITEMS  AISCRITTI
                        BACKCOLOR {03, 119, 127} 
			FONTCOLOR WHITE
			ALLOWSORT  .T. 
			VALUE posrec
			CHECKBOXES .T.
			VIRTUAL .t.
                        ON CHANGE LoadData(This.Item(this.value)) 
			ON DBLCLICK ENABLEFIELD() 
			ON QueryData QueryTest()
	END GRID		


RETURN
*-------------------------------------------------------------------------------
function QueryTest()

   local x := this.queryrowindex
   local y := this.querycolindex
   this.querydata := aiscritti[ x, y ]
return nil