trichview.com

trichview.support




MoveCaretTo(X,Y) for use in drag/drop


Return to index


Author

Message

Atle Kåven

Posted: 03/07/2002 6:11:26


A while ago I learned that the evaluation version did not support drag&drop

on tables. No that I have a real version I still have problems with placeing

the caret under the mouse. I have tried with this function called from a

PostMessage. Any better solutions?


procedure TForm1.MoveCaretTo(X, Y: Integer);

var RVData: TCustomRVFormattedData;

    ItemNo, Offs: Integer;

begin

  inc(X, CurrentRV.HScrollPos);

  inc(Y, CurrentRV.VScrollPos*CurrentRV.VSmallStep);

  CurrentRV.RVData.GetItemAtEx(X,Y,RVData,ItemNo,Offs);

  if ItemNo<0 then exit;

  if RVData is TRVTableCellData then begin

    TRVTableCellData(RVData).Edit;

    RVData := TCustomRVFormattedData(RVData.GetRVData);

  end;

  RVData.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);

  RVData.Invalidate;

end;







Powered by ABC Amber Outlook Express Converter