Copy link to clipboard
Copied
Hi,
I have a function that copy a selected graphic n-times to special places in my document.
After that i delete the selected graphic.
When i use the function a second time with an other grapic the gui show me the preview of the first graphic instead.
It happens since FM19 in FDK and in ExtendScript.
With this simple function i can reproduce the Bug:
function CopySelectedGraphic()
{
test_run_count++;
var graphic = null;
var doc = app.ActiveDoc;
if(doc.ObjectValid())
{
graphic = doc.FirstSelectedGraphicInDoc;
if(graphic.ObjectValid() && graphic.constructor.name == "Inset")
{
var new_g = doc.NewGraphicObject(Constants.FO_Inset, doc.CurrentPage.PageFrame) ;
new_g.Width = graphic.Width;
new_g.Height = graphic.Height;
new_g.LocY = (15 + (test_run_count * 25))* METRIC_MM;
new_g.LocX = 90 * METRIC_MM;
new_g.InsetFile = graphic.InsetFile;
graphic.Delete();
doc.Redisplay();
}
}
}
Initial situation:
Steps:
- select "Graphic A"
- execute CopySelectedGraphic()
- select "Graphic B"
- execute CopySelectedGraphic()
- select "Graphic C"
- execute CopySelectedGraphic()
End situation:
After that the preview of "Graphic B" is wrong.
You see it happens only at "Graphic B" and not on "Graphic C".
Guess:
Inset.Delete() releases the ObjectID and the next Document.NewGraphicObject() reuse this ObjectID. If the dimensions of the selected/new graphic match the last deleted graphic, FM19 reuse the wrong preview.
Workarround:
Click on Zoom-Button "-" and then on "+" again.
1 Correct answer
Yes that helps to automate the workaround.
Same in FDK:
docId = F_ApiGetId(0, FV_SessionId, FP_ActiveDoc);
displaying = F_ApiGetInt(0, FV_SessionId, FP_Displaying);
if (!displaying) F_ApiSetInt(0, FV_SessionId, FP_Displaying, True);
F_ApiSetMetric(FV_SessionId, docId, FP_Zoom, F_ApiGetMetric(FV_SessionId, docId, FP_Zoom) - 1000);
F_ApiSetMetric(FV_SessionId, docId, FP_Zoom, F_ApiGetMetric(FV_SessionId, docId, FP_Zoom) + 1000);
if (!displaying) F_ApiSetInt(0, FV_SessionId, FP_Displaying, False)
...
Copy link to clipboard
Copied
Hi,
I was able to reproduce this. It definitely seems like a bug. I could not find any way to make the preview change with actions on the graphic object.
However, your UI workaround gave me a clue for a script workaround. I did a programmatic change to the document zoom and it had the same effect. That is, it restored the correct preview. I did this in ExtendScript after changing the graphic InsetFile:
doc.Zoom = doc.Zoom + 1000;
doc.Zoom = doc.Zoom - 1000;
It seems you have to alter the zoom at least 1%. So, I think you could use this as a workaround in your code.
Hope this helps,
Russ
Copy link to clipboard
Copied
Yes that helps to automate the workaround.
Same in FDK:
docId = F_ApiGetId(0, FV_SessionId, FP_ActiveDoc);
displaying = F_ApiGetInt(0, FV_SessionId, FP_Displaying);
if (!displaying) F_ApiSetInt(0, FV_SessionId, FP_Displaying, True);
F_ApiSetMetric(FV_SessionId, docId, FP_Zoom, F_ApiGetMetric(FV_SessionId, docId, FP_Zoom) - 1000);
F_ApiSetMetric(FV_SessionId, docId, FP_Zoom, F_ApiGetMetric(FV_SessionId, docId, FP_Zoom) + 1000);
if (!displaying) F_ApiSetInt(0, FV_SessionId, FP_Displaying, False);
The 2 additional GUI refresh cycles are still annoying. I waiting for a Bugfix.
Chris
Copy link to clipboard
Copied
re: I waiting for a Bugfix.
Copy link to clipboard
Copied
I didn't know the bug report site before.
New Bug Id: FRMAKER-7962

