Re: HMG 3.0.39
Posted: Thu Sep 29, 2011 1:38 pm
Hi Rathi,
I have a proposition for a small experimental addition to 3.0.39.
An user asked to me for loading data in a 'cellnavigation' grid, by column.
I mean, that instead of moving cursor to the right when you accepted cell editing, the cursor should be moved down.
I've made this optional and used an _HMG_SYSDATA unused slot as flag.
To test it, please add the following at init.prg (about line #650):
Then replace the function _HMG_GRIDINPLACEKBDEDIT_2 in h_grid.prg with the following:
To activate it, you must simply set the flag value to .t.:
Please test it. If you like it and if it is working fine, we should create a SET command to swith it, but I've not found and adequate name to it yet 
Any idea?
I have a proposition for a small experimental addition to 3.0.39.
An user asked to me for loading data in a 'cellnavigation' grid, by column.
I mean, that instead of moving cursor to the right when you accepted cell editing, the cursor should be moved down.
I've made this optional and used an _HMG_SYSDATA unused slot as flag.
To test it, please add the following at init.prg (about line #650):
Code: Select all
_HMG_SYSDATA [ 284 ] := .F.Code: Select all
*-----------------------------------------------------------------------------*
PROCEDURE _HMG_GRIDINPLACEKBDEDIT_2(i)
*-----------------------------------------------------------------------------*
LOCAL TmpRow
LOCAL XS
LOCAL XD
LOCAL R
LOCAL IPE_MAXCOL
LOCAL S
Local aColumnWhen := _HMG_SYSDATA [ 40 ] [ i ] [ 6 ]
Local j
Local nWhenRow
Local xTmpCellValue
Local aTemp
//Problem3031
_HMG_GRID_KBDSCROLL(I)
If _HMG_SYSDATA [ 15 ] [i] == 1
r := LISTVIEW_GETITEMRECT ( _HMG_SYSDATA [3] [i] , _HMG_SYSDATA [ 39 ] [i] - 1 )
Else
r := LISTVIEW_GETSUBITEMRECT ( _HMG_SYSDATA [3] [i] , _HMG_SYSDATA [ 39 ] [i]- 1 , _HMG_SYSDATA [ 15 ] [i] - 1 )
EndIf
nWhenRow := _HMG_SYSDATA [ 195]
_HMG_SYSDATA [ 197 ] := _HMG_SYSDATA [ 18 ] [i] + r [1]
_HMG_SYSDATA [ 198 ] := _HMG_SYSDATA [ 19 ] [i] + r [2]
_HMG_SYSDATA [ 199 ] := r[3]
_HMG_SYSDATA [ 200 ] := r[4]
*
_HMG_SYSDATA [ 194 ] := ascan ( _HMG_SYSDATA [ 67 ] , _HMG_SYSDATA [4][i] )
_HMG_SYSDATA [ 231 ] := 'C'
_HMG_SYSDATA [ 203 ] := i
_HMG_SYSDATA [ 316 ] := _HMG_SYSDATA [ 66 ] [ _HMG_SYSDATA [ 194 ] ]
_HMG_SYSDATA [ 317 ] := _HMG_SYSDATA [2] [_HMG_SYSDATA [ 203 ]]
*
S := _HMG_GRIDINPLACEEDIT(I)
IF _HMG_SYSDATA [ 32 ] [I] .AND. _HMG_SYSDATA [ 245 ] == .F.
IF _HMG_SYSDATA [ 15 ] [I] < LEN(_HMG_SYSDATA [ 7 ] [I])
IF _HMG_SYSDATA [ 40 ] [ I ] [ 32 ] == 0
IF S
IF _HMG_SYSDATA [ 284 ]
InsertDown()
ELSE
_HMG_SYSDATA [ 15 ] [I]++
ENDIF
If ValType ( aColumnWhen ) == 'A'
nStart := _HMG_SYSDATA [ 15 ] [I]
nEnd := Len ( aColumnWhen )
For j := nStart To nEnd
If ValType ( aColumnWhen [j] ) == 'B'
*******************************************************************************************************************************
IF _HMG_SYSDATA [ 40 ] [ i ] [ 9 ] == .F.
aTemp := this.item( nWhenRow )
xTmpCellValue := aTemp [j]
ELSE
_HMG_SYSDATA [ 201 ] := nWhenRow // QueryRowIndex
_HMG_SYSDATA [ 202 ] := j // QueryColIndex
_HMG_SYSDATA [ 320 ] := .T.
IF valtype ( _HMG_SYSDATA [ 40 ] [ i ] [ 10 ] ) == 'C'
GetDataGridCellData ( i , .t. )
ELSE
Eval( _HMG_SYSDATA [ 6 ] [ i ] )
ENDIF
_HMG_SYSDATA [ 320 ] := .F.
xTmpCellValue := _HMG_SYSDATA [ 230 ]
ENDIF
********************************************************************************************************************************
_HMG_SYSDATA [ 318 ] := xTmpCellValue
_HMG_SYSDATA [ 232 ] := 'GRID_WHEN'
lResult := Eval ( aColumnWhen [j] )
_HMG_SYSDATA [ 232 ] := ''
If lResult == .F.
_HMG_SYSDATA [ 15 ] [I]++
Else
Exit
EndIf
EndIf
Next j
IF _HMG_SYSDATA [ 15 ] [I] > nEnd
_HMG_SYSDATA [ 15 ] [I] := nStart - 1
ENDIF
EndIf
ENDIF
ENDIF
ELSEIF _HMG_SYSDATA [ 15 ] [I] == LEN(_HMG_SYSDATA [ 7 ] [I])
IF _HMG_SYSDATA [ 40 ] [ I ] [ 32 ] == 0
IF S
_HMG_SYSDATA [ 15 ] [I] := 1
ENDIF
ENDIF
ENDIF
LISTVIEW_REDRAWITEMS( _HMG_SYSDATA[3][I] , _HMG_SYSDATA[39][I]-1 , _HMG_SYSDATA[39][I]-1 )
_DoControlEventProcedure ( _HMG_SYSDATA [ 12 ] [i] , i )
ENDIF
_HMG_SYSDATA [ 203 ] := 0
_HMG_SYSDATA [ 231 ] := ''
_HMG_SYSDATA [ 195 ] := 0
_HMG_SYSDATA [ 196 ] := 0
_HMG_SYSDATA [ 197 ] := 0
_HMG_SYSDATA [ 198 ] := 0
_HMG_SYSDATA [ 199 ] := 0
_HMG_SYSDATA [ 200 ] := 0
*
_HMG_SYSDATA [ 194 ] := 0
_HMG_SYSDATA [ 232 ] := ''
_HMG_SYSDATA [ 316 ] := ''
_HMG_SYSDATA [ 317 ] := ''
*
RETURN
Code: Select all
_HMG_SYSDATA [ 284 ] := .T.Any idea?