Hi Thierry,
I absolutely need to retrieve selStart and selLength values ??(which I saved with wPropSave) Why is this code not working ? oSel is not implemented as an object
EditBox.LostFocus()
lparameters oSel
IF (Type('m.thisForm.wlHTMLgen') == 'L' AND m.thisForm.wlHTMLgen)
local lcJS
text to lcJS textmerge noshow flag 1 pretext 3
var $input = jQuery("#<<THIS.wcID>>")
, oSel = {
selStart: $input.prop('selectionStart')
, selLength: $input.prop('selectionEnd')-$input.prop('selectionStart')
};
jQuery.proxy(FoxInCloud.DOMEvent, FoxInCloud, oSel, false, event)();
endtext
return m.lcJS
ENDIF
WITH THIS
IF VARTYPE (oSel) = "O"
.SelStart = m.oSel.selStart
.selLength = m.oSel.selLength + 1
ENDIF
ENDWITH

Hi Vincent,
Do you have a test case?
What do you get in oSel
?
Have you tried in .Valid()
instead of .LostFocus()
?
You are right, the code does not seem to be interpreted in LostFocus()
I passed it into Valid() and get the following error:
Awajax.useraction() - Erreur dans l'exécution de la méthode 'courrier_scx.editcourrier.Lostfocusinet(m.this.uValue)' : Méthode ou procédure interactivechangeinet() : erreur n° 1881 ("Error with EditCourrier - Value : Data type mismatch") à la ligne n° 36 ("toMember.Value = m.tuValue && exécute .ProgrammaticChange()")
Paramètres reçus :
- Valeur : {"sellength":0,"selstart":126}
- Objet : editcourrier
> Événement : blur
> Méthode : aucun
> Propriété : aucun"
Call stack: 01 snotest (23) > 02 awserverstart (142) > 03 awstart (105) > 04 snotestserver.tmrfiletimer.timer (39) > 05 snotestserver.processhit (561) > 06 snotestserver.process (961) > 07 snotestserver.routerequest (980) > 08 snoprocess.process (2877) > 09 wwprocess.process (272) > 10 snoprocess.domevent (4858) > 11 snoprocess.ajaxformrequest (4878) > 12 awajax.formrequest (9649) > 13 awajax.useraction (14463)
Please try this code :
procedure EditCourrier.LostFocusInet
LPARAMETERS tuValue && Valeur (Internet)
if vartype(m.tuValue) == 'O'
this.selStart = m.tuValue.selStart
this.selLength = m.tuValue.selLength + 1
return
endif
return dodefault(@m.tuValue)
I don't understand your issue; however this code may fix:
procedure EditCourrier.LostFocusInet
LPARAMETERS tuValue && Valeur (Internet)
if vartype(m.tuValue) == 'O'
this.selStart = m.tuValue.selStart
this.selLength = m.tuValue.selLength + 1
tuValue = this.Value
endif
return dodefault(@m.tuValue)
And nothing else in LostFocus() ?
In .LostFocus()
, whatever code your app needs…
I totally get lost
tuValue is never an object, even leaving my code in Valid()
But a suspend in LostFocuInet() shows that THIS.SalStart is well initialized (without additional code) However, it loses this value because in LostFocus() THIS.SelStart is always 0
Actually, FoxInCloud handles .selStart
and .selLength
automatically: sent to server on any event fired on textarea
(Editbox) or input
('Combobox', 'Spinner' or 'Textbox')
modify command awServer
…
hidden procedure UserAction
…
if InList(this.oCntl.BaseClass, 'Combobox', 'Editbox', 'Spinner', 'Textbox') && 2019-04-03 thn -- {FiC V 2.28.1-beta.6} {en} added
this.oCntl.selStart = Max(Cast(m.request.form('selS') as I), 0)
this.oCntl.selLength = Max(Cast(m.request.form('selL') as I), 0) && Setting SelLength to less than 0 causes a run-time error.
endif
…
You have nothing to care about, .LostFocus()
should get .selStart
and .selLength
values from the browser.
Yes, but that's not what happens
I removed all the added code and a wMessageBox(TRANSFORM(THIS.SelStart)) in LostFocus() still returns me 0 (while properly initialized in LostFocusInet()
You no longer need code in .LostFocusInet()
I will build a test case and get back.
Vincent,
Further research has shown that in web mode, when form is invisible, VFP always empties .sel*
properties.
We have implemented a workaround as shown on the FoxInCloud Live Tutorial (make sure to empty your cache and/or force reload the scripts).
We'll soon ship version 3.0.1-beta.1
including this fix.
Thanks for your patience.
Thanks Thierry !
I'm eagerly awaiting this update 😉
Hello!
We have added full R/W support for .sel*
properties
FoxInCloud Live Tutorial illustrates this support.
Great !
When is the next beta ?