FoxInCloud
Adding code to object.wchtmlgen method
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
I understand you want to:
- add some HTML to what FoxInCloud generates initially,
- 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.