Access Properties of any item

  • I would like to implement a context sensitive popup menu similar to MS Word when any object is clicked on with the right mouse button in order to be able to change its properties be it a hyperlink, picture or any other object.

    I should say that I'm surprised that this is not available by default!

    Is there a list of all possibilities somewhere that I haven't seen?

    Ken

    • Offizieller Beitrag

    Hi,

    I don't understand why You are "surprised". WPTools is not an application such as MSWord but a component which has to be fittet into an application. Hyperlinks for example do not have to be links to web pages, they can also be links to other data records, external files, topüics etc. It would not make sense to implement context guessing here.

    To implement a popup for images and objects use the event OnTextObjectMouseDown:

    Code
    procedure TWPTBXForm.WPRichText1TextObjectMouseDown(  Sender: TWPCustomRtfEdit; pobj: TWPTextObj; obj: TWPObject;  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin  if Button = mbRight then  begin    WPRichText1.SelectedObject := pobj;    GrPopup.Popup(Mouse.CursorPos.x, Mouse.CursorPos.y);  end;end;

    In that example all items use the same OnClick event and a unique tag.