Copy link to clipboard
Copied
I've written a script that goes through a document and changes the InsetFile path of a graphic, but I can't get the document to update the displayed graphic without either:
I tried using doc.Refresh(), with and without toggling app.Displaying, but the displayed graphic still didn't change. Is there a different method I should call? Here is a small snippit of code that reproduces the issue:
var doc = app.ActiveDoc;
app.Displaying = false;
var currentGraphic = doc.FirstGraphicInDoc;
while (currentGraphic.ObjectValid()) {
if (currentGraphic.reflect.name == "Inset" && currentGraphic.InsetFile != "") {
// currentGraphic.InsetFile = "C:\\Temp\\pending.png";
currentGraphic.InsetFile = "C:\\Temp\\approved.png";
break;
}
currentGraphic = currentGraphic.NextGraphicInDoc;
}
app.Displaying = true;
doc.Redisplay(); // Does not refresh the displayed graphic
// - "Object Properties" -> "Referenced File" displays the updated path. Clicking "Apply", without changing anything else, will update the displayed graphic
// - Saving, closing, and re-open document will display the correct graphic
Gah! Once again, I find the answer in the "Related Conversations" list as soon as I post the question. I really need to work on my Google-fu.
FM19 don't refresh the preview after copy a graphic by script
Summary - It appears to be a bug with doc.Refresh(): Bug Report FRMAKER-7962
Workaround from Russ Ward - Change the doc zoom level
doc.Zoom = doc.Zoom + 1000;
doc.Zoom = doc.Zoom - 1000;
Copy link to clipboard
Copied
Gah! Once again, I find the answer in the "Related Conversations" list as soon as I post the question. I really need to work on my Google-fu.
FM19 don't refresh the preview after copy a graphic by script
Summary - It appears to be a bug with doc.Refresh(): Bug Report FRMAKER-7962
Workaround from Russ Ward - Change the doc zoom level
doc.Zoom = doc.Zoom + 1000;
doc.Zoom = doc.Zoom - 1000;
Copy link to clipboard
Copied
Huh. I wonder if that works when you have a graphic imported by reference that you've updated on disk? Half the time it doesn't appear to be updated in the FM document, even though double-clicking on it will show the new version. I bet there's a cache somewhere that FM is referencing first.
Copy link to clipboard
Copied
I would think so, that was also something I saw when updating the InsetFile property - the displayed graphic wouldn't change, but double-clicking the graphic would open the new graphic.