Hi, this was a major source of frustration for me, for some time. The problem showed up when the element boundary display became "global." I put "global" in quotes, because it affects documents at the application level, but the property still lives at the document level. Once you set it on one document, all other documents inherit that setting.
Anyway, despite the fact that others said F_ApiSetInt() still worked the normal way, it never worked for me. Finally, I got a suggestion to use FCodes, which does work for me. It is a little more complicated, because you are emulating the usage of the FM menus, which is clumsy at best. Effectively, you have to determine what the current setting is, in order to determine what code to execute. Here is an FDK function that works for me:
// For setting, send one of:
// FV_ELEM_DISP_NONE
// FV_ELEM_DISP_BRACKETS
// FV_ELEM_DISP_TAGS
VoidT setElemBoundaryDisplay(F_ObjHandleT docId, IntT setting)
{
//If the doc is invalid, return
if(!F_ApiObjectValid(FV_SessionId, docId)) return;
//If there is nothing to change, just return
if (F_ApiGetInt(FV_SessionId, docId, FP_ElementBoundaryDisplay) == setting) return;
//If we are turning off, we need to first see what is
//currently turned on, so we know how to turn off.
if (setting == FV_ELEM_DISP_NONE)
{
if (F_ApiGetInt(FV_SessionId, docId, FP_ElementBoundaryDisplay) == FV_ELEM_DISP_BRACKETS)
ws_DoFCode(KBD_ELEM_BORDER);
else
ws_DoFCode(KBD_ELEM_TAGS);
}
//Otherwise, if we are setting brackets...
else if (setting == FV_ELEM_DISP_BRACKETS)
ws_DoFCode(KBD_ELEM_BORDER);
//Otherwise, if we are setting tags...
else
ws_DoFCode(KBD_ELEM_TAGS);
}
...and here is my ws_DoFCode() function:
VoidT ws_DoFCode(IntT fcode)
{
IntT fcodes[] = {fcode};
F_ApiFcodes(sizeof(fcodes)/sizeof(IntT), fcodes);
}
Here is the ExtendScript equivalent:
// For setting, send one of:
// Constants.FV_ELEM_DISP_NONE
// Constants.FV_ELEM_DISP_BRACKETS
// Constants..FV_ELEM_DISP_TAGS
function setElemBoundaryDisplay(doc, setting)
{
//If the doc is invalid, return
if(!doc.ObjectValid()) return;
//If there is nothing to change, just return
if(doc.ElementBoundaryDisplay == setting) return;
//If we are turning off, we need to first see what is
//currently turned on, so we know how to turn off.
if(setting == Constants.FV_ELEM_DISP_NONE)
{
if(doc.ElementBoundaryDisplay == Constants.FV_ELEM_DISP_BRACKETS)
Fcodes([FCodes.KBD_ELEM_BORDER]);
else
Fcodes([FCodes.KBD_ELEM_TAGS]);
}
//Otherwise, if we are setting brackets...
else if(setting == Constants.FV_ELEM_DISP_BRACKETS)
Fcodes([FCodes.KBD_ELEM_BORDER]);
//Otherwise, if we are setting tags...
else
Fcodes([FCodes.KBD_ELEM_TAGS]);
}
I hope this helps.
Russ