trichview.com

trichview.support




Re: Create Hypertext to call Forms


Return to index


Author

Message

Sergey Tkachenko

Posted: 05/13/2005 23:04:57


> FIRST:

> when I add the record in the table I have the FIELD name added in RV. how

> I can find the field in the document before saving?


I gave you two functions - returning the count of fields and returing the

count of fields with the given tag.

You can use the last one to determine if the given field exists in the

document.

If you use TDBRichViewEdit, yse table.BeforePost event, it occurs before

saving.


If you have many fields and large document, checking the presense of each

field separately is unefficient.

It's better to create a procedure which will fill a list of all fields in

the document.

Later, you can search in this list.

This procedure can be implemented like these 2 functions mentioned above,

but here I'll implement it in another way - using RVData.EnumItems method.

This method calls some procedure for each item.


Add FieldList: TStringList in the form's declaration.



procedure TForm1.EnumFields(RVData: TCustomRVData; ItemNo: Integer;

  var UserData1: Integer; const UserData2: String;

  var ContinueEnum: Boolean);

var StyleNo: Integer;

begin

  StyleNo := RVData.GetItemStyle(ItemNo);

  if (StyleNo>=0) and

     (rvprModifyProtect in RVStyle1.TextStyles[StyleNo].Protection) then

    FieldList.Add(PChar(RVData.GetItemTag(ItemNo));

  ContinueEnum := True;

end;


Using:


var v: Integer;

begin

  v := 0;

  FieldList := TStringList.Create;

  rve.RVData.EnumItems(EnumFields, v, '');

  // now FieldList contains codes of all fields in the document

  <do something with FieldList>

  FieldList.Free;

end;



> or

> the field is protected I need select it all to delet, correct? in this

case,

> it does not have a function to see when the field is being excluded?


There is a function OnItemAction. If you delete item, it is called with

"move-to-undo-buffer' parameter.

When you add item or undelete it, it's called with "inserting" or

"move-from-undo-buffer" parameter.

But I recommend to determine presense of fields on saving instead.


>

> another necessity is disabled the Undo" when excluding a field. How?


You can call ClearUndo. But it will clear all undo history. It's not

possible to delete undo info for newer operations without deleting undo info

for older operations.






Powered by ABC Amber Outlook Express Converter