FoxInCloud
Adding code to object.wchtmlgen method
Gravatar is a globally recognized avatar based on your email address. Adding code to object.wchtmlgen method
  Michele
  All
  Feb 7, 2020 @ 01:05am

Is this the correct code to add some html code when an object is loaded and repeat ADD not to substitute?

LPARAMETERS toHTMLgen AS awHTMLgen OF awHTML.prg, tlInnerHTML && {en} doc in Parent Code {fr} doc dans le code parent

If ThisForm.wBSlHTMLgen
	Text to cScript textmerge noshow flags 1
		*!* Here the HTML to add to the standard generate code
	EndText
	
	If Vartype(ToHtmlGen) = "O" &&Intial HTML generation
		ToHtmlGen.cScriptJsAdd(cScript)
	Else
		ToHtmlGen = cScript
	Endif
	
EndIf

DoDefault(toHTMLgen)

Here is to substitute

LPARAMETERS toHTMLgen AS awHTMLgen OF awHTML.prg, tlInnerHTML && {en} doc in Parent Code {fr} doc dans le code parent

If ThisForm.wBSlHTMLgen

	This.AddProperty("wcIdBs",This.wcID + "_bs")
	This.wcHTML = [<div id="] + THis.wcIdBs + [">]
	text to This.wcHTML textmerge additive noshow flags 1
		*!* Here the new HTML Code
	endtext
	This.wcHTML = This.wcHTML  + [</div>]
Endif
Gravatar is a globally recognized avatar based on your email address. re: Adding code to object.wchtmlgen method
  FoxInCloud Support - Thierry N.
  Michele
  Feb 7, 2020 @ 01:23am

I understand you want to:

  1. add some HTML to what FoxInCloud generates initially,
  2. later, during some user action, add some more HTML

Here is the code for that:

procedure wcHTMLgen
LPARAMETERS toHTMLgen AS awHTMLgen OF awHTML.prg, tlInnerHTML && {en} doc in Parent Code {fr} doc dans le code parent

If ThisForm.wBSlHTMLgen
	local cHTML
	Text to cHTML textmerge noshow flags 1
		*!* Here the HTML to add to the standard generate code
	EndText
	
	do case
	case empty(m.cHTML)
	Case Vartype(ToHtmlGen) = "O" && Intial HTML generation
		ToHtmlGen.cHTMLadd = m.cHTML
		ToHtmlGen.lHTMLaddInside = .T. && if this element is a container and you want your additional HTML inside it
	Otherwise && called by some user event and/or .Refresh_()
		thisForm.wcScriptJSadd(textmerge([jQuery("#<<this.wcID>>").append(<<cLitteralJS(m.cHTML)>>);]))
	Endcase
EndIf

You need a dodefault() only if you have code in the parent class; FoxInCloud has no code in this method.

© 1996-2024