FoxInCloud
Conflict between Refresh() and wcHTMLgen
Gravatar is a globally recognized avatar based on your email address. Conflict between Refresh() and wcHTMLgen
  Vincent H.
  All
  Apr 3, 2018 @ 10:40am

Me again ...

In a button, I had this code in refresh():

THIS.Visible = IIF (... .F.)

In wcHTMLgen(), I added:

toHTMLgen.cScriptJSadd(TEXTMERGE([jQuery('#<<THIS.wcID>>').attr('style', 'margin-left: 38%' ...

Both work well, but not together. Refresh is overwritten by toHTMLgen.cScriptJSadd ...

I added a "display: none" but I wanted to tell you

Gravatar is a globally recognized avatar based on your email address. re: Conflict between Refresh() and wcHTMLgen
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 4, 2018 @ 01:30am

These 2 could conflict if they occurred concurrently, in fact they don't:

  • .wcHTMLgen() executes once for all users, first time form is used (instantiated) by server
    user state independent
  • .Refresh() execute each time form displays and each time your user event code calls it (such as thisForm.refresh)
    user state dependent

By the way, it's easier to manage CSS rules rather than altering CSS using JS:

procedure wcHTMLgen
lparameters toHTMlgen, tlInnerHTML

* toHTMLgen.cScriptJSadd(TEXTMERGE([jQuery('#<<THIS.wcID>>').attr('style', 'margin-left: 38%' ...
toHTMLgen.CSScustomAdd(TEXTMERGE([#<<THIS.wcID>> {margin-left: 38%; …}]))

The only exception is for .Visible, if you can't set .Visible=.F. in VFP at design time or in .Init(): for reasons internal to jQuery, you need:

procedure wcHTMLgen
lparameters toHTMlgen, tlInnerHTML

toHTMLgen.cScriptJSadd(TEXTMERGE([jQuery('#<<THIS.wcID>>').hide()]))

by the way this code:

// this replaces the whole style attribute
toHTMLgen.cScriptJSadd(TEXTMERGE([jQuery('#<<THIS.wcID>>').attr('style', 'margin-left: 38%' ...

should be:

// this adds or replaces rules in the style attribute
toHTMLgen.cScriptJSadd(TEXTMERGE([jQuery('#<<THIS.wcID>>').css('margin-left: 38%; …')
Gravatar is a globally recognized avatar based on your email address. re: Conflict between Refresh() and wcHTMLgen
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 4, 2018 @ 02:18am

Ok, thank you.

Is this correct in wcHTMLgen(): ?

IF THISFORM.wBSlHTMLgen
   toHTMLgen.CSScustomAdd(TEXTMERGE([#<<THIS.wcID>> {width: 15%;}]))
ENDIF

Gravatar is a globally recognized avatar based on your email address. re: Conflict between Refresh() and wcHTMLgen
  Vincent H.
  Vincent H.
  Apr 4, 2018 @ 02:27am

because the instruction is not interpreted

Gravatar is a globally recognized avatar based on your email address. re: Conflict between Refresh() and wcHTMLgen
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 4, 2018 @ 02:42am

it's perfect

you use this command in several other places in dooxi; make sure to always prefix ID with #; eg.:

MODIFY CLASS labelvalid OF labelvalid.vcx method wcHTMLgen

LPARAMETERS toHTMLgen AS awHTMLgen OF awHTML.prg, tlInnerHTML && {en} doc in Parent Code {fr} doc dans le code parent
toHTMLgen.CSScustomAdd(TEXTMERGE("<<THIS.Label.wcId>> {" + "margin-left: -20px;}"))
toHTMLgen.CSScustomAdd(TEXTMERGE("<<THIS.Img.wcId>> {" + "color: #2ECC71; font-size: larger; margin-top: -2px;}"))

should be:

MODIFY CLASS labelvalid OF labelvalid.vcx method wcHTMLgen

LPARAMETERS toHTMLgen AS awHTMLgen OF awHTML.prg, tlInnerHTML && {en} doc in Parent Code {fr} doc dans le code parent
toHTMLgen.CSScustomAdd(TEXTMERGE("#<<THIS.Label.wcId>> {" + "margin-left: -20px;}"))
toHTMLgen.CSScustomAdd(TEXTMERGE("#<<THIS.Img.wcId>> {" + "color: #2ECC71; font-size: larger; margin-top: -2px;}"))
Gravatar is a globally recognized avatar based on your email address. re: Conflict between Refresh() and wcHTMLgen
  FoxInCloud Support - Thierry N.
  Vincent H.
  Apr 4, 2018 @ 02:49am

because the instruction is not interpreted

not executed or without effect in awDefault_*.css?

Gravatar is a globally recognized avatar based on your email address. re: Conflict between Refresh() and wcHTMLgen
  Vincent H.
  FoxInCloud Support - Thierry N.
  Apr 4, 2018 @ 02:57am

corrected, thank you

© 1996-2024