Page 1 of 1

Highlight and delete Fields?

Posted: Sat Nov 11, 2006 10:27 pm
by alogrep
Hi

I adde a Field in a test richview with InsertStringTag.
I have a button that on click, fills in that field (e.g. field 'name' changes to
'Jane Doe'.
Now, I highlighted the field (which shows as a regular test) and Cut it (or press Delete). It disappears. BUT if I press that button it still inserts 'Jane Doe' where the field was. What is the easiest way to delete the 'appaearance' of the field, and the field iself as well, so that If I press that button again, 'Jan Doe' will not be inserted in the editor?
Thanks.

Posted: Sun Nov 12, 2006 9:43 am
by Sergey Tkachenko
Sorry, I am not sure that I understand the question.
1) What code is in this button's OnClick
2) Please give me examples of document text:
a) text what you want
b) text what appears

Posted: Sun Nov 12, 2006 4:57 pm
by alogrep
OK. I have a Tcombolistbox with a list of 'fields' (e.g. Customer Code, Customer Name, etc.). Click an item and it does this
RichViewEdit1.CurTextStyleNo := 1;
with ComboBox1 do
s:=Items[ItemIndex];
RichViewEdit1.InsertStringTag(PChar(s),Integer(StrNew(PChar(s))));
Then I also have a button with this Onclick
FillFields(RichviewEdit1.RVData);
and FillFields does:
for i := 0 to RVData.ItemCount-1 do
if RVData.GetItemStyle(i)=rvsTable then begin
..........................
end else if RVData.GetItemStyle(i)>=0 then begin
FieldName := PChar(RVData.GetItemTag(i));
if FieldName<>'' then begin
RVData.SetItemText(i, GetFieldValueFromDatabase(FieldName));
Richviewedit1.format;
end;
end;
I click 'Customer Name' in the combolistbox, it correctly adds the text field in the richview control that at this time shows 'Customer Name'.
Then press the button and 'Custome Name' becomes 'Joe Bonanno'.
This is all as it should be. BUT when I highlight that field ed delete it,
still when i click the button, 'Joe Bonanno' appears, i delete it again, press the button and it reappears again. How do i REALLY delete a field inserted with InsertStringTag?