It works with the solution I show below sometimes, but sometimes the image editing window opens even though it's a text.
Following windows used for the same text:
1. rv - TRichviewEdit in normal mode
2. rv - the same TRichviewEdit in puristic mode (different look for revision)
3. srv - TSRichViewEdit
(see image below)
Here is how I have tried to solve it so far:
Code: Select all
procedure TfMain.rvMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var RVData: TCustomRVFormattedData;
ItemNo, Offs: Integer;
begin
. . .
// Popup menu text or graphic
FPicItemNo := -1;
if Pages then // = TSRichViewEdit
srv.GetItemAt(X, Y, RVData, ItemNo, Offs, False)
else
rv.GetItemAt(X, Y, RVData, ItemNo, Offs, False);
if CurrRV.GetItem(ItemNo) is TRVGraphicItemInfo then
FPicItemNo := ItemNo;
. . .
end;
Code: Select all
procedure TfMain.rvRVMouseDown(Sender: TCustomRichView; Button: TMouseButton; Shift: TShiftState; ItemNo, X, Y: Integer);
var RVData: TCustomRVFormattedData;
ItemNo, Offs: Integer;
begin
if (Button = mbRight) and (FPicItemNo <> -1) then
begin
CurrRV.SetSelectionBounds(FPicItemNo, 1, FPicItemNo, 1);
EditImage;
end;
end;