trichview.com

trichview.support




Re: Linking fields with others rv


Return to index


Author

Message

Sergey Tkachenko

Posted: 05/05/2005 13:20:36


Well, you can use checkpoints for this purpose.

Add checkpoints after rvTop and before rvBottom.

These checkpoints will divide the document into 3 parts. You need to

determine in which part the user doubleclicked.


Assembling the document (for simplicity, I assume that the content of

rvDetail is added one time)


procedure AddDoc(source, dest: TCustomRichView);

var Stream: TMemoryStream;

begin

  Stream := TMemoryStream.Create;

  source.SaveRVFToStream(Stream, False);

  Stream.Position := 0;

  dest.InsertRVFFromStream(Stream, dest.ItemCount);

  Stream.Free;

end;


Document generation:


rvMaster.Clear;

AddDoc(rvTop, rvMaster);

rvMaster.AddNamedCheckpoint('top');

AddDoc(rvDetail, rvMaster);

rvMaster.AddNamedCheckpoint('bottom');

AddDoc(rvBottom, rvMaster);

rvMaster.Format;


The doubleclick processing:


procedure TForm1.rvMasterDblClick(Sender: TObject);

var pt: TPoint;

    CheckpointData: TCheckpointData;

    Y: Integer;

begin

  GetCursorPos(pt);

  pt := rvMaster.ScreenToClient(pt);

  pt := rvMaster.ClientToDocument(pt);

  CheckpointData := rvMaster.FindCheckpointByName('top');

  Y := rvMaster.GetCheckpointYEx(CheckpointData);

  if pt.Y<=Y then begin

    // show form for editing TOP

    exit;

  end;

  CheckpointData := rvMaster.FindCheckpointByName('bottom');

  Y := rvMaster.GetCheckpointYEx(CheckpointData);

  if pt.Y<Y then begin

    // show form for editing DETAIL

    end

  else begin

    // show form for editing BOTTOM

  end;

end;



>

> Hi

> I created one rvMaster and I have more three DBRichViewEdit:

> They are:

>  - rvTop

>  - rvDetail

>  - rvBottom

> all are DBRichViewEdit.

>

> I insert in rvMaster the three Blob fields: Top, Detail and Bottom.

> I use the the function "ReplaceFields/LoadData(const Code: String):

TMemoryStream"

> to replace them.

>

> I need that in rvMaster when I double-click(or Ctrl+click) in the field

(Top,

> Detail or Bottom) opened the form that it will go to contain the

corresponding

> field in a rvTop, RvDetail or rvBottom.

>

> How I make this?

>

>

> thanks

>

>

>

>

>

>





Powered by ABC Amber Outlook Express Converter