trichview.com

trichview.support




Re: Doble click Problem


Return to index


Author

Message

Sergey Tkachenko

Posted: 05/21/2004 23:40:51


Yes, there is a problem - dialog "eats" mouseup message which is necessary

complete making selection.


See the solution below:


---------------


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;




> when I do double click on a DBRichViewEdit I cause that it appears a

window

> of edition.

> but when I close the edition window the cursor of this in way edition and

it

> selects text without being automaticamente the button of the pressed

mouse.

> I use the event onDblClick of the control.

> I have used the event onrvdblclick but if the DBRichviewEdit is Empty it

> does not shoot the event.

>

>





Powered by ABC Amber Outlook Express Converter