celestian
October 22nd, 2020, 15:21
Seems like getImageSize() is not in FGU at this time?
local w = Interface.openWindow("imagewindow",nodeImage);
if w then
local ctrl = w.createControl("image_refblock", "image");
Debug.console("manager_author_adnd.lua","createBlockImage","window (w)",w);
Debug.console("manager_author_adnd.lua","createBlockImage","ctrl",ctrl);
nXOriginal, nYOriginal = ctrl.getImageSize();
nX, nY = getAdjustedImageSize(win,ctrl);
w.close();
end
The above code fails when the values "w" and "ctrl" seem valid.
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'sImageNode' | s'image.id-00002'
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'sImageCaption' | s'Image tsr'
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'nodeImage' | databasenode = { image.id-00002 }
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'window (w)' | windowinstance = { class = imagewindow, node = image.id-00002, x,y,w,h = 658,44,778,765 }
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'ctrl' | genericcontrol = { name = s'image', x,y,w,h = 0,0,0,0 }
[10/20/2020 5:09:50 PM] [<color="red">ERROR</color>] Script execution error: [string "scripts/manager_author_adnd.lua"]:398: attempt to call field 'getImageSize' (a nil value)
Same output in FGC except getImageSize() works.
If there is a better method to collect this data now I'd be happy to switch to it. I always thought loading the image to get the image size then closing it was a bit... clunky. The reason I do this is to find out the size of the image, adjust so that it fits within the requirements for inline image views in a ref-manual.
local w = Interface.openWindow("imagewindow",nodeImage);
if w then
local ctrl = w.createControl("image_refblock", "image");
Debug.console("manager_author_adnd.lua","createBlockImage","window (w)",w);
Debug.console("manager_author_adnd.lua","createBlockImage","ctrl",ctrl);
nXOriginal, nYOriginal = ctrl.getImageSize();
nX, nY = getAdjustedImageSize(win,ctrl);
w.close();
end
The above code fails when the values "w" and "ctrl" seem valid.
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'sImageNode' | s'image.id-00002'
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'sImageCaption' | s'Image tsr'
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'nodeImage' | databasenode = { image.id-00002 }
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'window (w)' | windowinstance = { class = imagewindow, node = image.id-00002, x,y,w,h = 658,44,778,765 }
[10/20/2020 5:09:50 PM] s'manager_author_adnd.lua' | s'createBlockImage' | s'ctrl' | genericcontrol = { name = s'image', x,y,w,h = 0,0,0,0 }
[10/20/2020 5:09:50 PM] [<color="red">ERROR</color>] Script execution error: [string "scripts/manager_author_adnd.lua"]:398: attempt to call field 'getImageSize' (a nil value)
Same output in FGC except getImageSize() works.
If there is a better method to collect this data now I'd be happy to switch to it. I always thought loading the image to get the image size then closing it was a bit... clunky. The reason I do this is to find out the size of the image, adjust so that it fits within the requirements for inline image views in a ref-manual.