trichview.support.examples
Re: Example: dialog on double click |
Author |
Message |
Slavi Marinov |
Posted: 01/19/2004 13:47:32 And what if the picture is in a table? --Slavi "Sergey Tkachenko" <svt@trichview.com> wrote in message news:4005385d$1@support.torry.net... > This code shows how to display dialog on double clicking pictures in > TRichViewEdit. > This code uses RichViewActions (dialog is shown by the line > rvActionsResource.rvActionItemProperties1.Execute) but it is applicable to > your own dialog. > > There is only one non-trivial issue in this code. The dialog prevents editor > to receive mouse-up message. To avoid this problem, PostMessage is used. > > procedure TForm3.RichViewEdit1RVMouseDown(Sender: TCustomRichView; > Button: TMouseButton; Shift: TShiftState; ItemNo, X, Y: Integer); > var RVData: TCustomRVFormattedData; > AX, AY, AItemNo, AOffs: Integer; > begin > // execution only on left double click > if not ((ssLeft in Shift) and (ssDouble in Shift)) then > exit; > // converting client coords --> document coords > AX := X+RichViewEdit1.HScrollPos; > AY := Y+RichViewEdit1.VScrollPos*RichViewEdit1.VSmallStep; > // if clicking on picture .... > if RichViewEdit1.GetItemAt(AX, AY, RVData, AItemNo, AOffs, True) and > ((RVData.GetItemStyle(AItemNo)=rvsPicture) or > (RVData.GetItemStyle(AItemNo)=rvsHotPicture)) then begin > // showing dialog > rvActionsResource.rvActionItemProperties1.Execute; > // dialog "eats" mouse-up message. stimulating it > PostMessage(TCustomRichViewEdit(Sender).TopLevelEditor.Handle, > WM_LBUTTONUP, 0, MakeLong(X,Y)); > end; > end; > > |
Powered by ABC Amber Outlook Express Converter