Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is this a Bug in Concatenated String ?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00754611
Message ID:
00754612
Views:
18
It also fails in VFP 8.0 Beta

Simon

>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
Previous
Reply
Map
View

Click here to load this message in the networking platform