trichview.com

trichview.support




Searching for checkpoints in tables


Return to index


Author

Message

Atle Kåven

Posted: 03/04/2002 17:38:29


Sergey was so kind to write me a function that shows how to find checkpoints

in tables. Thank you Sergey!

I found this function very useful to me so I believe others also may benefit

from it some day. Sergeys post follows:


Below is the recursive function searching for the chekpoint with given name.

This function returns True, if such checkpoint exists. It does not return a

location where it exists, but you can modify this function (if you have

question, feel free to ask).

This function iterates document item by item, testing checkpoint for each

item.

Example call of this function:

SearchCheckpoint('Test', RichViewEdit1.RVData)


function SearchCheckpoint(const CheckpointName: String; RVData:

TCustomRVData): Boolean;

var i,r,c: Integer;

table: TRVTableItemInfo;

CPData: TCheckpointData;

Name: String;

Tag: Integer;

RE: Boolean;

begin

for i := 0 to RVData.Items.Count-1 do begin

CPData := RVData.GetItemCheckpoint(i);

if CPData<>nil then begin

RVData.GetCheckpointInfo(CPData, Tag, Name, RE);

if Name=CheckpointName then begin

Result := True;

exit;

end;

end;

if RVData.GetItemStyle(i)=rvsTable then begin

table := TRVTableItemInfo(RVData.GetItem(i));

for r := 0 to table.Rows.Count-1 do

for c := 0 to table.Rows[r].Count-1 do

if table.Cells[r,c]<>nil then begin

Result := SearchCheckpoint(CheckpointName,

table.Cells[r,c].GetRVData);

if Result then

exit;

end;

end;

end;

Result := False;

end;


Atle Kåven

Arctic Net as





Powered by ABC Amber Outlook Express Converter