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.)
- procedure TFrameOutlines.wpt_outlineTextObjGetTextEx(RefCanvas: TCanvas;
- TXTObject: TWPTextObj; var PrintString: WideString; var WidthInPix,
- HeightInPix: Integer; var PaintObject: TWPTextObj; Xres, YRes: Integer);
- var eo : TWPTextObj; s : string;
- if TXTObject.ObjType=wpobjHyperlink then
- if wpobjIsOpening in TXTObject.Mode then
- PrintString := '['
- else if wpobjIsClosing in TXTObject.Mode then
- eo := TXTObject.StartTag;
- if eo<>nil then
- s := eo.ExtraProp['extraprop'];
- if s<>'' then s := #32 + #$2282 + s ;
- PrintString := #$2192 + eo.Source + s + ']'
- else PrintString := ']';
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.
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;