• Hi Julian,

    I am custom drawing bookmark tags and field objects etc using the onTextObjectGetTextEx.

    From within this event what is the best way of detecting whether the mouse is over and object and if so which one and also whether the mouse is over the opening or closing tag.

    Many thanks

    Mark

  • Hi Julian,

    Not quite sure what you mean. I wish to draw objects differently if the mouse is over them. I can only do this within the onTextObjectGetTextEx.

    Are you suggesting that I perhaps set some sort of variable (eg ObjUnderMouse:TTextObject) to idenitfy the object within the mousemove event and then reference that in onTextObjectGetTextEx? I've no problem doing that I was just wondering if there was a slightly more elegant solution.

    However, how do I detect what is the object under the mouse?

    Also, how do I detect whetyher mouse is over opening or closing tag?

    Thanks

    • Offizieller Beitrag

    Hi,

    >>Not quite sure what you mean. I wish to draw objects differently if the mouse is over them. I can only do this within the onTextObjectGetTextEx. <<I>>Are you suggesting that I perhaps set some sort of variable (eg ObjUnderMouse:TTextObject) to idenitfy the object within the mousemove event and then reference that in onTextObjectGetTextEx? I've no problem doing that I was just wondering if there was a slightly more elegant solution. <<The>>However, how do I detect what is the object under the mouse?

    OnTextObjectMouseMove and OnMouseMove

    You can also use:
    function TWPCustomRtfEdit.CodeObjectAtXY(x, y: Integer; var Code: TWPTextObj): Boolean;

    >>Also, how do I detect whetyher mouse is over opening or closing tag?

    From the properties of the found object - wpobjIsOpening, wpobjIsClosing in obj.Mode

    Julian

  • If I create a bookmark with BookmarkInput and I want to find out the TWPTextObj under the mouse, OnTextObjectMouseMove and CodeInsideOf only work if the mouse position is over the start tag or the end tag.

    How can I get the TWPTextObj object that is between the start tag and the end tag ?


    Michel W.

    • Offizieller Beitrag

    Hi,

    >> How can I get the TWPTextObj object that is between the start tag and the end tag ?

    You can use CodeInsideOf(x,y, wpobMergeText)

    Also see:
    // This version is useful if you need to do further checks on the par/posinpar
    function CodeInsideOf(x, y: Integer; ObjType: TWPTextObjType; var par: TParagraph; var pos_in_par: Integer): TWPTextObj; overload;


    Julian


    openObj := CodeInsideOf(FClientMouseX, FClientMouseY, wpobjHyperlink, par, posinpar);