trichview.com

trichview.support




Re: Right Click select image


Return to index


Author

Message

Sergey Tkachenko

Posted: 01/06/2005 15:39:29


Use OnRVMouseUp event. In this event, use GetItemAt method to get the clicked

item:


procedure TForm1.MyRichViewMouseUp(Sender: TCustomRichView;

  Button: TMouseButton; Shift: TShiftState;

  ItemNo, X, Y: Integer);

var LRVData: TCustomRVFormattedData;

    LItemNo, LOffs: Integer;

    pt: TPoint;

begin

  pt := MyRichView.ClientToDocument(Point(X,Y));

  MyRichView.GetItemAt(pt.X, pt.Y, LRVData,

    LItemNo, LOffs, True);

  if LItemNo<0 then

    exit;

  if (LRVData.GetItemStyle(LItemNo)=rvsPicture) or

     (LRVData.GetItemStyle(LItemNo)=rvsHotPicture) then begin

    LRVData := TCustomRVFormattedData(LRVData.Edit);

    LRVData.SetSelectionBounds(LItemNo,0,LItemNo,1);

  end;

end;


>Everytime when user right click on RVE, I will move the caret to the mouse

>position. But right click on image, MoveCaretTo(X, Y) will no longer work.

>

>1. I need to first check what I have right click on, text or picture or

>hyperlink etc. Then do action accordingly.

>

>2. If it is a picture, I want to select the picture.

>

>





Powered by ABC Amber Outlook Express Converter