FoxInCloud
editBox - selStart
Gravatar is a globally recognized avatar based on your email address. editBox - selStart
  Vincent H.
  All
  Jun 13, 2022 @ 08:49am

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
Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 15, 2022 @ 02:23pm

Hi Vincent,

Do you have a test case?

What do you get in oSel?

Have you tried in .Valid() instead of .LostFocus()?

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 15, 2022 @ 11:49pm

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 &#38;&#38; exécute .ProgrammaticChange()")
Paramètres reçus :
-	Valeur : {"sellength":0,"selstart":126}
-	Objet : editcourrier
  &#62; Événement : blur
  &#62; Méthode : aucun
  &#62; Propriété : aucun"
Call stack: 01&#160;snotest (23) &#62; 02&#160;awserverstart (142) &#62; 03&#160;awstart (105) &#62; 04&#160;snotestserver.tmrfiletimer.timer (39) &#62; 05&#160;snotestserver.processhit (561) &#62; 06&#160;snotestserver.process (961) &#62; 07&#160;snotestserver.routerequest (980) &#62; 08&#160;snoprocess.process (2877) &#62; 09&#160;wwprocess.process (272) &#62; 10&#160;snoprocess.domevent (4858) &#62; 11&#160;snoprocess.ajaxformrequest (4878) &#62; 12&#160;awajax.formrequest (9649) &#62; 13&#160;awajax.useraction (14463)

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 16, 2022 @ 02:10am

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)
Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 16, 2022 @ 04:19am

I am unable to initialize SelStart and SelLength.

What to put in LostFocus()?

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 16, 2022 @ 04:46am

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)
Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 16, 2022 @ 04:53am

And nothing else in LostFocus() ?

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 16, 2022 @ 04:54am

In .LostFocus(), whatever code your app needs…

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 16, 2022 @ 05:15am

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

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 16, 2022 @ 05:34am

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.

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 16, 2022 @ 09:02am

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()

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 16, 2022 @ 09:05am

You no longer need code in .LostFocusInet()

I will build a test case and get back.

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 18, 2022 @ 02:16pm

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.

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 19, 2022 @ 12:31am

Thanks Thierry !

I'm eagerly awaiting this update 😉

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 20, 2022 @ 11:27am

Hello!

We have added full R/W support for .sel* properties

FoxInCloud Live Tutorial illustrates this support.

FoxInCloud support for .selStart and .selLength

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 20, 2022 @ 11:19pm

Great !

When is the next beta ?

Gravatar is a globally recognized avatar based on your email address. re: editBox - selStart
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 21, 2022 @ 01:37am

Probably too late for you! I’ll send you soon a private bêta by PM.

© 1996-2024