FoxInCloud
Grid <-> Textbox
Good evening thierry,
I'm trying to develop an inter-action between a grid and a textbox.
The controlSource of the textbox is dynamically assigned with wAfterColChange () like this:
IF (Type('m.thisForm.wlHTMLgen') == 'L' AND m.thisForm.wlHTMLgen)
RETURN .T.
ENDIF
IF !DoDefault(@m.nColIndex)
return
ENDIF
WITH THIS.Parent.Saisie
.ControlSource = THIS.Columns(@m.nColIndex).ControlSource
.SetFocus
ENDWITH
DODEFAULT()
The entered value (in textbox) does not automatically refer to update the grid.
How to proceed ?
Thank you in advance ...
Bonjour Vincent, Did you try to use a grid.refresh() in the saisie.valid() ?
Cordialement
Hello Gilles,
Thanks, yes and also change the value directly in the grid control.
No effect, the cursor is updated at output and overwrites this value.
.controlSource
updates after .Valid()
returns a non-empty value such as the default .T.
. Difficult to control in which order .controlSource
update and .refresh()
act.
I would rather use a custom property:
procedure saisie.Init
…
this.addproperty('nColIndex', -1)
return dodefault()
procedure grid.wAfterColChange
IF (Type('m.thisForm.wlHTMLgen') == 'L' AND m.thisForm.wlHTMLgen)
RETURN .T.
ENDIF
IF !DoDefault(@m.nColIndex)
return .F.
ENDIF
WITH THIS.Parent.Saisie
.nColIndex = m.nColIndex
.Value = evaluate(THIS.Columns(m.nColIndex).ControlSource)
.Refresh
.SetFocus
ENDWITH
procedure saisie.Valid
replace in (THIS.Parent.Grid.rowSource) (THIS.Parent.Grid.Columns(this.nColIndex).ControlSource) with this.Value
THIS.Parent.Grid.Columns(this.nColIndex).Refresh