WPTools7 Extra property for hyperlinks

  • Is WPTools 7 no longer supported. I can't see a forum for it.

    And this seems to be the only forum I can create a new thread in. So...

    WPTools 7.

    I want to store a hint with hyperlink objects.

    I thought I could use the Extra property, but when ever I try to add text it triggers an access violation. Looking at the code, it seems "Extra" is never actually created.

    Next thought was to store the hint as part of the display text and then use OnTextObjGetTextEx to manipulate the displayed text.

    Assumed this would be as simple as setting PrintString to the text I wanted, but that doesn't seem to be the case. If I wanted, for example, to change the displayed text to "Hello", how would I go about that?

    Next problem I faced was how to get the text object under the mouse in the mouse move event. Thought CodeObjectAtXY would get it, but it only fires when you are on the far right of the object and the far left of it (including from the edge of the object to the far left margin). GetObjectFromXY does the same.

    Many thanks.

    Einmal editiert, zuletzt von mwilliams (26. September 2023 um 20:23) aus folgendem Grund: Update

    • Offizieller Beitrag

    WPTools 7 came out 8.5.2013 and was updated until 21.2.2017 - pretty long.

    The question is in which which file format do you want to save your document. The extra data is only saved to WPT.

    Extra is only created on demand only by the method MakeExtra which takes an initialization string. Since Extra is a string list, it can store several poperties.

    For just a string I would recommend to use the property Params.

    In WPTools 7 You cannot use OnTextObjGetTextEx to show information for the hyperlinks easily.

    That is something which works in the latest 9.3 - it will show extra information AFTER the actual link. (In WPTools 9.3 there are some nice improvements for such use case since it is used actively in a powerful documentation tool which needs to show dynamic hyperlink data.)

    Assumed this would be as simple as setting PrintString to the text I wanted, but that doesn't seem to be the case. If I wanted, for example, to change the displayed text to "Hello", how would I go about that?

    The text displayed by a hyperlink is not the hyperlink object, it is the text between [a] .. [/a] - so if you wantr to store a different text there you need to change that text. Itz is just regular text, just like in HTML.

    Zitat

    Next problem I faced was how to get the text object under the mouse in the mouse move event. Thought CodeObjectAtXY would get it, but it only fires when you are on the far right of the object and the far left of it (including from the edge of the object to the far left margin). GetObjectFromXY does the same.

    Yes, this is because the hyperlink objects are actually not visible. You see only the embedded text. Thats just like bookmarks and merge fields.

    CodeObjectAtXY will not work because of this, but you can get the position under the cursor and check for open objext at that position.


    This is what CodeInsideOf does:

    function CodeInsideOf(X, Y: Integer; objtype: TWPTextObjType)

    : TWPTextObj; overload;

  • wpsupport 28. September 2023 um 12:21

    Hat den Titel des Themas von „WPTools7?“ zu „WPTools7 Extra property for hyperlinks“ geändert.
  • Thanks Julian. That sorted it.

    I am intending to move on to WPTools latest version. Trying to finish off long outstanding project at the moment and don't want to throw in any other distraction until I have done so.

    Hopefully, moving to V9 from V7 doesn't involve too much work.