Skip to main content
Participating Frequently
February 29, 2024
Answered

Internal error occurs when getting the property of anchored frame with FM2015

Hi.

 

I have a plugin working with FM2015.

I use the following code to add an anchored frame and change the property.

AFrameId = F_ApiNewAnchoredObject(docId, FO_AFrame, &Loc);
props = F_ApiGetProps(docId, AFrameId);
j = F_ApiGetPropIndex(&props, FP_AnchorType);	
props.val[j].propVal.u.ival = FV_ANCHOR_SUBCOL_LEFT;
j = F_ApiGetPropIndex(&props, FP_Fill);
props.val[j].propVal.u.ival = FV_FILL_WHITE;
...

F_ApiSetProps(docId, AFrameId, &props);
F_ApiDeallocatePropVals(&props);

After running F_ApiGetProps(), the following internal error occurs.


This plugin works well with FM2020, but not FM2015.
Is there a way to solve this?

This topic is closed to new replies. Start a new post to keep the conversation going.
frameexpert
frameexpertCorrect answer
Community Expert
March 4, 2024

I suspect that the problem is with the way you are getting and setting properties. Instead of getting, updating, and setting the properties using props, try changing them directly, like this:

F_ApiSetInt(docId, AFrameId, FP_Fill, FV_ANCHOR_SUBCOL_LEFT);
F_ApiSetInt(docId, AFrameId, FP_Fill, FV_FILL_WHITE);
www.frameexpert.com

11 replies

frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
March 4, 2024

I suspect that the problem is with the way you are getting and setting properties. Instead of getting, updating, and setting the properties using props, try changing them directly, like this:

F_ApiSetInt(docId, AFrameId, FP_Fill, FV_ANCHOR_SUBCOL_LEFT);
F_ApiSetInt(docId, AFrameId, FP_Fill, FV_FILL_WHITE);
Translate
www.frameexpert.com
AIAIAIAuthor
Participating Frequently
March 5, 2024

I followed your idea and succeeded in setting the property with no inteanal error.

But,  another problem occures.

 

I want to set  the anchored frame's color, so I use the following code.

But this code failed, the frame's color is set to black.

colorId = F_ApiGetNamedObject(docId, FO_Color, (StringT)"Red");
F_ApiSetId(docId, AFrameId, FP_Color, colorId);

I also tried the following code, but it also failed, the frame's color is set to black.

colorId = F_ApiGetNamedObject(docId, FO_Color, (StringT)"Red");
setVal.propIdent.num = FP_Color;
setVal.propVal.valType = FT_Id;
setVal.propVal.u.ival = colorId;
F_ApiSetPropVal(docId, AFrameId, &setVal);

I found that after running F_ApiGetNamedObject(), the colorId is always set to 0, even I set the color to Red, bule, or Magenta.

 

Is there something wrong with my code?

Translate
frameexpert
Community Expert
Community Expert
March 5, 2024

Try this:

 

F_ApiSetInt(docId, AFrameId, FP_Fill, FV_FILL_BLACK);
colorId = F_ApiGetNamedObject(docId, FO_Color, (StringT)"Red");
F_ApiSetId(docId, AFrameId, FP_Color, colorId);

A graphic object has to be filled with black before a color can be applied to it.

 

Translate
www.frameexpert.com
frameexpert
Community Expert
Community Expert
March 4, 2024

I would comment out a few lines, recompile, and test again. For example,

//j = F_ApiGetPropIndex(&props, FP_AnchorType);	
//props.val[j].propVal.u.ival = FV_ANCHOR_SUBCOL_LEFT;
//j = F_ApiGetPropIndex(&props, FP_Fill);
//props.val[j].propVal.u.ival = FV_FILL_WHITE;

You want to determine what is actually making it crash.

Translate
www.frameexpert.com
Participating Frequently
March 1, 2024

Hi.

&Loc on the first line is undefined.

Translate
AIAIAIAuthor
Participating Frequently
March 4, 2024

&Loc is defined and I have checked that it's value is set.

Translate
Participating Frequently
March 4, 2024

Did you compile using the FDK specific to each version? FM2020 is 64bit only, so that may be the cause.

Translate