row = dlg.Control("somelistview").AddItem("this is a test line");
dlg.Control("somelistview").GetItemAt(row).icon=Script.LoadImage("someimage.png");
In the latter case, only a path to the icon works - as was my initial issue. This works:
var iconpath = FSU.Resolve('/dopusdata/icons');
row = dlg.Control("somelistview").AddItem("this is a test line");
dlg.Control("somelistview").GetItemAt(row).icon=iconpath + "\\someimage.png";
I couldn’t find how to load an image which is present within my script project. This would be very inconsistent. Directory Opus script project files being sophisticated enough to include its own icons, one would expect this to work for all icons that can be loaded in a dialog.
Jon, does that mean that starting with the next beta we'll be able to use PNGs as icons in a listview? And does that also mean we could use the internal icons (e.g., in markup controls they're <%ddbi:xyz>) and icons from icon sets?
@Bennjamin,
By the way, you can also embed an image directly into your .js file like this:
var stringTools = DOpus.Create().StringTools()
// iconBase64 content is created using the command:
// base64 -w 0 output.ico
function getIcon() {
var iconBase64 = "AAABAAEAAAAAAAEAIABCTAAAFgAAAIlQTkcNChoKAAAADUlIRFIA..."
return DOpus.LoadImage(stringTools.Decode(iconBase64, 'base64'), '.ico')
}
dlg.icon = getIcon()
Yeah — I did that once because otherwise, if I included the icon as a file, the script's GUID would change, and users would have to re-enter their VirusTotal API key.
Big problems call for big solutions!