Hi Russ,
I am trying to make the entire text frame containing a variable as clickable hypertext. However only a single line in the textframe is clickable.
How can I select the textframe containing the variable using framemaker API ? And will the marker object be created for textFrame type ?
I am using the following reference code.
tr.beg.objId = varId; // this is the id of the Graphic Title variable
tr.end.objId = varId;
tr.beg.offset = tr.end.offset = 0; // I also tried tr.end.offset = FV_OBJ_END_OFFSET;
F_ApiSetTextRange(FV_SessionId, docId, FP_TextSelection, &tr);
mrkrId = F_ApiNewAnchoredObject(docId, FO_Marker, &tr.beg);
// Find the Hypertext marker type to get the hypertypeId
// Convert the marker into a hyperlink
F_ApiSetId(docId, mrkrId, FP_MarkerTypeId, hyperTypeId);
// Set the link
F_ApiSetString(docId, mrkrId, FP_MarkerText, (StringT)(const char *)mrkrText);
It would be great if you could give me some pointers here.
Thanks,
Asha Rayakar
Hi Asha,
If you have succeeded in making a hyperlink at all, you are on the right track. Based on your description, it sounds like you are attempting to use an existing text frame to insert your hypertext marker, a text frame that already contains text. If you put a hypertext marker into a paragraph with text, indeed, the only area that will be clickable will be that paragraph. There is nothing you can do about that... it is core FrameMaker behavior.
If you put a hypertext marker into a text frame that has zero text (not even a single whitespace), FrameMaker will default to making the entire frame area clickable. So, if you are attempting to make an entire page clickable, you will have to draw a new text frame that covers the entire page and insert the hypertext marker into it, with no text. You can experiment with this manually in the GUI.
In your code, you should be using FO_Pgf ids for the tr.beg.objId and tr.end.objid members. It looks like you might be using variable IDs which is incorrect. If you do have a variable ID, you can find the corresponding text range/location with its FP_TextRange property. This will return the proper FO_Pgf IDs that you need.
If you are looking for the text frame that contains a variable, you can use something like:
F_TextRangeT tr;
F_ObjHandleT textFrameId;
tr = F_ApiGetTextRange(docId, varId, FP_TextRange);
textFrameId = F_ApiGetId(docId, tr.beg.objId, FP_InTextFrame);
Does this help out at all?
Russ