grid performance

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

carlazza
Posts: 22
Joined: Sun Nov 07, 2021 1:09 pm
DBs Used: DBF
Location: Italia

grid performance

Post 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
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: grid performance

Post 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
have fun
Jimmy
carlazza
Posts: 22
Joined: Sun Nov 07, 2021 1:09 pm
DBs Used: DBF
Location: Italia

Re: grid performance

Post 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.
Attachments
2021-11-09_081012.jpg
2021-11-09_081012.jpg (45.39 KiB) Viewed 1342 times
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: grid performance

Post by mol »

When you want to browse arrays, use VIRTUAL GRID, it's really speedy.
carlazza
Posts: 22
Joined: Sun Nov 07, 2021 1:09 pm
DBs Used: DBF
Location: Italia

Re: grid performance

Post by carlazza »

can you explain it better please?
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: grid performance

Post 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
carlazza
Posts: 22
Joined: Sun Nov 07, 2021 1:09 pm
DBs Used: DBF
Location: Italia

Re: grid performance

Post by carlazza »

I thank you but it is too difficult for my knowledge
User avatar
AUGE_OHR
Posts: 2117
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: grid performance

Post 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
have fun
Jimmy
carlazza
Posts: 22
Joined: Sun Nov 07, 2021 1:09 pm
DBs Used: DBF
Location: Italia

Re: grid performance

Post by carlazza »

Thanks

I will try asap
carlazza
Posts: 22
Joined: Sun Nov 07, 2021 1:09 pm
DBs Used: DBF
Location: Italia

Re: grid performance

Post 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
Post Reply