<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SingleSelListView with custom icons appearing as gray boxes in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/SingleSelListView-with-custom-icons-appearing-as-gray-boxes/m-p/631949#M9815</link>
    <description>&lt;P&gt;I'm having an issue putting custom icons into SingleSelListView rows. No matter how I assign the icon to the row, it always appears as a gray box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I define a listview in the GRC file like this:&lt;/P&gt;&lt;P&gt;/* [ 2] */ SingleSelListView 40 60 370 350 LargePlain 40 40 150 50 singleColumn&lt;/P&gt;&lt;P&gt;then am trying to add the icons via code. I have tried this multiple ways.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I'm using to setup the list view. The list view appears perfectly in the UI, except the icon's appear as grey boxes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;DGListViewSetItemSize(dialogID, listID, 150, 50);
DGListViewSetImageSize(dialogID, listID, 24, 24);
DGListViewDeleteItem(dialogID, listID, DG_ALL_ITEMS);

//this code is inside a loop 
DGListViewInsertItem(dialogID, listID, DG_LIST_BOTTOM);
DGListViewSetItemText(dialogID, listID, DG_LIST_BOTTOM, text);

//icon set here
DG::Icon aicon = DG::Icon(ACAPI_GetOwnResModule(), DG::Icon::GetIdFromString("35011"))
DGListViewSetItemImage(dialogID, listID, DG_LIST_BOTTOM, DG_LVIT_ICON, aicon);

//set status and userdata
DGListViewSetItemStatus(dialogID, listID, DG_LIST_BOTTOM, DG_IS_ENABLE);
DGListViewSetItemUserData(dialogID, listID, DG_LIST_BOTTOM, userData);

//endloop&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried this way of initializing icons and assigning them:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;NewDisplay::NativeImage archimg(ACAPI_GetOwnResModule(), 35011, NewDisplay::NativeImage::Encoding::PNG);
const void* dgPicture = GX::Image(archimg).ToDGPicture();
DGListViewSetItemImage(dialogID, listID, DG_LIST_BOTTOM, DG_LVIT_ICON, DG::Icon(dgPicture));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My final attempt, I added the icons as a DG::IconItems to my ModalDialog, displayed them somewhere so I knew they were working correctly, then did a .SetVisibility(false) and a .Hide() on the icons to not show them. I then did:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;aIcon.SetIcon(DG::Icon(ACAPI_GetOwnResModule(), 35011)); //aIcon is an IconItem
...
...
DGListViewSetItemImage(dialogID, listID, DG_LIST_BOTTOM, DG_LVIT_ICON, aIcon.GetIcon());

DG::Icon ai = aIcon.GetIcon();
bool empty = ai.IsEmpty(); //this is false
bool valid = ai.IsValid(); //this is true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Despite all 3 of these methods, the icon in each row always displays as a grey box. I have tried using&amp;nbsp;DG_LVIT_PICTURE and that didn't work either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any suggestions, or has anyone encountered this before? Can I only use the default icons specified by Archicad?&lt;/P&gt;</description>
    <pubDate>Mon, 23 Sep 2024 19:55:15 GMT</pubDate>
    <dc:creator>NatHen</dc:creator>
    <dc:date>2024-09-23T19:55:15Z</dc:date>
    <item>
      <title>SingleSelListView with custom icons appearing as gray boxes</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SingleSelListView-with-custom-icons-appearing-as-gray-boxes/m-p/631949#M9815</link>
      <description>&lt;P&gt;I'm having an issue putting custom icons into SingleSelListView rows. No matter how I assign the icon to the row, it always appears as a gray box.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I define a listview in the GRC file like this:&lt;/P&gt;&lt;P&gt;/* [ 2] */ SingleSelListView 40 60 370 350 LargePlain 40 40 150 50 singleColumn&lt;/P&gt;&lt;P&gt;then am trying to add the icons via code. I have tried this multiple ways.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I'm using to setup the list view. The list view appears perfectly in the UI, except the icon's appear as grey boxes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;DGListViewSetItemSize(dialogID, listID, 150, 50);
DGListViewSetImageSize(dialogID, listID, 24, 24);
DGListViewDeleteItem(dialogID, listID, DG_ALL_ITEMS);

//this code is inside a loop 
DGListViewInsertItem(dialogID, listID, DG_LIST_BOTTOM);
DGListViewSetItemText(dialogID, listID, DG_LIST_BOTTOM, text);

//icon set here
DG::Icon aicon = DG::Icon(ACAPI_GetOwnResModule(), DG::Icon::GetIdFromString("35011"))
DGListViewSetItemImage(dialogID, listID, DG_LIST_BOTTOM, DG_LVIT_ICON, aicon);

//set status and userdata
DGListViewSetItemStatus(dialogID, listID, DG_LIST_BOTTOM, DG_IS_ENABLE);
DGListViewSetItemUserData(dialogID, listID, DG_LIST_BOTTOM, userData);

//endloop&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried this way of initializing icons and assigning them:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;NewDisplay::NativeImage archimg(ACAPI_GetOwnResModule(), 35011, NewDisplay::NativeImage::Encoding::PNG);
const void* dgPicture = GX::Image(archimg).ToDGPicture();
DGListViewSetItemImage(dialogID, listID, DG_LIST_BOTTOM, DG_LVIT_ICON, DG::Icon(dgPicture));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My final attempt, I added the icons as a DG::IconItems to my ModalDialog, displayed them somewhere so I knew they were working correctly, then did a .SetVisibility(false) and a .Hide() on the icons to not show them. I then did:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;aIcon.SetIcon(DG::Icon(ACAPI_GetOwnResModule(), 35011)); //aIcon is an IconItem
...
...
DGListViewSetItemImage(dialogID, listID, DG_LIST_BOTTOM, DG_LVIT_ICON, aIcon.GetIcon());

DG::Icon ai = aIcon.GetIcon();
bool empty = ai.IsEmpty(); //this is false
bool valid = ai.IsValid(); //this is true&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Despite all 3 of these methods, the icon in each row always displays as a grey box. I have tried using&amp;nbsp;DG_LVIT_PICTURE and that didn't work either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any suggestions, or has anyone encountered this before? Can I only use the default icons specified by Archicad?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 19:55:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SingleSelListView-with-custom-icons-appearing-as-gray-boxes/m-p/631949#M9815</guid>
      <dc:creator>NatHen</dc:creator>
      <dc:date>2024-09-23T19:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: SingleSelListView with custom icons appearing as gray boxes</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/SingleSelListView-with-custom-icons-appearing-as-gray-boxes/m-p/632332#M9817</link>
      <description>&lt;P&gt;The icon identifier variable must have "short" type. Your are passing&amp;nbsp;35011 that is outside of the short range in C++. Try using a number that is lower than&amp;nbsp;&lt;SPAN&gt;32767.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 08:20:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/SingleSelListView-with-custom-icons-appearing-as-gray-boxes/m-p/632332#M9817</guid>
      <dc:creator>Viktor Kovacs</dc:creator>
      <dc:date>2024-09-25T08:20:35Z</dc:date>
    </item>
  </channel>
</rss>

