Hi Thierry,
Me again, with the same grid ...
The recordSource is a cursor with a candidate key and the records are in order of this key (SET ORDER TO ...)
When I move in the grid, I stay on the 1st record
.
Of course, with this code, it works:
LPARAMETERS tuRow && see documentation in awGrd.wAfterRowChange()
IF (Type('m.thisForm.wlHTMLgen') == 'L' AND m.thisForm.wlHTMLgen)
RETURN .T.
ENDIF
IF !DoDefault(@m.tuRow)
RETURN
ENDIF
SEEK tuRow ORDER TAG Nomprecom IN Ccarnetadr
Make sure to assign .recordSource
with its candidate key, even without record, before or during grid.Init()
.
The cursor and its index are created in Form.Load()
Grid.RecordSource = MyCursor
Grid.RecordSource.Type = 1
Grid.RecordSource = MyCursor
In form.Load()
?
Grid
gets created between form.Load()
and form.Init()
OK thanks
I understand you set grid.recordSource
at design time
Please share the cursor creation code from form.Load()
Form.Load()
lParameters reminder_in_your_subclass_call_DoDefault_after_opening_all_views_and_cursorAdapters && {en} see sample impl. in awFrm code {fr} voir exemples impl. dans code de awFrm
DO SelectCarnet IN \VHDev\Appli\Courrier\Carnetadr WITH THISFORM, .F.
RETURN DODEFAULT()
PROCEDURE SelectCarnet
LPARAMETERS Mform, lFiltre
LOCAL Mfiltre
Mfiltre = IIF (lFiltre = .F., ".F.", '.NOT. EMPTY (Idunique) .AND. Nom # "~" .AND. .NOT. EMPTY (Nom)')
USE IN SELECT ("CCarnetadr")
SELECT DISTINCT Nom, Prenom, Commune, Codepostal, Idunique FROM Carnetadr WHERE &Mfiltre INTO CURSOR CCarnetadr READWRITE NOFILTER
INDEX ON PADR (ALLTRIM (Nom) + Espace + ALLTRIM (Prenom) + BlancTiret + ALLTRIM (Commune) + EspacePOuv + Codepostal + ParentFer + Espace + Idunique, 120) TAG Nomprecom COLLATE "General" CANDIDATE
SET ORDER TO Nomprecom IN CCarnetadr
GO TOP IN CCarnetadr
RETURN
Please set a breakpoint at in grid.wcPKexprSet()
and share debugger screenshot when it executes (with all windows visible, without public variables).
procedure wcPKexprSet
set step on
return dodefault()
I must expand which node ?
none
please check used(this.recordSource)
when execution stops, and resume until server returns to READ EVENTS
used(this.recordSource)
return .F.
the issue is here, please debug why the cursor is not used()
OK, I try ...
lparameters callBackMethod
WITH THISFORM
IF .wlLAN .OR. .wlInitFirst
DODEFAULT()
ENDIF
IF .wlInitFirst
RETURN
ENDIF
ENDWITH
DODEFAULT (m.callBackMethod)
suspend
? USED ("Ccarnetadr") => .T.
You need to check in the ‘.wlInitFirst’ Section
lparameters callBackMethod
WITH THISFORM
IF .wlLAN .OR. .wlInitFirst
DODEFAULT()
suspend
? USED ("Ccarnetadr") => .T.
ENDIF
IF .wlInitFirst
RETURN
ENDIF
ENDWITH
DODEFAULT (m.callBackMethod)
Vincent,
Let's go back to the basics… could you set a breakpoint as follows:
procedure wAfterRowChange
LPARAMETERS tuRow && see documentation in awGrd.wAfterRowChange()
IF (Type('m.thisForm.wlHTMLgen') == 'L' AND m.thisForm.wlHTMLgen)
RETURN .T.
ENDIF
set step on && breakpoint here, remove others
IF !DoDefault(@m.tuRow)
RETURN
ENDIF
SEEK tuRow ORDER TAG Nomprecom IN Ccarnetadr
step into DoDefault(@m.tuRow)
until you reach the .wRowChange()
procedure, step through this procedure (without stepping into the called procedures) and feedback which case
is executed.
as you stay on the first record, you probably won't reach this case
otherwise your alias would move to the last record:
otherwise
locate for &lcPKexpr = m.tuRow
success = Found()
…
please feedback the values of the main variables: tuRow
and lcPKexpr
.
TIA
not sure I understood everything ...
I introduce the set step on and in debugger I see that tuRow receive a correct value while lcPKexpr
is always undefine
we could reproduce and pin down your issues; will include a fix in next beta
thanks for sharing the issues, and for your debugging efforts!