Hi Thierry,
In some cases, the line change in a grid does not cause movement in the recordsource.
In my example below, the source is an unindexed cursor.
I have to do a GO TO to position myself in the table.
Note: in my example, the 1st field of the table is numeric.
What did I not understand?
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
GO tuRow IN (THIS.RecordSource) && otherwise, I stay on the 1st recording
Mycontrol.Refresh
In my grid class, should I add this in wAfterRowChange()
IF RECNO (THIS.RecordSource) # tuRow
GO tuRow IN (THIS.RecordSource)
ENDIF
Thanks in advance
Hi Vincent,
If awGrd.wRowChange()
does not find a unique key (primary or candidate), it interprets tuRow
as a record number and attempts to set it as recno()
. If it fails, it returns .F.
, and dodefault(@m.tuRow)
also returns .F.
, so your GO
instruction does not execute.
I never heard of an issue here and am unable to reproduce it, so if you have a doubt and prefer set recno()
yourself, it's OK with me.
Thank you for your answer.
That's what I understood but I confirm that in my case I had to add a GO tuRow
Like you write, this statement should not be interpreted if DoDefault(@m.tuRow) returns .F.
The form is called RegisterM.scx