I don't know the difference, maybe it's a bug?I'm afraid I couldn't understand this point. What is difference database and table ?
I've tried to analize h_grid.prg but it requires more time to understand all philosophy of HMG.
Regards, Marek
Moderator: Rathinagiri
I don't know the difference, maybe it's a bug?I'm afraid I couldn't understand this point. What is difference database and table ?
Code: Select all
cContent := this.Cell( nRow, nCol )
Code: Select all
FUNCTION _HMG_GETGRIDCELLVALUE ( CONTROLNAME , PARENTFORM , ROW , COL )
*------------------------------------------------------------------------------*
LOCAL A
LOCAL V
A := _GetItem ( CONTROLNAME , PARENTFORM , ROW )
V := A [ COL ]
RETURN V
Code: Select all
case T == "GRID" .OR. T == "MULTIGRID"
IF _HMG_SYSDATA [ 40 ] [ i ] [ 9 ] == .F.
AEDITCONTROLS := _HMG_SYSDATA [ 40 ] [I] [2]
IF VALTYPE ( AEDITCONTROLS ) != 'A'
RetVal := ListViewGetItem ( c , Item , Len ( _HMG_SYSDATA [ 7 ] [i] ) )
ELSE
V := ListViewGetItem ( c , Item , Len( _HMG_SYSDATA [ 7 ] [i] ) )
ATEMP := ARRAY ( Len( _HMG_SYSDATA [ 7 ] [i] ) )
FOR CI := 1 TO Len( _HMG_SYSDATA [ 7 ] [i] )
XRES := _HMG_PARSEGRIDCONTROLS ( AEDITCONTROLS , CI )
AEC := XRES [1]
CTYPE := XRES [2]
CINPUTMASK := XRES [3]
CFORMAT := XRES [4]
AITEMS := XRES [5]
ARANGE := XRES [6]
DTYPE := XRES [7]
ALABELS := XRES [8]
IF AEC == 'TEXTBOX'
IF CTYPE == 'NUMERIC'
IF CFORMAT = 'E'
ATEMP [CI] := GetNumFromCellTextSp ( v [CI] )
ELSE
ATEMP [CI] := GetNumFromCellText ( v [CI] )
ENDIF
ELSEIF CTYPE == 'DATE'
ATEMP [CI] := CTOD ( v [CI] )
ELSEIF CTYPE == 'CHARACTER'
ATEMP [CI] := v [CI]
ENDIF
ELSEIF AEC == 'DATEPICKER'
ATEMP [CI] := CTOD (V [CI] )
ELSEIF AEC == 'COMBOBOX'
Z := 0
FOR X := 1 TO LEN ( AITEMS )
IF UPPER ( ALLTRIM( V [CI] ) ) == UPPER ( ALLTRIM ( AITEMS [X] ) )
Z := X
EXIT
ENDIF
NEXT X
ATEMP [CI] := Z
ELSEIF AEC == 'SPINNER'
ATEMP [CI] := VAL (V [CI] )
ELSEIF AEC == 'CHECKBOX'
IF ALLTRIM(UPPER(V[CI])) == ALLTRIM(UPPER(ALABELS [1]))
ATEMP [CI] := .T.
ELSEIF ALLTRIM(UPPER(V[CI])) == ALLTRIM(UPPER(ALABELS [2]))
ATEMP [CI] := .F.
ENDIF
ENDIF
NEXT CI
RetVal := ATEMP
ENDIF
if Len ( _HMG_SYSDATA [ 14 ] [i] ) > 0
if len (RetVal) >= 1
RetVal [1] := GetImageListViewItems( c , Item )
EndIf
EndIf
ENDIF
endcase
Thanks a lot Marek, it work fine.mol wrote: I've modified a little your function. It was necessary to call _HMG_SysData table to retrieve some data.
Amazing handling of HMG internals! Let's hope that the cell value can be published consistently (eg This.CellValue) in the next HMG version.mol wrote: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:to retrieve data from database driven grid.Code: Select all
cContent := this.Cell( nRow, nCol )
I've modified a little your function. It was necessary to call _HMG_SysData table to retrieve some data.PS. Didn't I write you should asleep with problem?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()
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
This is my SSW sample demonstrating this problem.esgici wrote: ... this is my principal problem : when changing row of grid, record of table doesn't change always![]()
For you too, Esgici!Good weekend my friend
Regards
--
Esgici