trichview.support
Problems with Tags as PChars |
Author |
Message |
Christian Kirchhoff |
Posted: 03/13/2003 15:20:31 Hello, I'm developing a kind of HTML Editor with a TRichViewEdit control. I've created several special components which I insert into the Editor as Controls. I set rvfoSaveControlsBody to false. The attributes of each control is stored in the controls tag as a string. When reloading the document, the controls are initialized according to the values in the tag string. My problem: The tag strings are sometimes cut or damaged as if there is a problem with the memory allocation. I use code like this: > Props := HRPropsToPChar; > TRichViewEdit.SetItemTag(ItemNo, Integer(StrNew(Props))); Props is of type PChar and setup properly, e.g. ";Align=2;Size=5;PercentWidth=100;Shade=0;" When I add the following code: > ATag := TRichViewEdit(Parent).GetItemTag(ItemNo); > ShowMessage('x' + PChar(ATag) + 'x'); I sometimes get results like ";Align=2;Size=5;PercentWidth=100;Shade=1¶=1& 0" So the input for the SetItemTag procedure is correct, but after that the tag string is broken sometimes. Thus I have problems initializing the controls with the correct values, because the tag string is broken. Here is a snippet of RVF code (only the "body" part). I've inserted 2 of my controls in the document and an empty line between them: -5 1 0 0 1 ;Align=2;Size=5;PercentWidth=100;Shade=0; 0 User_HR 0 1 0 0 0 ;Align=2;Size=5;PercentWidth=100;Shade=0; -5 1 0 0 1 ;Align=2;Size=5;PercentWidth=100;Shade=1¶=1& 0 User_HR ---- WHat's strange is that one of the tags appears to be doubled, because as you can see there are three tag strings, but I only have inserted two controls, and the Name of the controls ("User_HR") correctly appears only two times in the RVF code. Do I have to do anything different? What could cause these problems? Regards, Christian Kirchhoff |
Powered by ABC Amber Outlook Express Converter