Request for clarification on DialogListItem.icon (show icon in listview)

The DialogListItem documentation tells us that we can include icons in a listview, but it seems like this is limited to adding icons by offering their system type ("dir", "file", "ftp", etc) or by offering a “path” into a dll or exe file. I know this works (I can see it, for instance, in @errante’s excellent TabResque script which has already resqued many tabs for me). But his script doesn’t load icons from disk. Yet when I see “path” in the documentation, it seems logical to assume a path straight to a file on disk would work too - yet I failed to find out how.

Below is the extract of code that I tried. The icon is located under /dopusdata/icons and the path is absolutely pointing to a valid *.ico file:

var FSU = DOpus.FSUtil();
var iconpath = FSU.Resolve('/dopusdata/icons');
var iconname = 'important.ico';
var Listview = dlg.Control("SearchResult"); //The listview control I'm using
var row = Listview.AddItem('something');
var rowObj= Listview.GetItemAt(row);
var icon = iconpath + '\\' + iconname; //Absolutely correct path/name
rowObj.icon = icon;

This shows no icon in the listview - only the word ‘something’ is there. The lisview is in “Details” mode and uses multiple columns, it works perfectly well since a long time, but its essence is in showing filenames in the first column (and from there I can open files, etc.), That’s where I try to add the icons.

Those icons, by the way, correspond to the Status icons (Opus statuses, from the labels configuration, category “Status”) - those are the ones I try to make visible in the listview after a search through a large number of files. I have no problem getting the name of the label (using arrstatus = item.Labels("Status"), then taking the first item in the array, if there is one). Mapping the name to the physical locations of the icons associated with it is a no-brainer. I just can’t make it show up in the view.

In addition, or perhaps alternatively, I should also ask if it is possible to load icons directly from their label definitions (category “Status” in particular). This is not absolutely necessary because, as I said, I can do the mapping myself, but maybe there is already some method to pick them by referring to those labels?

I think it should be supported. Do you have the "Small icons" flag turned on in the dialog editor? This is needed for icons to work in details mode.

Failing that, if you can post a working sample I can test with I'll be able to look at it fairly quickly for you.

1 Like

The “small icons” flag did the trick. I didn’t even think “small icons” should demand special attention over “huge icons”.

But, leaving the psychology of small icons aside: thanks for the quick solution.

The Opus manual sometimes looks a bit like an exercise in artistic minimalism (even cubism maybe), but - fortunately - this is being compensated by a great rescue task force.

1 Like

A post was split to a new topic: DialogListItem.icon - support loading images from script package