FoxInCloud
Problem with grid
Gravatar is a globally recognized avatar based on your email address. Problem with grid
  Paul
  All
  Nov 7, 2019 @ 12:40am

Hi,

When I was last working with a grid, several months ago, I had it working fine; using beta.2.
The other day I started coding with FiC again, still beta.2, and I have found that the grid has stopped working!
Maybe I have changed some code somewhere, but I'm not sure what.

The problem is that, in addition to the normal columns that I add at runtime (Column1...Column8), there is now a column named Column0. I do not remember there being a Column0 previously.
What is also strange is that Column0 is identified as being inherited from the parent/base class, although there is no such object in any of the parent classes at design time.
Grid.ColumnCount is initially set to 0 and changed to 8 some time after the form init.

When I open the form with the grid for the first time there is no problem.
But the second time I receive this error :

awajax.lSuccess(.f.): Error detected at code line #12,562 of method 'awajax.propsrestore_props'
"awhtml.fxp!Awhtmlgen.grdrestore_() 
- Object 'COLUMN0' can't be found in Object {BaseClass: "Grid", ParentClass: "Dynamicgrid", Class: "Shopfloordynamicgrid", 
ClassLibrary:"h:\work\4manufacturing\classes\shopfloor.vcx", parent: stockcontrolcheckarea, attributesfield: "Attributes", 
autoinitialisewhennewrecordsource: .F., backcolourreadonly: 16244959, ...  

The trouble is that it seems that FiC has remembered that there is a Column0 and attempts to restore its properties the second time - however, although I can see Column0 via Intellisense the second time around, the Column0 object is a "zombie" (I have described something like this once before when public objects were restored) - by that I mean you cannot access the object in code, access its properties etc. Therefore Awhtmlgen.grdrestore_() crashes.

Do you have ideas about this?

I tried changing grid.ColumnCount to -1 initially, but I then get a different error instead the second time around :

awajax.lSuccess(.f.): Error detected at code line #12,562 of method 'awajax.propsrestore_props'
"awhtml.fxp!Awhtmlgen.grdrestore() 
- Method or procedure controlsource_assign(): error #1742 ("The data source for this object must be a variable reference") at code line #2,696
 ("this.ControlSource = Iif(NOT (Empty(m.tcCS) OR '.' $ m.tcCS OR Empty(m.this.Parent.RecordSource)) AND Used(m.this.Parent.RecordSource) , 
m.this.Parent.RecordSource + '.' + Alltrim(m.tcCS) , m.tcCS )")"

This time it appears that FiC has remembered that the recordsource cursor has 20 columns in it, but doesn't do the right thing when it tries to restore the controlsources to the 8 columns actually defined in the grid - for the 8th column it simply takes everything from the saved string to the right of | and assigns that to the controlsource of that column - the string of course contains lots of controlsources for all of the remaining 12 possible columns in the cursor.

So, I can't win at the moment!

Any advice much appreciated.
Paul

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid
  Gilles Lajot-Sarthou
  Paul
  Nov 7, 2019 @ 01:34am

Hi Paul

Why did you set Grid.ColumnCount to 0 ? A grid without columns versus a grid.visible = .F. ?? I think it's better to set initially Grid.ColumnCount to 1 or 8...

Regards Gilles

Gravatar is a globally recognized avatar based on your email address. re: Problem with grid
  FoxInCloud Support - Thierry N.
  Paul
  Nov 7, 2019 @ 05:01am

Do you have ideas about .columnCount = 0? (at design time)

Like Gilles I prefer setting .columnCount to -1 and then set it in grid.Init() or the final number of columns

I tried changing grid.ColumnCount to -1…

  1. With .ColumnCount=1, the grid takes Alias() at .Init() as .recordSource; reason why we always select 0 at the end of .Load()
  2. However we need to fix the situation you describe; please try this:
modify command awHTML.prg
&& line 8,651
* luProp = Iif(m.liProp = m.toGr_.ColumnCount; && 2019-11-07 thn -- {FiC V 2.30.0-beta.5} {en} replaced
*	, Substrc(m.luNode, m.liFrom + 1);
*	, Substrc(m.luNode, m.liFrom + 1, At_c('|', m.luNode_, m.liProp) - m.liFrom - 1);
*	)
luProp = Substrc(m.luNode, m.liFrom + 1, Evl(At_c('|', m.luNode_, m.liProp), Lenc(m.luNode)+1) - m.liFrom-1) && 2019-11-07 thn -- {FiC V 2.30.0-beta.5} {en} replacement
Gravatar is a globally recognized avatar based on your email address. re: Problem with grid
  Paul
  FoxInCloud Support - Thierry N.
  Nov 7, 2019 @ 12:45pm

With that code-fix I can now set to -1 and the grid is working.

Thank you.
Paul

© 1996-2019