Bug in virtual grid / strange behaviour

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

jpp
Posts: 34
Joined: Thu Jan 16, 2014 3:04 pm

Bug in virtual grid / strange behaviour

Post by jpp »

hi to all

whith a standard virtual grid, the querydata is called only to display datas on the "visible grid".
if you add Dynamicbackcolor the querrydata is called for all the itemcount.

so the virtual grid becomes unusable ...

please test my simple sample !
Hope the kings of HMg will give me a workaround !
thanks a lot

#include "hmg.ch"

Function Main
local bcolor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , ;
{ 223,253,255 } , { 255,255,255 } ) }
private count:=0

DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 450 ;
HEIGHT 400 ;
TITLE 'Hello World!' ;
MAIN

DEFINE MAIN MENU
DEFINE POPUP 'File'
MENUITEM 'Change ItemCount' ACTION Form_1.Grid_1.ItemCount := Val(InputBox('New Value','Change ItemCount'))
MENUITEM 'go 20000' ACTION Form_1.Grid_1.value := 20000
MENUITEM "Count" ACTION msgbox(str(count,8,0))
END POPUP
END MENU

@ 10,10 GRID Grid_1 ;
WIDTH 400 ;
HEIGHT 330 ;
HEADERS {'Column 1'} ;
WIDTHS {140};
VIRTUAL ;
ITEMCOUNT 1000000 ;
ON QUERYDATA QueryTest();
DYNAMICBACKCOLOR { BCOLOR }

END WINDOW

CENTER WINDOW Form_1

ACTIVATE WINDOW Form_1

Return

Procedure QueryTest()
count++
This.QueryData := Str ( This.QueryRowIndex ) + ',' + Str ( This.QueryColIndex )
Return
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Bug in virtual grid / strange behaviour

Post by esgici »

Sorry jpp and mol :(

I didn't understand the problem,

the "bug" and "unusable" are meaningless for me :(

May be this is my stupidy, but without understand the problem it's impossible to help :!:

And jpp,

please put your code between "code" and "/code" tags ( you can use "Code" button in the menu bar of post-edit window);
and more importantly please make proper indentation for easy to read and understanding.

I applied these to your code as an example :

Code: Select all

#include "hmg.ch"

Function Main
   local bcolor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , ;
                            { 223,253,255 } , { 255,255,255 } ) }
   private count:=0

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 450 ;
      HEIGHT 400 ;
      TITLE 'Hello World!' ;
      MAIN 

      DEFINE MAIN MENU
         DEFINE POPUP 'File'
            MENUITEM 'Change ItemCount' ACTION Form_1.Grid_1.ItemCount := Val(InputBox('New Value','Change ItemCount'))
            MENUITEM 'go 20000' ACTION Form_1.Grid_1.value := 20000
            MENUITEM "Count" ACTION msgbox(str(count,8,0))
         END POPUP
      END MENU

      @ 10,10 GRID Grid_1 ;
            WIDTH 400 ;
            HEIGHT 330 ;
            HEADERS {'Column 1'} ;
            WIDTHS {140};
            VIRTUAL ;
            ITEMCOUNT 1000000 ;
            ON QUERYDATA QueryTest();
            DYNAMICBACKCOLOR { BCOLOR }

   END WINDOW

   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

Return

Procedure QueryTest()
   count++
   This.QueryData := Str ( This.QueryRowIndex ) + ',' + Str ( This.QueryColIndex )
Return
Happy HMG'ing ( without 'bug' and 'unusable' problems ) :D
Viva INTERNATIONAL HMG :D
jpp
Posts: 34
Joined: Thu Jan 16, 2014 3:04 pm

Re: Bug in virtual grid / strange behaviour

Post by jpp »

hi esgici,

sorry for the code, i will do in the correct way next time.

the problem is that the virtual grid is done to "load" the part of data needed for the display.
that is done without dynamicbackcolor.

if you have tried my sample, you can compute the time to load the grid and the refresh time.

make the test with 100 columns, you time to drink ure coffee.

That's why i say that is quite unusable.

Do you know is there is a way to know if the grid is in idle state ( refresh and redraw done ), that is as the old clipper function forcestable() or stabilize() ?

Another strange behaviour : if you move the mouse over the grid, the query data is called as long as the mouse move...

thanks !
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Bug in virtual grid / strange behaviour

Post by esgici »

jpp wrote:hi esgici,
...
the problem is that the virtual grid is done to "load" the part of data needed for the display.
that is done without dynamicbackcolor.
...
Did you search dynamicbackcolor in posts and inspect questions and answers ?

Especially is your HMG version correct ( last and Unicode ) ?

Because I didn't any problem on dynamicbackcolor ,

Happy HMG'ing :D
Viva INTERNATIONAL HMG :D
jpp
Posts: 34
Joined: Thu Jan 16, 2014 3:04 pm

Re: Bug in virtual grid / strange behaviour

Post by jpp »

esgici,

i have the last HMG 3.2.

i have read all what could.

i've spent 8h on this problem

if u tries my code ( with and without dynamicbackcolor ) u will see the difference.

as you know well HMG, in h_grid.prg in the proc _HMG_DOGRIDREFRESH you can see :

IF lProcess_Dynamic_Back_Color == .T.
aTemp := ARRAY ( MaxGridRows , MaxGridCols ) <- mawgridcols = itemcount ( if your itemcount is 10 000 000 ) it's create a such array which is not the purpose of a virtual grid...

in a general way, i studie and tries lot of things before i post something.

but my pb as now still no workaround.
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Bug in virtual grid / strange behaviour

Post by Javier Tovar »

Jpp I compile your example and not encounter any discomfort, if indeed increases with time DinamicBackColor 1,000,000 items, but do not consider it a long time, if it increases 5 times the load time, but I consider normal as eg once did a similar small town in Excel and fail to 1,000,000 rows and increasing formats and formulas, if that was really slow! It's just a comparison. and a database of 100 fields have not seen one!

regards
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Bug in virtual grid / strange behaviour

Post by mol »

try to add this phrase in QueryTest function:

Code: Select all

if this.queryrowindex = 100000
  MsgBox('100000 row encountered')
endif
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Bug in virtual grid / strange behaviour

Post by Javier Tovar »

Hi Mol,
mol wrote:try to add this phrase in QueryTest function:


Code:
if this.queryrowindex = 100000
  MsgBox('100000 row encountered')
endif

Successful or unsuccessful?

I integrate the function and if it works well.

regards

Code: Select all

Procedure QueryTest()
	count++
	This.QueryData := Str ( This.QueryRowIndex ) + ',' + Str ( This.QueryColIndex )
	if this.queryrowindex = 100000
	  MsgBox('100000 row encountered')
	endif
Return
Bien.jpg
Bien.jpg (53.69 KiB) Viewed 4457 times
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Bug in virtual grid / strange behaviour

Post by mol »

This message should appear after scrolling to 100000 row. Not at the initiation of the grid. Virtual grid shouldn't touch 100000' row till the time when this row should be presented on the screen.
Post Reply