I was reading sources of HMG and It looks that internal table of GRID is not initialized when ROWSOURCE is declared. So you can not use phrase:
Code: Select all
cContent := this.Cell( nRow, nCol )
to retrieve data from database driven grid.
I've modified a little your function. It was necessary to call _HMG_SysData table to retrieve some data.
Code: Select all
PROC ShowG2Cell()
local i
local aValue, aColumnFields, cField
local cContent
local nRecNo
if lInitTime
return
endif
aValue := This.Value
nRow := aValue[ 1 ]
nCol := aValue[ 2 ]
i := GetControlIndex ( This.Name , ThisWindow.Name )
xSelect := _HMG_SYSDATA [ 40 ] [ i ] [ 10 ]
if valtype(xSelect) = "C"
// database driven grid
aColumnFields := _HMG_SYSDATA [ 40 ] [ i] [ 11 ]
nRecNo := GetProperty(ThisWindow.Name, This.Name, "RecNo")
goto nRecno
cField := aColumnFields[nCol]
cContent := &cField
else
cContent := this.Cell( nRow, nCol )
endif
MsgBox( cContent )
RETU // ShowG2Cell()
PS. Didn't I write you should asleep with problem?
Besides, I think it should be easier way to retrieve data from grid based on database, not table. It's next job for Roberto

Best regards, Marek