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.
Highlight and delete Fields?
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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?
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?