Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is this a Bug in Concatenated String ?
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Is this a Bug in Concatenated String ?
Divers
Thread ID:
00754611
Message ID:
00754611
Vues:
50
Hi

The following code is used to iterate through the controls in a container and return the DHTML code to render the container and controls in a browser. However, it fails if the Container contains a pageframe that contains another container which contains controls. The failure occurs in the container on the pageframe.

The line lcTxt=lcTxt+.Controls(ln).Render() does not add the text returned by the render function, instead replaces lcTxt with the value returned. Thus loosing all the previously accumulated text in the string. This happens on the recusive call to the container Render function. This happens with or without the "with/Endwith" code.
Lparameters lcStyle
Local ln,lcTxt
lcTxt=[<div name=']+This.Name+[' style='display: block; position: absolute; width: ]+;
Transform(This.Width)+[px; top: ]+;
Transform(This.Top)+[px; left: ]+;
Transform(This.left)+[px; height: ]+;
Transform(This.left)+[px;'>]
With This
   For ln=1 To .ControlCount
*      lcTxtR=.Controls(ln).Render()
*      lcTxt=lcTxt+lcTxtR
       lcTxt=lcTxt+.Controls(ln).Render()
   EndFor
EndWith   
lcTxt=lcTxt+"</div>"
Return lcTxt
If I change the code to replace the lcTxt=lcTxt+.Controls(ln).Render() with two separate lines it works correctly.
Lparameters lcStyle
Local ln,lcTxt
lcTxt=[<div name=']+This.Name+[' style='display: block; position: absolute; width: ]+;
Transform(This.Width)+[px; top: ]+;
Transform(This.Top)+[px; left: ]+;
Transform(This.left)+[px; height: ]+;
Transform(This.left)+[px;'>]
With This
   For ln=1 To .ControlCount
     lcTxtR=.Controls(ln).Render()
     lcTxt=lcTxt+lcTxtR
   EndFor
EndWith   
lcTxt=lcTxt+"</div>"
Return lcTxt
I can reproduce this error in VFP 7.0.

Simon
Simon White
dCipher Computing
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform