Implement OnContextPopup for objects

  • Hello,


    default components have the event OnContextPopup, which is helpful to popup a DevEx menu for example, instead the standard popup menu.


    Can you implement a OnObjectContextPopup but with an additional parameter: the clicked object...


    You are doing something like this in TWPCustomRtfEdit.DoContextPopup for images, but i have no chance to act on TextBoxes! You can give the CurrentTextObjectUnderMouse to the event...


    Regards, Kai Brendel

  • You can use TextObjectMouseDown.


    procedure TForm1.WPRichText1TextObjectMouseDown(Sender: TWPCustomRtfEdit;
    pobj: TWPTextObj; obj: TWPObject; Button: TMouseButton; Shift: TShiftState; X,
    Y: Integer);
    begin
    if Button=mbRight then
    PopupMenu1.Popup( Mouse.CursorPos.X, Mouse.CursorPos.Y );
    end;



    The OnContextPopup makes sense, since it is also triggered by the special context menu key. Otherwise the required functionality can be achieved with OnMouseDown.